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