MIDI output jam


#1

Hi,

I’m developing a MIDI application, and have been experiencing a constant problem with midi output. I wrote a little MIDI echo utility to try and isolate the problem, but without much luck. The problem is that when playing at high speeds, it seems like the output port doesn’t handle the pressure and sometimes freezes for a whole second or even more, before spitting out all the notes that were sent to it during that time.
Now, I tested the same MIDI setup on the same platform with 3 different programs - Cubase SX, Tracktion, and MIDI-OX - and none of them have this problem.
I guess this means I’m probably doing something generally wrong in the handling of incoming/outgoing messages. Maybe it’s an issue of timestamps or buffering that I need to do. In the echo utility, all I do is write the received message to the output port - nothing else.

I would appreciate any tips about this.
Thanks a lot,
Amit


#2

Maybe you should write your code that sends the MIDI messages here… I have the same problem but I have added some optimizations on my code for playing MIDI files, and that works fine if I only use my soft and the sequencer…


#3

…well if you say you didn’t have a problem in tracktion, then remember that tracktion is using the same midi code that’s in Juce…

I expect you’re just using a fixed-size buffer that’s filling up, or something like that. The Juce midi stuff really just passes the messages over to win32, so there’s not a lot to go wrong.


#4

I wasn’t really using any buffers for this little test. In the MidiInputCallback (method handleIncomingMidiMessage()) I simply send the message as is to the output device using the sendMessageNow() method.
Is this a bad approach?

Amit


#5

Whether it’s a good or bad approach really depends on whether the midi driver can cope with calling it all on the same thread - I guess most devices will be ok, but you never know…


#6