Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/flutter_midi_command_platform_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,15 @@ abstract class MidiCommandPlatform extends PlatformInterface {
throw UnimplementedError(
'setNetworkSessionEnabled has not been implemented.');
}

/// Returns the current state of the raw MIDI receiving flag.
Future<bool?> 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<void> setRawMidiDataReceivingEnabled(String deviceId, bool enabled) {
throw UnimplementedError('setRawMidiDataReceivingEnabled has not been implemented.');
}
}
15 changes: 14 additions & 1 deletion lib/method_channel_midi_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MethodChannelMidiCommand extends MidiCommandPlatform {
if (portList == null) return [];
var ports = portList.map<MidiPort>((e) {
var portMap = (e as Map).cast<String, Object>();
return MidiPort(portMap["id"] as int, type);
return MidiPort(portMap["id"] as int, type, portMap['name'] as String);
});
return ports.toList(growable: false);
}
Expand Down Expand Up @@ -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<bool?> getRawMidiDataReceivingEnabled(String deviceId) {
return _methodChannel.invokeMethod('isRawMidiDataReceivingEnabled', {'deviceId': deviceId});
}

/// Sets the enabled state of raw MIDI data recieving.
Future<void> setRawMidiDataReceivingEnabled(String deviceId, bool enabled) {
return _methodChannel.invokeMethod(
'enableRawMidiDataReceiving',
{'deviceId': deviceId, 'enabled': enabled},
);
}
}
5 changes: 3 additions & 2 deletions lib/midi_port.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> get toDictionary {
return {"id": id, "type": type.toString(), "connected": connected};
return {"id": id, "name": name, "type": type.toString(), "connected": connected};
}
}