alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Joerg-Cyril.Hoehle@t-systems.com
Cc: alsa-devel@alsa-project.org
Subject: Re: How to send non-SysEx system messages via ALSA?
Date: Tue, 05 Mar 2013 12:51:24 +0100	[thread overview]
Message-ID: <5135DC3C.20706@ladisch.de> (raw)
In-Reply-To: <8E4C156DA5797D418DBFADFD8CE655A422BA54AFBB@HE113481.emea1.cds.t-internal.com>

Joerg-Cyril.Hoehle@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
> SND_SEQ_EVENT_CLOCK/TICK.

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.)

>    snd_seq_ev_set_queue_control(ev,...)
>    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:
http://www.alsa-project.org/alsa-doc/alsa-lib/group___m_i_d_i___event.html


Regards,
Clemens

  reply	other threads:[~2013-03-05 11:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05 10:56 How to send non-SysEx system messages via ALSA? Joerg-Cyril.Hoehle
2013-03-05 11:51 ` Clemens Ladisch [this message]
2013-03-06  5:09   ` Devin Anderson
2013-03-06  8:22     ` Clemens Ladisch
2013-03-09 19:42 ` Gabriel M. Beddingfield
2013-03-09 21:01   ` Clemens Ladisch
2013-03-09 21:21     ` Gabriel Beddingfield
2013-03-13 13:36       ` Joerg-Cyril.Hoehle
2013-03-13 14:57         ` Clemens Ladisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5135DC3C.20706@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=Joerg-Cyril.Hoehle@t-systems.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).