All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: David Henningsson <coding@diwic.se>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH v2 1/2] Add rawmidi framing API
Date: Tue, 17 Aug 2021 15:46:51 +0200	[thread overview]
Message-ID: <s5hfsv8dvzo.wl-tiwai@suse.de> (raw)
In-Reply-To: <20210817125132.5737-2-coding@diwic.se>

On Tue, 17 Aug 2021 14:51:31 +0200,
David Henningsson wrote:
> 
> --- a/include/rawmidi.h
> +++ b/include/rawmidi.h
> @@ -79,6 +79,27 @@ typedef enum _snd_rawmidi_type {
>  	SND_RAWMIDI_TYPE_VIRTUAL
>  } snd_rawmidi_type_t;
>  
> +#define SND_RAWMIDI_CLOCK_NONE		(0<<3)
> +#define SND_RAWMIDI_CLOCK_REALTIME	(1<<3)
> +#define SND_RAWMIDI_CLOCK_MONOTONIC	(2<<3)
> +#define SND_RAWMIDI_CLOCK_MONOTONIC_RAW	(3<<3)

IMO, better to be like below:

enum {
	SND_RAWMIDI_CLOCK_NONE = 0,
	SND_RAWMIDI_CLOCK_REALTIME = 1,
	SND_RAWMIDI_CLOCK_MONOTONIC = 2,
	SND_RAWMIDI_CLOCK_MONOTONIC_RAW = 3,
};

The shift should be done in the function.
The enum above can be also typedef'ed for the later reference.

> +typedef struct _snd_rawmidi_framing_tstamp {
> +	/**
> +	 * For now, frame_type is always 0. Midi 2.0 is expected to add new
> +	 * types here. Applications are expected to skip unknown frame types.
> +	 */
> +	__u8 frame_type;

The 0 frame type should be also defined explicitly, such as
SNDRV_RAWMIDI_FRAME_TYPE_XXX.

> +int snd_rawmidi_params_set_framing_type(const snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, unsigned int val);

You can define the enum type to be more specific, too.

> +int snd_rawmidi_params_set_clock_type(const snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, unsigned int val);

Ditto.


thanks,

Takashi

  reply	other threads:[~2021-08-17 13:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 12:51 [PATCH v2 0/2] alsa-lib patches for rawmidi tstamp framing David Henningsson
2021-08-17 12:51 ` [PATCH v2 1/2] Add rawmidi framing API David Henningsson
2021-08-17 13:46   ` Takashi Iwai [this message]
2021-08-17 12:51 ` [PATCH v2 2/2] Add test for " David Henningsson

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=s5hfsv8dvzo.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=coding@diwic.se \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.