https://github.com/desktopgame/next_synth_midi
https://github.com/desktopgame/next_synth_midi
dart flutter midi
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/desktopgame/next_synth_midi
- Owner: desktopgame
- License: mit
- Created: 2021-01-16T06:52:43.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-21T07:35:59.000Z (over 5 years ago)
- Last Synced: 2025-02-23T23:28:35.468Z (over 1 year ago)
- Topics: dart, flutter, midi
- Language: Kotlin
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# next_synth_midi
MIDI機能を使用するためのネイティブライブラリ
## example
MIDI端末を列挙して、最初に見つかった端末にノートオン,ノートオフを送信する
````.dart
Future sendMidiMessage() async {
int deviceCount = await NextSynthMidi.deviceCount;
bool opened = false;
print("deviceCount= ${deviceCount}");
for (int i = 0; i < deviceCount; i++) {
String name = await NextSynthMidi.getDeviceName(i);
int inputs = await NextSynthMidi.getInputPortCount(i);
int outputs = await NextSynthMidi.getOutputPortCount(i);
print("name=${name} inputs=${inputs} outputs=${outputs}");
for (int j = 0; j < inputs + outputs; j++) {
int port = await NextSynthMidi.getPortNumber(i, j);
bool isInput = await NextSynthMidi.isInputPort(i, j);
bool isOutput = await NextSynthMidi.isOutputPort(i, j);
print("[$j] port=${port} isInput=${isInput} isOutput=${isOutput}");
if (isOutput && !opened) {
await NextSynthMidi.openPort(i, port, -1);
await NextSynthMidi.waitForOpen(i, port, -1);
await NextSynthMidi.send(i, port, Uint8List.fromList([0x90, 60, 127]), 0, 3);
await Future.delayed(new Duration(seconds: 3));
await NextSynthMidi.send(i, port, Uint8List.fromList([0x90, 60, 0]), 0, 3);
var n = await NextSynthMidi.closePort(i, port, -1);
print("send! $n");
}
}
}
}
````