Skip to content

Commit

Permalink
RtMidi sender was not using length argument when offset was 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
atsushieno committed Aug 24, 2024
1 parent 9410681 commit 71ef103
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.bytedeco.javacpp.Pointer

import dev.atsushieno.rtmidi_javacpp.global.rtmidi as library

class RtMidiAccess() : MidiAccess() {
class RtMidiAccess : MidiAccess() {
companion object {

internal fun getPortName(rtmidi: Pointer, index: Int) : String {
Expand Down Expand Up @@ -150,7 +150,7 @@ class RtMidiAccess() : MidiAccess() {
}

override fun send(mevent: ByteArray, offset: Int, length: Int, timestampInNanoseconds: Long) {
library.rtmidi_out_send_message(rtmidi, if (offset > 0) mevent.drop(offset).take(length).toByteArray() else mevent, length)
library.rtmidi_out_send_message(rtmidi, if (offset > 0 && mevent.size == length) mevent.drop(offset).take(length).toByteArray() else mevent, length)
}

init {
Expand Down

0 comments on commit 71ef103

Please sign in to comment.