I am trying to stream MIDI events from a MIDI keyboard on Android on top of a MIDI file playback.
I have a question regarding the requirements of the ByteBuffer that shall be used: if I try to pass the buffer as received by the onSend() method of the Android MidiReceiver, wrapped in a ByteBuffer with
ByteBuffer data = ByteBuffer.wrap(msg, offset, count)
int n = XBASSMIDI.BASS_MIDI_StreamEvents(chanId, BASS_MIDI_EVENTS_RAW, data, data.remaining())
I get n = 0 and no playback. If I make a copy of it before passing, it works:
byte[] x = new byte[count];
System.arraycopy(msg, offset, x, 0, count);
ByteBuffer data = ByteBuffer.wrap(x);
int n = XBASSMIDI.BASS_MIDI_StreamEvents(chanId, BASS_MIDI_EVENTS_RAW, data, data.remaining())
it works. Could it be an issue related to the fact that offset is not zero?