Rawmidi device naming
I use the following code in my driver to initialize 2 MPU-like ports:
/* Dreamchip MIDI initializer */
static int __devinit snd_dream_midi_init(struct snd_card_dream *dream, struct snd_card_dream_midi *midi, int device, char *name)
{
snd_rawmidi_t *rmidi;
int err;
if ((err = snd_rawmidi_new(dream->card, name, device, 1, 1, &rmidi)) < 0)
return err;
midi->dream = dream;
strcpy(rmidi->name, name);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_dream_midi_output);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_dream_midi_input);
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT |
SNDRV_RAWMIDI_INFO_INPUT |
SNDRV_RAWMIDI_INFO_DUPLEX;
rmidi->private_data = midi;
midi->rmidi = rmidi;
return 0;
}/* Dreamchip MIDI constructor */
int __devinit snd_dream_midi(struct snd_card_dream *dream)
{
struct snd_card_dream_midi *midi1 = &dream->midi1;
struct snd_card_dream_midi *midi2 = &dream->midi2;
int err;
if ((err = snd_dream_midi_init(dream, midi1, 0, "Dreamchip MPU interface 1")) < 0)
return err;
midi1->port = MPU1_DATA;
if ((err = snd_dream_midi_init(dream, midi2, 1, "Dreamchip MPU interface 2")) < 0)
return err;
midi2->port = MPU2_DATA;
return 0;
}But the client names are wrong!
~ # aplaymidi -l
Port Client name Port name 62:0 Midi Through Midi Through Port-0 64:0 Dreamchip MPU interface 1 Dreamchip MPU interface 1 64:32 Dreamchip MPU interface 1 Dreamchip MPU interface 2 88:0 Virtual Raw MIDI 3-0 VirMIDI 3-0 89:0 Virtual Raw MIDI 3-1 VirMIDI 3-1 90:0 Virtual Raw MIDI 3-2 VirMIDI 3-2 91:0 Virtual Raw MIDI 3-3 VirMIDI 3-3
Why do both ports get "Dreamchip MPU interface 1" for the client name?
Lee
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 6 lines · Lee Revell
# aplaymidi -l Port Client name Port name 64:0 Dreamchip MPU interface 1 Dreamchip MPU interface 1 64:32 Dreamchip MPU interface 1 Dreamchip MPU interface 2Why do both ports get "Dreamchip MPU interface 1" for the client name?
Because there is only one client.
The client name comes from the card's shortname.
HTH
Clemens
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 11 lines · Clemens Ladisch
Quoted 6 lines · Lee Revell
# aplaymidi -l Port Client name Port name 64:0 Dreamchip MPU interface 1 Dreamchip MPU interface 1 64:32 Dreamchip MPU interface 1 Dreamchip MPU interface 2Why do both ports get "Dreamchip MPU interface 1" for the client name?
Because there is only one client.
The client name comes from the card's shortname.
I don't think so. The card's shortname is just "Dream". The only place I use "Dreamchip MPU interface %i" is in the code I posted.
Lee
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 11 lines · Clemens Ladisch
Quoted 6 lines · Lee Revell
# aplaymidi -l Port Client name Port name 64:0 Dreamchip MPU interface 1 Dreamchip MPU interface 1 64:32 Dreamchip MPU interface 1 Dreamchip MPU interface 2Why do both ports get "Dreamchip MPU interface 1" for the client name?
Because there is only one client.
The client name comes from the card's shortname.
Sorry, but you are wrong - the client name does not come from the card's shortname. The client gets the name of the first port registered.
I changed my code to:
212
213 if ((err = snd_dream_midi_init(dream, midi2, 1, "MIDI Out")) < 0)
214 return err;
215 midi2->port = MPU1_DATA;
216
217 if ((err = snd_dream_midi_init(dream, midi1, 0, "GM Synth")) < 0)
218 return err;
219 midi1->port = MPU1_DATA;
220
And now I get:
Port Client name Port name 64:0 GM Synth GM Synth 64:32 GM Synth MIDI Out
How can I name the client independently from the ports?
Lee
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Quoted 10 lines · Lee Revell
212
213 if ((err =snd_dream_midi_init(dream, midi2, 1, "MIDI Out")) < 0)
214 return err;
215midi2->port=MPU1_DATA;
216
217 if ((err =snd_dream_midi_init(dream, midi1, 0, "GM Synth")) < 0)
218 return err;
219midi1->port=MPU1_DATA;
220
Here is snd_dream_midi_init:
static int __devinit snd_dream_midi_init(struct snd_card_dream *dream, struct snd_card_dream_midi *midi, int device, char *name)
{
snd_rawmidi_t *rmidi;
int err;
if ((err = snd_rawmidi_new(dream->card, name, device, 1, 1, &rmidi)) < 0)
return err;
midi->dream = dream;
strcpy(rmidi->name, name);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_dream_midi_output);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_dream_midi_input);
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT |
SNDRV_RAWMIDI_INFO_INPUT |
SNDRV_RAWMIDI_INFO_DUPLEX;
rmidi->private_data = midi;
// rmidi->private_free = snd_dream_midi_free;
midi->rmidi = rmidi;
return 0;
}Why does the client get the port name ?!?!?!?!?
Lee
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Quoted 5 lines · Lee Revell
Quoted 1 line · Clemens Ladisch
The client name comes from the card's shortname.
Sorry, but you are wrong - the client name does not come from the card's shortname. The client gets the name of the first port registered.
Then I guess your kernel does not yet contain this changeset
<http://hg.alsa-project.org/alsa-kernel?cs=54aa2cdfe8d7> from ALSA 1.0.12.
HTH
Clemens
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Quoted 9 lines · Clemens Ladisch
Quoted 5 lines · Lee Revell
Quoted 1 line · Clemens Ladisch
The client name comes from the card's shortname.
Sorry, but you are wrong - the client name does not come from the card's shortname. The client gets the name of the first port registered.
Then I guess your kernel does not yet contain this changeset
<http://hg.alsa-project.org/alsa-kernel?cs=54aa2cdfe8d7> from ALSA 1.0.12.
I'm working with ALSA 1.0.9b. The code seems to have completely changed. Can you suggest how I might fix this in my ALSA version?
Lee
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Quoted 6 lines · Lee Revell
Quoted 2 lines · Clemens Ladisch
Then I guess your kernel does not yet contain this changeset
<http://hg.alsa-project.org/alsa-kernel?cs=54aa2cdfe8d7> from ALSA 1.0.12.I'm working with ALSA 1.0.9b. The code seems to have completely changed. Can you suggest how I might fix this in my ALSA version?
In theory, you should be able to use rmidi->card->shortname instead of rmidi->name in the set_client_name function.
HTH
Clemens
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642