Re: [PATCH] ALSA: seq: Add tempo base unit for MIDI2 Set Tempo messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, 05 Jul 2024 09:37:15 +0200,
Jaroslav Kysela wrote:
> 
> On 04. 07. 24 14:35, Takashi Iwai wrote:
> > MIDI2 Set Tempo message defines the tempo in 10ns unit for finer
> > accuracy, while MIDI1 was defined in 1us unit.  For adapting this
> > different unit, introduce "tempo_base" field to snd_seq_queue_tempo
> > struct so that user-space can pass the proper tempo base unit.
> > 
> > The accepted value is limited, it must be either 0, 10 or 1000.
> > 
> > The protocol version is bumped to 1.0.4 along with this.
> > 
> > The access with the older protocol version ignores the tempo-base
> > value in ioctls and always treats as 1000.
> > 
> > Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
> > ---
> >   include/uapi/sound/asequencer.h |  7 ++++---
> >   sound/core/seq/seq_clientmgr.c  |  4 ++++
> >   sound/core/seq/seq_queue.c      |  6 ++++--
> >   sound/core/seq/seq_timer.c      | 21 +++++++++++++++------
> >   sound/core/seq/seq_timer.h      |  4 +++-
> >   5 files changed, 30 insertions(+), 12 deletions(-)
> > 
> > diff --git a/include/uapi/sound/asequencer.h b/include/uapi/sound/asequencer.h
> > index c85fdd8895d8..c7acfeb514a3 100644
> > --- a/include/uapi/sound/asequencer.h
> > +++ b/include/uapi/sound/asequencer.h
> > @@ -10,7 +10,7 @@
> >   #include <sound/asound.h>
> >     /** version of the sequencer */
> > -#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 3)
> > +#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 4)
> >     /**
> >    * definition of sequencer event types
> > @@ -523,11 +523,12 @@ struct snd_seq_queue_status {
> >   /* queue tempo */
> >   struct snd_seq_queue_tempo {
> >   	int queue;			/* sequencer queue */
> > -	unsigned int tempo;		/* current tempo, us/tick */
> > +	unsigned int tempo;		/* current tempo, us/tick (or different time-base below) */
> >   	int ppq;			/* time resolution, ticks/quarter */
> >   	unsigned int skew_value;	/* queue skew */
> >   	unsigned int skew_base;		/* queue skew base */
> > -	char reserved[24];		/* for the future */
> > +	unsigned int tempo_base;	/* tempo base in nsec unit; either 10 or 1000 */
> 
> Perhaps unsigned short value may be enough to carry this settings? The
> two bytes will be always zero for unsigned int.

True, it's unlikely that the value will be more than 1000.


Takashi




[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux