Skip to content

Commit

Permalink
create virtual ports only when they are supported by the MidiAccess.
Browse files Browse the repository at this point in the history
  • Loading branch information
atsushieno committed Sep 2, 2024
1 parent 85e1275 commit f628e55
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ class MidiDeviceManager {
midiProtocol = MidiTransportProtocol.MIDI1,
)

virtualMidiInput = midiAccessValue.createVirtualOutputReceiver(pcOut)
midiInputOpened.forEach { it(virtualMidiInput!!) }
virtualMidiOutput = midiAccessValue.createVirtualInputSender(pcIn)
if (midiAccessValue.canCreateVirtualPort(pcIn) && midiAccessValue.canCreateVirtualPort(pcOut)) {
virtualMidiInput = midiAccessValue.createVirtualOutputReceiver(pcOut)
midiInputOpened.forEach { it(virtualMidiInput!!) }
virtualMidiOutput = midiAccessValue.createVirtualInputSender(pcIn)
}

if (!midiAccessValue.supportsUmpTransport)
return
Expand Down

0 comments on commit f628e55

Please sign in to comment.