Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>, tiwai@suse.de
Cc: alsa-devel@alsa-project.org, ffado-devel@lists.sourceforge.net
Subject: Re: [PATCH 05/15] ALSA: dice: Add support for MIDI	capture/playback
Date: Sun, 07 Dec 2014 22:44:29 +0100	[thread overview]
Message-ID: <5484CA3D.5070004@ladisch.de> (raw)
In-Reply-To: <1417958348-30333-6-git-send-email-o-takashi@sakamocchi.jp>

Takashi Sakamoto wrote:
> This commit adds a support for MIDI capture/playback
>
> +++ b/sound/firewire/dice/dice-midi.c
> +static int capture_open(struct snd_rawmidi_substream *substream)
> +{
> +	struct snd_dice *dice = substream->rmidi->private_data;
> +	int err;
> +
> +	err = snd_dice_stream_lock_try(dice);
> +	if (err < 0)
> +		return err;
> +
> +	mutex_lock(&dice->mutex);
> +
> +	dice->substreams_counter++;
> +	err = snd_dice_stream_start_duplex(dice, 0);
> +
> +	mutex_unlock(&dice->mutex);
> +
> +	if (err < 0)
> +		snd_dice_stream_lock_release(dice);
> +
> +	return err;
> +}
> +
> +static int playback_open(struct snd_rawmidi_substream *substream)
> +{
> +	struct snd_dice *dice = substream->rmidi->private_data;
> +	int err;
> +
> +	err = snd_dice_stream_lock_try(dice);
> +	if (err < 0)
> +		return err;
> +
> +	mutex_lock(&dice->mutex);
> +
> +	dice->substreams_counter++;
> +	err = snd_dice_stream_start_duplex(dice, 0);
> +
> +	mutex_unlock(&dice->mutex);
> +
> +	if (err < 0)
> +		snd_dice_stream_lock_release(dice);
> +
> +	return err;
> +}

These two functions are identical.

> +static int capture_close(struct snd_rawmidi_substream *substream)
> +{
> +	struct snd_dice *dice = substream->rmidi->private_data;
> +
> +	mutex_lock(&dice->mutex);
> +
> +	dice->substreams_counter--;
> +	snd_dice_stream_stop_duplex(dice);
> +
> +	mutex_unlock(&dice->mutex);
> +
> +	snd_dice_stream_lock_release(dice);
> +	return 0;
> +}
> +
> +static int playback_close(struct snd_rawmidi_substream *substream)
> +{
> +	struct snd_dice *dice = substream->rmidi->private_data;
> +
> +	mutex_lock(&dice->mutex);
> +
> +	dice->substreams_counter--;
> +	snd_dice_stream_stop_duplex(dice);
> +
> +	mutex_unlock(&dice->mutex);
> +
> +	snd_dice_stream_lock_release(dice);
> +	return 0;
> +}

These two too.

> +static void set_midi_substream_names(struct snd_dice *dice,
> +				     struct snd_rawmidi_str *str)
> +{
> +	list_for_each_entry(subs, &str->substreams, list) {
> +		snprintf(subs->name, sizeof(subs->name),
> +			 "%s MIDI %d", dice->card->shortname, subs->number + 1);

This is not really important, but the number is useless when the
device has only one MIDI port.


Regards,
Clemens

  reply	other threads:[~2014-12-07 21:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-07 13:18 [PATCH 00/15 v4] ALSA: Enhancement for existed FireWire drivers Takashi Sakamoto
2014-12-07 13:18 ` [PATCH 01/15] ALSA: dice: Change the way to start stream Takashi Sakamoto
2014-12-07 13:18 ` [PATCH 02/15] ALSA: dice: Add support for duplex streams with synchronization Takashi Sakamoto
2014-12-07 13:18 ` [PATCH 03/15] ALSA: dice: Support for non SYT-Match sampling clock source mode Takashi Sakamoto
2014-12-07 13:18 ` [PATCH 04/15] ALSA: dice: Add support for capturing PCM samples Takashi Sakamoto
2014-12-07 13:18 ` [PATCH 05/15] ALSA: dice: Add support for MIDI capture/playback Takashi Sakamoto
2014-12-07 21:44   ` Clemens Ladisch [this message]
2014-12-08  0:50     ` Takashi Sakamoto
2014-12-07 13:18 ` [PATCH 06/15] ALSA: oxfw: Change the way to name card Takashi Sakamoto
2014-12-07 13:19 ` [PATCH 07/15] ALSA: oxfw: Add support for AV/C stream format command to get/set supported stream formation Takashi Sakamoto
2014-12-07 22:01   ` Clemens Ladisch
2014-12-08  0:51     ` Takashi Sakamoto
2014-12-07 13:19 ` [PATCH 08/15] ALSA: oxfw: Change the way to make PCM rules/constraints Takashi Sakamoto
2014-12-07 13:19 ` [PATCH 09/15] ALSA: oxfw: Add proc interface for debugging purpose Takashi Sakamoto
2014-12-07 13:19 ` [PATCH 10/15] ALSA: oxfw: Change the way to start stream Takashi Sakamoto
2014-12-07 13:19 ` [PATCH 11/15] ALSA: oxfw: Add support for Behringer/Mackie devices Takashi Sakamoto
2014-12-07 13:19 ` [PATCH 12/15] ALSA: oxfw: Add support AMDTP in-stream Takashi Sakamoto
2014-12-07 13:19 ` [PATCH 13/15] ALSA: oxfw: add support for capturing PCM samples Takashi Sakamoto
2014-12-07 13:19 ` [PATCH 14/15] ALSA: oxfw: Add support for capture/playback MIDI messages Takashi Sakamoto
2014-12-07 13:19 ` [PATCH 15/15] ALSA: oxfw: Add hwdep interface Takashi Sakamoto
  -- strict thread matches above, loose matches on Subject: below --
2014-12-08 15:10 [PATCH 00/15 v5] ALSA: Enhancement for existed FireWire drivers Takashi Sakamoto
2014-12-08 15:10 ` [PATCH 05/15] ALSA: dice: Add support for MIDI capture/playback Takashi Sakamoto

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=5484CA3D.5070004@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=ffado-devel@lists.sourceforge.net \
    --cc=o-takashi@sakamocchi.jp \
    --cc=tiwai@suse.de \
    /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