Create a Tracktion Engine Virtual Midi Port Fails

Hi, I’m trying to create a virtual midi Device, because I want to send midi data inside my app between tracks (a sort of aux midi to send for example midi in bus 1 and receive it in many tracks that have the same bus).

For this purpose this is the code I’m writing to create this virtual port:

tracktion_engine::VirtualMidiInputDevice myVirtualMidiInputDevice{engine, "myVirtualMidi", VirtualMidiInputDevice::virtualMidiDevice};
myVirtualMidiInputDevice.createInstance(*edit->getCurrentPlaybackContext());
myVirtualMidiInputDevice.setEnabled(true);

But after Compile it an error says JUCE Message Thread (1): EXC_BAD_ACCESS (code=1, address=0x0) is rised in line of code 64 inside “tracktion_VirtualMidiInputDevice.cpp”.

Other Question: when I’ll create this port it will be visible only inside my app or also outside (so for example another daw can receive data from this?)

ThanYou!

There’s a few different questions here.

Firstly, I think the crash is because you’re creating a tracktion_engine::VirtualMidiInputDevice on the stack which is then getting deleted. You probably want to call DeviceManager::createVirtualMidiDevice and then get the virtual device using DeviceManager::getMidiInDevice.

However, I don’t think a VirtualMidiInputDevice is really what you are after? In Tracktion Engine, these are essentially input devices that can combine multiple MIDI input device inputs in to a single input. They’re not the same as a juce::MidiInput::createNewDevice that you can create on macOS to pipe MIDI between apps.

I think the best thing to do is to open up Waveform and play with the virtual MIDI inputs, do these do what you need?

1 Like