[alsa-devel] How to send non-SysEx system messages via ALSA?

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Tue Mar 5 11:56:24 CET 2013


Hi,

seqmid.h contains function that declare the major event types like
snd_seq_ev_set_noteon and snd_seq_ev_set_sysex.  However, seq_event.h
knows many more types, e.g. SND_SEQ_EVENT_START and
SND_SEQ_EVENT_CLOCK/TICK.

Now, consider an app playing a MIDI file or a debug tool that allows
to send arbitrary messages.  How should such an app send e.g. the
2-byte MTC Quarter Frame sequence via ALSA?

A. Use a 2 byte buffer F1 xx and snd_seq_ev_set_sysex(&event, 2, buf);

B. Use SND_SEQ_EVENT_TICK and figure out some copy&paste code from seqmidi.h, perhaps
   snd_seq_ev_set_queue_control(ev,SND_SEQ_EVENT_TICK,SND_SEQ_QUEUE_DIRECT,xx)
   But why does that alter my destination port via
    snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER)?

C. It's SND_SEQ_EVENT_CLOCK actually, TICK being the one byte F8 real-time message?

Background: Wine on Linux needs to generate such messages on behalf of
applications and users with real MIDI HW.
So far Wine assumes that it can encapsulate all system messages in a SysEx,
IOW Wine does A.  Is that usage of the set_sysex API correct?
More generally, can Wine transparently stuff system messages into a byte buffer
and send them off via snd_seq_ev_set_sysex?

Thank you,
 Jörg Höhle


More information about the Alsa-devel mailing list