Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Clemens Ladisch <clemens@ladisch.de>, 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: Mon, 08 Dec 2014 09:50:10 +0900	[thread overview]
Message-ID: <5484F5C2.9080801@sakamocchi.jp> (raw)
In-Reply-To: <5484CA3D.5070004@ladisch.de>

On Dec 8 2014 06:44, Clemens Ladisch wrote:
> 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)
>> +{
>> ...
>> +}
>> +
>> +static int playback_open(struct snd_rawmidi_substream *substream)
>> +{
>> ...
>> +}
> 
> These two functions are identical.
> 
>> +static int capture_close(struct snd_rawmidi_substream *substream)
>> +{
>> ...
>> +}
>> +
>> +static int playback_close(struct snd_rawmidi_substream *substream)
>> +{
>> ...
>> +}
> 
> These two too.

Indeed. We can use the same functions for each of MIDI open/close callback.

>> +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.

Fireworks/BeBoB/Dice/OXFW drivers have the same codes to name MIDI
ports. So I want to change them in the same time, later.

This below code is for your idea.

static void set_midi_substream_names(const char *shortname,
                                     struct snd_rawmidi_str *str)
{
    struct snd_rawmidi_substream *subs;

    list_for_each_entry(subs, &str->substreams, list) {
        if (str->substream_count == 1) {
                snprintf(subs->name, sizeof(subs->name),
                     "%s MIDI", shortname);
                break;
        }

        snprintf(subs->name, sizeof(subs->name),
                     "%s MIDI %d", shortname, subs->number + 1);
    }
}

Hmm. I can see the 'shortname' again...

If I apply "vendor model" template for the shortname, the length of MIDI
ports are too long for MIDI port name. For example,

$ cat /proc/asound/card0/midi0
Echo Digital Audio AudioFire4 MIDI
...

$ amidi -lDir Device    Name
IO  hw:0,0,0  Echo Digital Audio AudioFire4 M(trimmed)

Currently I apply "vendor model" template for OXFW driver only, but I
should reconsider about this...


Regards

Takashi Sakamoto
o-takashi@sakamocchi.jp

  reply	other threads:[~2014-12-08  0:50 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
2014-12-08  0:50     ` Takashi Sakamoto [this message]
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=5484F5C2.9080801@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=ffado-devel@lists.sourceforge.net \
    --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