From 6e76fb4a5c84cc33f2230ddb9d5d537dc2d3a67a Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Mon, 26 Aug 2024 10:51:54 +0800 Subject: [PATCH] use LibreMidiAccess in ktmidi-ci-tool. --- ktmidi-ci-tool/build.gradle.kts | 3 ++- .../dev/atsushieno/ktmidi/citool/MidiDeviceManager.kt | 1 + ktmidi-ci-tool/src/desktopMain/kotlin/main.kt | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ktmidi-ci-tool/build.gradle.kts b/ktmidi-ci-tool/build.gradle.kts index 06a66c19b..ac575d685 100644 --- a/ktmidi-ci-tool/build.gradle.kts +++ b/ktmidi-ci-tool/build.gradle.kts @@ -69,8 +69,9 @@ kotlin { implementation(compose.desktop.currentOs) implementation(project(":ktmidi-jvm-desktop")) implementation(libs.mpfilepicker) - // without this, jnirtmidi.so will not be found at runtime. + // without this, jnirtmidi.so and jnilibremidi.so will not be found at runtime. api(libs.rtmidi.javacpp.platform) + api(libs.libremidi.javacpp.platform) implementation(libs.kotlinx.coroutines.swing) } diff --git a/ktmidi-ci-tool/src/commonMain/kotlin/dev/atsushieno/ktmidi/citool/MidiDeviceManager.kt b/ktmidi-ci-tool/src/commonMain/kotlin/dev/atsushieno/ktmidi/citool/MidiDeviceManager.kt index ec179ce89..f3c1506b4 100644 --- a/ktmidi-ci-tool/src/commonMain/kotlin/dev/atsushieno/ktmidi/citool/MidiDeviceManager.kt +++ b/ktmidi-ci-tool/src/commonMain/kotlin/dev/atsushieno/ktmidi/citool/MidiDeviceManager.kt @@ -61,6 +61,7 @@ class MidiDeviceManager { virtualMidiOutput2 = midiAccessValue.createVirtualInputSender(pcIn2) } catch (ex: Exception) { println(ex) + ex.printStackTrace() } } diff --git a/ktmidi-ci-tool/src/desktopMain/kotlin/main.kt b/ktmidi-ci-tool/src/desktopMain/kotlin/main.kt index 88921321e..24de67fe9 100644 --- a/ktmidi-ci-tool/src/desktopMain/kotlin/main.kt +++ b/ktmidi-ci-tool/src/desktopMain/kotlin/main.kt @@ -12,15 +12,19 @@ import java.io.File fun main(args: Array) = 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( LibreMidiAccess.create(MidiTransportProtocol.UMP), LibreMidiAccess.create(MidiTransportProtocol.MIDI1) - ))*/ + )) + */ Window(onCloseRequest = ::exitApplication, state = rememberWindowState(), title = "midi-ci-tool") {