[PATCH 1/1] sound: rawmidi: Add framing mode
Jaroslav Kysela
perex at perex.cz
Wed Mar 24 17:06:17 CET 2021
Dne 24. 03. 21 v 6:31 David Henningsson napsal(a):
> This commit adds a new framing mode that frames all MIDI data into
> 16-byte frames with a timestamp from the monotonic_raw clock.
I would add support for monotonic timestamps, too. The NTP drifts are usually
small, so it may make sense to support those timestamps, too. It may be handy
for the synchronization among multiple machines (timing sources).
The timestamp mode should be selected separately than the framing mode.
> +#define SND_RAWMIDI_FRAMING_DATA_LENGTH 7
> +
> +struct snd_rawmidi_framing_tstamp {
> + unsigned int tv_sec; /* seconds */
> + unsigned int tv_nsec; /* nanoseconds */
> + unsigned char length;
> + unsigned char data[SND_RAWMIDI_FRAMING_DATA_LENGTH];
> +};
Perhaps, we should consider to have a fixed header and variable data length
here. For MIDI, the standard messages have only few bytes usually. It would be
better to use this space for the seconds field:
header {
unsigned long long tv_sec;
unsigned int tv_nsec;
unsigned int len;
unsigned char data[0];
};
Jaroslav
--
Jaroslav Kysela <perex at perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
More information about the Alsa-devel
mailing list