Skip to content

Commit

Permalink
citool: check canCreateVirtualPort() on UMP too. Use LibreMidiAccess …
Browse files Browse the repository at this point in the history
…now.
  • Loading branch information
atsushieno committed Sep 3, 2024
1 parent 9d85910 commit 867daea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ class MidiDeviceManager {
midiProtocol = MidiTransportProtocol.UMP,
)

virtualMidiInput2 = midiAccessValue.createVirtualOutputReceiver(pcOut2)
midiInputOpened.forEach { it(virtualMidiInput2!!) }
virtualMidiOutput2 = midiAccessValue.createVirtualInputSender(pcIn2)
if (midiAccessValue.canCreateVirtualPort(pcIn2) && midiAccessValue.canCreateVirtualPort(pcOut2)) {
virtualMidiInput2 = midiAccessValue.createVirtualOutputReceiver(pcOut2)
midiInputOpened.forEach { it(virtualMidiInput2!!) }
virtualMidiOutput2 = midiAccessValue.createVirtualInputSender(pcIn2)
}
} catch (ex: Exception) {
println(ex)
ex.printStackTrace()
Expand Down
9 changes: 2 additions & 7 deletions ktmidi-ci-tool/src/desktopMain/kotlin/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,14 @@ import java.io.File
fun main(args: Array<String>) = application {
initializeAppModel(this)
AppModel.midiDeviceManager.midiAccess =
/*
if (File("/dev/snd/seq").exists()) AlsaMidiAccess()
else if (args.contains("jvm")) JvmMidiAccess()
else if (System.getProperty("os.name").contains("Windows")) JvmMidiAccess()
else RtMidiAccess() // rtmidi-javacpp does not support Windows build nowadays.
*/
LibreMidiAccess.create(MidiTransportProtocol.MIDI1)
/*
MergedMidiAccess("LibreMidi1+2", listOf(
// else RtMidiAccess()
else MergedMidiAccess("LibreMidiAccess-1+2", listOf(
LibreMidiAccess.create(MidiTransportProtocol.UMP),
LibreMidiAccess.create(MidiTransportProtocol.MIDI1)
))
*/
Window(onCloseRequest = ::exitApplication,
state = rememberWindowState(),
title = "midi-ci-tool") {
Expand Down

0 comments on commit 867daea

Please sign in to comment.