Compare commits
2 Commits
227ab3f45d
...
aadbd26fab
Author | SHA1 | Date |
---|---|---|
Christopher Arndt | aadbd26fab | |
Christopher Arndt | f78bb963fb |
|
@ -67,17 +67,20 @@ proc midiEventPrinterProc() {.thread.} =
|
||||||
|
|
||||||
dataReadyLock.acquire()
|
dataReadyLock.acquire()
|
||||||
|
|
||||||
while not exitLoop:
|
while true:
|
||||||
while not exitLoop and ringbufferReadSpace(rb) >= 4:
|
while not exitLoop and ringbufferReadSpace(rb) >= 4:
|
||||||
var read = cast[int](ringbufferRead(rb, cast[cstring](recvBuf.addr), 4))
|
var read = cast[int](ringbufferRead(rb, cast[cstring](recvBuf.addr), 4))
|
||||||
|
|
||||||
if recvBuf[0] <= 3:
|
if recvBuf[0] <= 3:
|
||||||
for i in 0..<recvBuf[0].int:
|
for i in 0..<recvBuf[0].int:
|
||||||
stdout.write(fmt"{recvBuf[i+1]:#02X} ")
|
stdout.write(fmt"0x{recvBuf[i+1]:02X} ")
|
||||||
|
|
||||||
stdout.write("\n")
|
stdout.write("\n")
|
||||||
stdout.flushFile()
|
stdout.flushFile()
|
||||||
|
|
||||||
|
if exitLoop:
|
||||||
|
break
|
||||||
|
|
||||||
dataReady.wait(dataReadyLock)
|
dataReady.wait(dataReadyLock)
|
||||||
|
|
||||||
dataReadyLock.release()
|
dataReadyLock.release()
|
||||||
|
|
|
@ -67,7 +67,7 @@ proc midiEventPrinterProc() =
|
||||||
break
|
break
|
||||||
elif event.size <= 3:
|
elif event.size <= 3:
|
||||||
for i in 0..<event.size:
|
for i in 0..<event.size:
|
||||||
stdout.write(fmt"{event.buffer[i]:#02X} ")
|
stdout.write(fmt"0x{event.buffer[i]:02X} ")
|
||||||
|
|
||||||
stdout.write("\n")
|
stdout.write("\n")
|
||||||
stdout.flushFile()
|
stdout.flushFile()
|
||||||
|
|
Loading…
Reference in New Issue