Skip to contentSkip to conversation

snd_seq_sync_output_queue does not work

DISCUSSION BengtM�ffffe5nsson 2 participants 3 messages Dec 2, 2004

lore
Share & tools
lore
#0 lore raw

I'm trying to make an app where I need to exchange an 18k sysex. I use Rh9.
I think I've worked out the receiving part, but sending will not work.
I chop the big sysex into 256 byte blocks and send in a sequence. This seems to work fine when I run it stepwise in the debugger, but crash when I run it at full speed.
I think I've traced the problem down to the call to snd_seq_sync_output_queue. I expect that call to hang until the output is drained, and return a 0. What happens is that the call seems to return immediately with a 1.
Tried to use snd_seq_nonblock(0) but that didn't change anything.
Does anyone have any hint?
/Bengt

__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/

#1 lore raw
Quoted 8 lines · Bengt Månsson

I'm trying to make an app where I need to exchange an 18k sysex. I use Rh9.
I think I've worked out the receiving part, but sending will not work.
I chop the big sysex into 256 byte blocks and send in a sequence. This seems to work fine when I run it stepwise in the debugger, but crash when I run it at full speed.

The sequencer isn't designed to handle big sysexs. Due to the message-based architecture it's difficult to signal back to the sending application that the output buffer is full.

I'd guess some message couldn't be delivered and was thrown away.

Try to limit the rate of messages so that you don't exceed the MIDI data rate.

Quoted 5 lines

I think I've traced the problem down to the call to snd_seq_sync_output_queue. I expect that call to hang until the output is drained, and return a 0. What happens is that the call seems to return immediately with a 1.

The documentation is wrong, any nonnegative return value indicates success (the current implementation always returns 1).

snd_seq_sync_output_queue waits until all events have been sent. At this point, it's too late to detect events than cannot be delivered at the destination.

The documentation, if it actually existed, would tell you to use the rawmidi API for big chunks of sysex data. See the amidi program for an example.

HTH
Clemens

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/

#2 lore raw

Thank you for your quick reply.
I've looked at amidi and maybe that is a solution. It's a little bit annoying though, since receiving works so fine. I would prefer a symetrical solution that is easy to map to tha java api.
Maybe a sleep is easiest, but I'll consider that when I've had some myself.
/Bengt

Quoted 53 lines · --- Clemens Ladisch
Quoted 1 line · Bengt Månsson

I'm trying to make an app where I need to exchange

an

Quoted 4 lines

18k sysex. I use Rh9.
I think I've worked out the receiving part, but sending will not work.
I chop the big sysex into 256 byte blocks and send

in

Quoted 2 lines

a sequence. This seems to work fine when I run it stepwise in the debugger, but crash when I run it

at

Quoted 1 line

full speed.

The sequencer isn't designed to handle big sysexs. Due to the
message-based architecture it's difficult to signal back to the
sending application that the output buffer is full.

I'd guess some message couldn't be delivered and was thrown away.

Try to limit the rate of messages so that you don't exceed the MIDI
data rate.

Quoted 1 line

I think I've traced the problem down to the call

to

Quoted 1 line

snd_seq_sync_output_queue. I expect that call to

hang

Quoted 3 lines

until the output is drained, and return a 0. What happens is that the call seems to return immediately with a 1.

The documentation is wrong, any nonnegative return value indicates
success (the current implementation always returns 1).

snd_seq_sync_output_queue waits until all events have been sent. At
this point, it's too late to detect events than cannot be delivered at
the destination.

The documentation, if it actually existed, would tell you to use the
rawmidi API for big chunks of sysex data. See the amidi program for
an example.

Quoted 4 lines

HTH
Clemens

__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/