send method

dynamic send(
  1. Uint8List data
)

Implementation

send(Uint8List data) async {
  // Set data in out buffer
  _midiOutBuffer.asTypedList(data.length).setAll(0, data);
  _midiOutHeader.ref.lpData = _midiOutBuffer as LPSTR;
  _midiOutHeader.ref.dwBytesRecorded =
      _midiOutHeader.ref.dwBufferLength = data.length;
  _midiOutHeader.ref.dwFlags = 0;

  int result = midiOutPrepareHeader(
      hMidiOutDevicePtr.value, _midiOutHeader, sizeOf<MIDIHDR>());
  if (result != 0) {
    print("HDR OUT PREP ERROR: ${midiErrorMessage(result)}");
  }

  result = midiOutLongMsg(
      hMidiOutDevicePtr.value, _midiOutHeader, sizeOf<MIDIHDR>());
  if (result != 0) {
    print("SEND ERROR($result): ${midiErrorMessage(result)}");
  }

  result = midiOutUnprepareHeader(
      hMidiOutDevicePtr.value, _midiOutHeader, sizeOf<MIDIHDR>());
  if (result != 0) {
    print("OUT UNPREEOARE ERROR($result): ${midiErrorMessage(result)}");
  }
}