Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read midi messages #1

Open
rmt opened this issue Sep 4, 2022 · 1 comment
Open

Cannot read midi messages #1

rmt opened this issue Sep 4, 2022 · 1 comment

Comments

@rmt
Copy link

rmt commented Sep 4, 2022

The wrapper.getMessage API isn't called correctly, as the size of the buffer must be passed in. If this isn't done, the buffer isn't modified.
Here is how I patched it:

diff --git a/rtmidi.nim b/rtmidi.nim
index 16d4eb8..542ff10 100644
--- a/rtmidi.nim
+++ b/rtmidi.nim
@@ -99,10 +99,11 @@ proc ignoreTypes*(m: MidiIn, midiSysEx: bool = true, midiTime: bool = true,
   wrapper.ignoreTypes(m, midiSysEx, midiTime, midiSense)
 
 proc getNextMessage*(m: MidiIn,
-                     buffer: var openArray[byte]): tuple[length: Natural,
-                                                         eventDelta: float] =
+                     buffer: var openArray[byte],
+                     blen: csize): tuple[length: Natural,
+                                         eventDelta: float] =
   withHandleError(m):
-    var length: csize
+    var length: csize = blen
     var eventDelta = wrapper.getMessage(m, buffer[0].addr, length.addr)
     result = (length.Natural, eventDelta)
@johnnovak
Copy link
Owner

Hi, thanks, could you raise a PR? I haven't been actively using the wrapper for at least 2 years now 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants