All of lore.kernel.org
 help / color / mirror / Atom feed
* Rawmidi device naming
@ 2006-09-22 17:38 Lee Revell
  2006-09-22 18:04 ` Clemens Ladisch
  0 siblings, 1 reply; 8+ messages in thread
From: Lee Revell @ 2006-09-22 17:38 UTC (permalink / raw)
  To: alsa-devel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rawmidi device naming
  2006-09-22 17:38 Rawmidi device naming Lee Revell
@ 2006-09-22 18:04 ` Clemens Ladisch
  2006-09-22 18:13   ` Lee Revell
  2006-11-09 20:36   ` Lee Revell
  0 siblings, 2 replies; 8+ messages in thread
From: Clemens Ladisch @ 2006-09-22 18:04 UTC (permalink / raw)
  To: Lee Revell, alsa-devel

Lee Revell wrote:
>  # 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 2
> 
> Why 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rawmidi device naming
  2006-09-22 18:04 ` Clemens Ladisch
@ 2006-09-22 18:13   ` Lee Revell
  2006-11-09 20:36   ` Lee Revell
  1 sibling, 0 replies; 8+ messages in thread
From: Lee Revell @ 2006-09-22 18:13 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Fri, 2006-09-22 at 20:04 +0200, Clemens Ladisch wrote:
> Lee Revell wrote:
> >  # 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 2
> > 
> > Why 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rawmidi device naming
  2006-09-22 18:04 ` Clemens Ladisch
  2006-09-22 18:13   ` Lee Revell
@ 2006-11-09 20:36   ` Lee Revell
  2006-11-09 20:39     ` Lee Revell
  2006-11-10  8:25     ` Clemens Ladisch
  1 sibling, 2 replies; 8+ messages in thread
From: Lee Revell @ 2006-11-09 20:36 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Fri, 2006-09-22 at 20:04 +0200, Clemens Ladisch wrote:
> Lee Revell wrote:
> >  # 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 2
> > 
> > Why 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rawmidi device naming
  2006-11-09 20:36   ` Lee Revell
@ 2006-11-09 20:39     ` Lee Revell
  2006-11-10  8:25     ` Clemens Ladisch
  1 sibling, 0 replies; 8+ messages in thread
From: Lee Revell @ 2006-11-09 20:39 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Thu, 2006-11-09 at 15:36 -0500, Lee Revell wrote:
> 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 
> 

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rawmidi device naming
  2006-11-09 20:36   ` Lee Revell
  2006-11-09 20:39     ` Lee Revell
@ 2006-11-10  8:25     ` Clemens Ladisch
  2006-11-10 17:54       ` Lee Revell
  1 sibling, 1 reply; 8+ messages in thread
From: Clemens Ladisch @ 2006-11-10  8:25 UTC (permalink / raw)
  To: Lee Revell; +Cc: alsa-devel

Lee Revell wrote:
> On Fri, 2006-09-22 at 20:04 +0200, Clemens Ladisch wrote:
> > 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rawmidi device naming
  2006-11-10  8:25     ` Clemens Ladisch
@ 2006-11-10 17:54       ` Lee Revell
  2006-11-10 19:08         ` Clemens Ladisch
  0 siblings, 1 reply; 8+ messages in thread
From: Lee Revell @ 2006-11-10 17:54 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Fri, 2006-11-10 at 09:25 +0100, Clemens Ladisch wrote:
> Lee Revell wrote:
> > On Fri, 2006-09-22 at 20:04 +0200, Clemens Ladisch wrote:
> > > 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rawmidi device naming
  2006-11-10 17:54       ` Lee Revell
@ 2006-11-10 19:08         ` Clemens Ladisch
  0 siblings, 0 replies; 8+ messages in thread
From: Clemens Ladisch @ 2006-11-10 19:08 UTC (permalink / raw)
  To: Lee Revell; +Cc: alsa-devel

Lee Revell wrote:
> On Fri, 2006-11-10 at 09:25 +0100, Clemens Ladisch wrote:
> > 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-11-10 19:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-22 17:38 Rawmidi device naming Lee Revell
2006-09-22 18:04 ` Clemens Ladisch
2006-09-22 18:13   ` Lee Revell
2006-11-09 20:36   ` Lee Revell
2006-11-09 20:39     ` Lee Revell
2006-11-10  8:25     ` Clemens Ladisch
2006-11-10 17:54       ` Lee Revell
2006-11-10 19:08         ` Clemens Ladisch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.