I design a standalone JUCE application, which processes some MIDI data coming from MIDI Devices and send it to another MIDI Devices. I’ve got a problem with some of MIDI Devices which are connected via USB - my keyboard KETRON SD9, and poor quality USB to MIDI interface.
The whole system requires DAW app for work. When I run e.g. Cubase (the same also on Cakewalk and Ableton), and create the MIDI track with some data, then I set the MIDI outputs of this track to this USB MIDI devices. When I run my app and I want to select the same USB-MIDI devices as I set in DAW, my app goes to crash. Moreover, when I do something similar with MIDI Input in my app - so I choose the USB-MIDI input first on DAW, and then the same in my app, everything works correctly. But when I want to disable this MIDI Device in my app, it also goes to crash.
I perform the debugging of my app. I have seen that my app crashes when the functions: startBackgroundThread(), stopBackgroundThread() and isBackgroungThreadRunning are recalled. Of course I cannot abandon this, because my app will not send out any MIDI data. In the second case (with MIDI IN) my app crashes when the function MidiDevice->stop() is recalled. When I was writing the MIDI I/O services, I based on MidiDemo.h project.
Last but not least - I’ve got an audio interface Focusrite Scarlett 6i6 2nd Gen. I use its MIDI input and output, and I can freely enable / disable the Focusrite USB MIDI device on DAW and my app, and it works correctly all the time.
What should I do? Maybe I do something wrong? Where is the problem - in my app, in drivers for this USB-MIDI device, or something more?
Thanks in advance
P.S. This USB-MIDI devices works ONLY on Windows. It doesn’t work on Mac.