plaidpants / soundstagevr

virtual reality music sandbox built specifically for room-scale VR
Apache License 2.0
44 stars 9 forks source link

Midi out crashes #29

Open aspitarl opened 4 years ago

aspitarl commented 4 years ago

Hi, I'm totally new to unity, but was able to get version 9.0.0 to build and am able to use/hear keyboards drums etc in VR with a valve index and both unity version 2019.2.15 and 2019.2.17

I am trying to get midi out to work with ableton using LoopMIDI. The midi out device sees the LoopMIDI channels and is able to connect. However, whenever I try and send a signal, either from a keyboard or a xyz controller, the program crashes. I am getting the following error message.

DeviceException: Error in the application. Midi.OutputDevice.CheckReturnCode (Midi.Win32API+MMRESULT rc) (at <3ae8989f39284848a71554ade1624b8b>:0) Midi.OutputDevice.SendNoteOn (Midi.Channel channel, Midi.Pitch pitch, System.Int32 velocity) (at <3ae8989f39284848a71554ade1624b8b>:0) MIDImaster.outputNote (MIDIdevice _dev, System.Boolean on, System.Int32 ID, System.Int32 channel) (at Assets/Scripts/MIDI/MIDImaster.cs:164) midiComponentInterface.OutputNote (System.Boolean on, System.Int32 ID, System.Boolean add48) (at Assets/Scripts/MIDI/midiComponentInterface.cs:200) keyboardDeviceInterface.keyHitEvent (System.Boolean on, System.Int32 ID) (at Assets/Scripts/Keyboard/keyboardDeviceInterface.cs:135) keyboardDeviceInterface.asynchKeyHit (System.Boolean on, System.Int32 ID, keyboardDeviceInterface+keyInput k) (at Assets/Scripts/Keyboard/keyboardDeviceInterface.cs:120) keyboardDeviceInterface.hit (System.Boolean on, System.Int32 ID) (at Assets/Scripts/Keyboard/keyboardDeviceInterface.cs:170) key.keyHitCheck () (at Assets/Scripts/UI/key.cs:61) key.onTouch (System.Boolean on, manipulator m) (at Assets/Scripts/UI/key.cs:140) manipulator.OnCollisionEnter (UnityEngine.Collision coll) (at Assets/Scripts/CoreClasses/manipulator.cs:141)

plaidpants commented 4 years ago

This died in the external midi.dll midi-dot-net, need to debug further into that DLL on the PC to see what happened. https://github.com/jstnryan/midi-dot-net/, I have not been focusing on the PC/VIVE/Rift version of the code but I suspect this could occur on the original release also. I will need to see if I can reproduce the issue on the PC. Probably should switch to a different MIDI support library as midi-dot-net does not work on Android which is needed for Oculus Quest support. Probably something paid like https://assetstore.unity.com/packages/tools/audio/midi-unified-2019-2-6-85256

andybak commented 4 years ago

I was previously using Keijiro's Midi Jack but he's switched to rtmidi: https://github.com/keijiro/jp.keijiro.rtmidi

He's also written a wrapper that maps it to the new input system (might not be suitable for your use case): https://github.com/keijiro/Minis

Just thought I'd mention it. It would be a shame to add a non-open source dependency to this project.

plaidpants commented 4 years ago

I rebuilt the Midi.dll code with debug info with VS 2017. I was not able to get it to crash now. Could you pull the dll and see if you are still seeing an issue.