[alsa-devel] How to send non-SysEx system messages via ALSA?
clemens at ladisch.de
Tue Mar 5 12:51:24 CET 2013
Joerg-Cyril.Hoehle at t-systems.com wrote:
> 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
The functions in seqmid.h are just helpers for the most common messages;
you can fill the snd_seq_event_t structure manually.
> 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?
> B. Use SND_SEQ_EVENT_TICK
This is not a MIDI message. (In fact, this message is not used at all.
Er, and don't believe what its comment says.)
> But why does that alter my destination port via
> snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER)?
Certain messages are use for sequencer-specific notification and control
purposes. Messages that affect (queue) timers are sent to the special
system timer client.
> C. It's SND_SEQ_EVENT_CLOCK actually,
SND_SEQ_EVENT_CLOCK is MIDI Clock (F8).
MTC Quarter Frame (F1) is SND_SEQ_EVENT_QFRAME.
> 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?
It works, but it's not what this event type was designed for. In any
case, all MIDI messages have a corresponding sequencer event type, so
you should use that.
You could save much work by using ALSA's built-in MIDI encoder:
More information about the Alsa-devel