Rawmidi device naming

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux