* [PATCH] rawmidi.c Set a name for a newly allocated rawmidi substream
@ 2014-05-07 17:24 Ralf Beck
2014-05-07 17:39 ` Clemens Ladisch
0 siblings, 1 reply; 4+ messages in thread
From: Ralf Beck @ 2014-05-07 17:24 UTC (permalink / raw)
To: alsa-devel
Rationale: Bitwig Studio (and possibly other rawmidi clients) enumerate
the Midi I/Os by
substream names. With the current rawmidi implementation, the name is an
empty string
and only the USB mididriver changes it to a meaningful value after
allocation.
This patch sets a default substream name of the form "somename x-y-z"
--- linux-source-3.13.0/sound/core/rawmidi.c.orig 2014-05-06
20:25:33.683081389 +0200
+++ linux-source-3.13.0/sound/core/rawmidi.c 2014-05-06
17:42:35.058097185 +0200
@@ -34,6 +34,7 @@
#include <sound/control.h>
#include <sound/minors.h>
#include <sound/initval.h>
+#include <linux/string.h>
MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
MODULE_DESCRIPTION("Midlevel RawMidi code for ALSA.");
@@ -1420,6 +1421,8 @@ static int snd_rawmidi_alloc_substreams(
substream->number = idx;
substream->rmidi = rmidi;
substream->pstr = stream;
+ snprintf(substream->name, sizeof(substream->name),
+ "%s %d-%d-%d", rmidi->id, rmidi->card->number,
rmidi->device, idx);
list_add_tail(&substream->list, &stream->substreams);
stream->substream_count++;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rawmidi.c Set a name for a newly allocated rawmidi substream
2014-05-07 17:24 [PATCH] rawmidi.c Set a name for a newly allocated rawmidi substream Ralf Beck
@ 2014-05-07 17:39 ` Clemens Ladisch
2014-05-08 6:07 ` Ralf Beck
0 siblings, 1 reply; 4+ messages in thread
From: Clemens Ladisch @ 2014-05-07 17:39 UTC (permalink / raw)
To: ralfbeck1, alsa-devel
Ralf Beck wrote:
> Rationale: Bitwig Studio (and possibly other rawmidi clients) enumerate the Midi I/Os by
> substream names. With the current rawmidi implementation, the name is an empty string
> and only the USB mididriver changes it to a meaningful value after allocation.
Many RawMIDI devices have only one substream, or multiple substreams that are
merged into one port. For these, separate substream names do not make sense.
> This patch sets a default substream name of the form "somename x-y-z"
The ID string is not meant to be a name.
Also see Documentation/SubmittingPatches.
> @@ -1420,6 +1421,8 @@ static int snd_rawmidi_alloc_substreams(
> substream->number = idx;
> substream->rmidi = rmidi;
> substream->pstr = stream;
> + snprintf(substream->name, sizeof(substream->name),
Your mailer broke whitespaces.
Regards,
Clemens
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rawmidi.c Set a name for a newly allocated rawmidi substream
2014-05-07 17:39 ` Clemens Ladisch
@ 2014-05-08 6:07 ` Ralf Beck
2014-05-08 20:08 ` Clemens Ladisch
0 siblings, 1 reply; 4+ messages in thread
From: Ralf Beck @ 2014-05-08 6:07 UTC (permalink / raw)
To: alsa-devel
Am 07.05.2014 19:39, schrieb Clemens Ladisch:
> Ralf Beck wrote:
>> Rationale: Bitwig Studio (and possibly other rawmidi clients)
>> enumerate the Midi I/Os by substream names. With the current rawmidi
>> implementation, the name is an empty string and only the USB
>> mididriver changes it to a meaningful value after allocation.
> Many RawMIDI devices have only one substream, or multiple substreams
> that are merged into one port. For these, separate substream names do
> not make sense.
Any having no substream name at all makes more sense?
>> This patch sets a default substream name of the form "somename x-y-z"
> The ID string is not meant to be a name.
Would it be acceptable, if i remove the ID string and only return x-y-z ?
Other than the alsa developers i would call creating rawmidi substreams,
but not
assigning a name to them a bug.
Best regards,
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rawmidi.c Set a name for a newly allocated rawmidi substream
2014-05-08 6:07 ` Ralf Beck
@ 2014-05-08 20:08 ` Clemens Ladisch
0 siblings, 0 replies; 4+ messages in thread
From: Clemens Ladisch @ 2014-05-08 20:08 UTC (permalink / raw)
To: ralfbeck1; +Cc: alsa-devel
Ralf Beck wrote:
> Am 07.05.2014 19:39, schrieb Clemens Ladisch:
>> Ralf Beck wrote:
>>> Rationale: Bitwig Studio (and possibly other rawmidi clients) enumerate the Midi I/Os by substream names. With the current rawmidi implementation, the name is an empty string and only the USB mididriver changes it to a meaningful value after allocation.
>>
>> Many RawMIDI devices have only one substream, or multiple substreams that are merged into one port. For these, separate substream names do not make sense.
>
> Any having no substream name at all makes more sense?
The device itself already has a name.
Apparently, Bitwig has not been tested with any driver except snd-usb-audio.
>>> This patch sets a default substream name of the form "somename x-y-z"
>>
>> The ID string is not meant to be a name.
>
> Would it be acceptable, if i remove the ID string and only return x-y-z ?
No; you should use the device name or something like that.
But the substream name buffer is rather short; a better idea would be to
fix all rawmidi drivers to set the substream name(s) to the appropriate
value.
> Other than the alsa developers i would call creating rawmidi substreams, but not
> assigning a name to them a bug.
For most drivers, substreams do not have a logical identity separate
from the device.
Regards,
Clemens
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-08 20:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-07 17:24 [PATCH] rawmidi.c Set a name for a newly allocated rawmidi substream Ralf Beck
2014-05-07 17:39 ` Clemens Ladisch
2014-05-08 6:07 ` Ralf Beck
2014-05-08 20:08 ` Clemens Ladisch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox