From a9fa0b6255adde730d0824ccef96a42b1ace82b4 Mon Sep 17 00:00:00 2001 From: rmri Date: Mon, 13 May 2024 09:20:30 +0200 Subject: [PATCH 1/4] added flag to receive raw midi packets --- lib/flutter_midi_command_platform_interface.dart | 10 ++++++++++ lib/method_channel_midi_command.dart | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lib/flutter_midi_command_platform_interface.dart b/lib/flutter_midi_command_platform_interface.dart index 9e010d5..2c8e5b8 100644 --- a/lib/flutter_midi_command_platform_interface.dart +++ b/lib/flutter_midi_command_platform_interface.dart @@ -123,5 +123,15 @@ abstract class MidiCommandPlatform extends PlatformInterface { void setNetworkSessionEnabled(bool enabled) { throw UnimplementedError( 'setNetworkSessionEnabled has not been implemented.'); + + /// Returns the current state of the raw midi receiving flag. + Future getRawMidiDataReceivingEnabled(String deviceId) { + throw UnimplementedError('getRawMidiDataReceivingEnabled has not been implemented.'); + } + + /// When enabled all incoming MIDI packets are transmitted exactly as received, + /// without compiling them into well formed midi messages. + Future setRawMidiDataReceivingEnabled(String deviceId, bool enabled) { + throw UnimplementedError('setRawMidiDataReceivingEnabled has not been implemented.'); } } diff --git a/lib/method_channel_midi_command.dart b/lib/method_channel_midi_command.dart index 475494d..00927e8 100644 --- a/lib/method_channel_midi_command.dart +++ b/lib/method_channel_midi_command.dart @@ -171,4 +171,17 @@ class MethodChannelMidiCommand extends MidiCommandPlatform { void setNetworkSessionEnabled(bool enabled) { _methodChannel.invokeMethod('enableNetworkSession', enabled); } + + /// Returns the current state of the raw MIDI message receiving flag. + Future getRawMidiDataReceivingEnabled(String deviceId) { + return _methodChannel.invokeMethod('isRawMidiDataReceivingEnabled', {'deviceId': deviceId}); + } + + /// Sets the enabled state of raw MIDI data recieving. + Future setRawMidiDataReceivingEnabled(String deviceId, bool enabled) { + return _methodChannel.invokeMethod( + 'enableRawMidiDataReceiving', + {'deviceId': deviceId, 'enabled': enabled}, + ); + } } From 68c33ebf94a0006356061e96b0c3892bcbf178d2 Mon Sep 17 00:00:00 2001 From: rmri Date: Mon, 13 May 2024 09:22:07 +0200 Subject: [PATCH 2/4] cleanup --- lib/flutter_midi_command_platform_interface.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/flutter_midi_command_platform_interface.dart b/lib/flutter_midi_command_platform_interface.dart index 2c8e5b8..11d0f31 100644 --- a/lib/flutter_midi_command_platform_interface.dart +++ b/lib/flutter_midi_command_platform_interface.dart @@ -124,13 +124,13 @@ abstract class MidiCommandPlatform extends PlatformInterface { throw UnimplementedError( 'setNetworkSessionEnabled has not been implemented.'); - /// Returns the current state of the raw midi receiving flag. + /// Returns the current state of the raw MIDI receiving flag. Future getRawMidiDataReceivingEnabled(String deviceId) { throw UnimplementedError('getRawMidiDataReceivingEnabled has not been implemented.'); } /// When enabled all incoming MIDI packets are transmitted exactly as received, - /// without compiling them into well formed midi messages. + /// without compiling them into well formed MIDI messages. Future setRawMidiDataReceivingEnabled(String deviceId, bool enabled) { throw UnimplementedError('setRawMidiDataReceivingEnabled has not been implemented.'); } From d398efac2add527518cd46cedac7d9ea8d9a2a39 Mon Sep 17 00:00:00 2001 From: rmri Date: Mon, 13 May 2024 09:38:17 +0200 Subject: [PATCH 3/4] fixed typo --- lib/flutter_midi_command_platform_interface.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/flutter_midi_command_platform_interface.dart b/lib/flutter_midi_command_platform_interface.dart index 11d0f31..b5f81a1 100644 --- a/lib/flutter_midi_command_platform_interface.dart +++ b/lib/flutter_midi_command_platform_interface.dart @@ -123,6 +123,7 @@ abstract class MidiCommandPlatform extends PlatformInterface { void setNetworkSessionEnabled(bool enabled) { throw UnimplementedError( 'setNetworkSessionEnabled has not been implemented.'); + } /// Returns the current state of the raw MIDI receiving flag. Future getRawMidiDataReceivingEnabled(String deviceId) { From 9cf5d5c95ce8500e7c927a9f2f6b266b21852a8b Mon Sep 17 00:00:00 2001 From: rmri Date: Sat, 18 May 2024 15:00:14 +0200 Subject: [PATCH 4/4] added port names --- lib/method_channel_midi_command.dart | 2 +- lib/midi_port.dart | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/method_channel_midi_command.dart b/lib/method_channel_midi_command.dart index 00927e8..b0c6954 100644 --- a/lib/method_channel_midi_command.dart +++ b/lib/method_channel_midi_command.dart @@ -35,7 +35,7 @@ class MethodChannelMidiCommand extends MidiCommandPlatform { if (portList == null) return []; var ports = portList.map((e) { var portMap = (e as Map).cast(); - return MidiPort(portMap["id"] as int, type); + return MidiPort(portMap["id"] as int, type, portMap['name'] as String); }); return ports.toList(growable: false); } diff --git a/lib/midi_port.dart b/lib/midi_port.dart index b50360d..23f6caf 100644 --- a/lib/midi_port.dart +++ b/lib/midi_port.dart @@ -4,10 +4,11 @@ class MidiPort { MidiPortType type; int id; bool connected = false; + String name; - MidiPort(this.id, this.type); + MidiPort(this.id, this.type, this.name); Map get toDictionary { - return {"id": id, "type": type.toString(), "connected": connected}; + return {"id": id, "name": name, "type": type.toString(), "connected": connected}; } }