winealsa: Have the MIDI recorder wait in poll(), not snd_seq_event_input().

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Fri Feb 22 05:45:12 CST 2013


Hi,

Johannes Kroll wrote:
>I don't understand what you mean by "decompose LongMsg into snippets".
>Is it possible that either
>A) the app expects the API code to scan the buffer for a trailing 0xf7
>end marker and send only the bytes up to that marker; or
>B) that the mysterious "dwBytesRecorded" should really contain the
>bytes to be sent, and that it should be set by a function calling
>LongMsg (i. e. somewhere else in Wine)?

We have no evidence that dwBytesRecorded shall be used.

Neither A nor B.  I'll explain.
Net.wisdom has it that midiOutLongMsg can be used to
play chords, e.g. send 2 note-on events: 91 K1 V1 92 K2 V2

If MIDI worked only over the serial port, there would be no complication:
Simply send all those bytes over the serial port.  Let the receiver handle them.

The OSS interface works like this: just dump bytes one by one.
http://source.winehq.org/source/dlls/wineoss.drv/midi.c?v=wine-1.5.23#L1559
That's why I believe OSS would work fine as is with your app.

The ALSA interface is much more complex. It expects markup
- use snd_seq_ev_set_sysex() for a SysEx,
- use snd_seq_ev_set_noteoff() for NOTE_OFF,
- snd_seq_ev_set_noteon|keypress|controller|...
http://source.winehq.org/source/dlls/winealsa.drv/midi.c?v=wine-1.5.23#L844

Therefore, winealsa needs to scan the buffer and decompose it into
snippets, then call the matching snd_seq_ev_set_* function.

So winealsa must call snd_seq_ev_set_noteon on each 91 K1 V1 snippet.
In the case of your app it would call snd_seq_ev_set_sysex on the F0...F7 snippet,
then ... well I don't know what to call on the remaining three 00 00 00 bytes.
The "simply send bytes over the serial port" analogy would mean to not skip
those bytes rather than find some means to send them via ALSA.

Regards,
	Jörg Höhle


More information about the wine-devel mailing list