Skip to contentSkip to conversation

More Midisport 2x2 troubles

DISCUSSION Ivica Bukvic 2 participants 5 messages Apr 3, 2003 – Apr 4, 2003

lore
Share & tools
lore
#0 lore raw

Guys, I am forwarding this to you as well from the alsa-user list since right now I am looking for example code how to access the 2nd set of I/O MIDI ports on my Midisport 2x2 (seems that having /dev/midi and /dev/midi1 does not work any more for some reason, even though it worked just fine in 0.9.1). Any help on this issue is greatly appreciated!

P.S. One thing I just realized is that there is something rather unclear to me in the explanation generously provided by Clemens:

Quoted 6 lines

/dev/midi0 -> card 0, device 0, subdevice 0
/dev/amidi0 -> card 0, device 1, subdevice 0
/dev/midi1 -> card 1, device 0, subdevice 0
/dev/amidi1 -> card 1, device 1, subdevice 0
/dev/midi2 -> card 2, device 0, subdevice 0
/dev/amidi2 -> card 2, device 1, subdevice 0

since none of the amidi devices does not work on my setup (see my last e-mail for more info) and it seems as if it should. Furthermore, what happens when the midi interface has more than 2 I/O ports?

Ico

-----Original Message-----
Thanks for your help!

However, I am a bit confused, since this feature with /dev/midi stuff worked like a charm just a couple weeks ago (ver. 0.9.1). So, did something change dramatically since?

Can you also point me in the right direction where I can see a simple ALSA code to accessing the both of the MIDI raw ports?

Thanks!

Ico

Quoted 1 line

For multiport USB MIDI interfaces, the ports are subdevices of one

midi

Quoted 1 line

device. This isn't a problem with programs using the ALSA API, but

when

Quoted 12 lines

you want to use the OSS-compatible /dev/midiX ports, you cannot access any subdevices other than the first directly.

The mapping of OSS MIDI devices to ALSA MIDI devices is as follows:
/dev/midi0 -> card 0, device 0, subdevice 0
/dev/amidi0 -> card 0, device 1, subdevice 0
/dev/midi1 -> card 1, device 0, subdevice 0
/dev/amidi1 -> card 1, device 1, subdevice 0
/dev/midi2 -> card 2, device 0, subdevice 0
/dev/amidi2 -> card 2, device 1, subdevice 0
...

Quoted 3 lines
Quoted 1 line

If this is the case, then how do I access the second port.

You can load the snd-virmidi driver to create a virtual soundcard

having

Quoted 1 line

its own MIDI device, and then connect this port to the 2x2's second

MIDI

Quoted 3 lines

port (with aconnect).

Quoted 1 line

In this situation the hdsp is not in use, so midisport assumes the

2nd

Quoted 5 lines
Quoted 3 lines

card position.
...
options snd-usb-audio vid=0x763 pid=0x1001 index=2

It shouldn't, because the above options line tells the driver to load

at

Quoted 7 lines

index 2. And if you'd use 0x1110 as product ID, it actually would. ;-) (0x1001 is the ID of the device without firmware.)

HTH
Clemens

-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/

#1 lore raw
Quoted 3 lines · Ivica Bukvic

However, I am a bit confused, since this feature with /dev/midi stuff worked like a charm just a couple weeks ago (ver. 0.9.1). So, did something change dramatically since?

No. The USB MIDI driver has behaved in this way since 0.9.0rc4.

Quoted 2 lines

Can you also point me in the right direction where I can see a simple ALSA code to accessing the both of the MIDI raw ports?

alsa-lib/test/rawmidi.c does some operations with both OSS and ALSA ports. When using two ports, you'd call snd_rawmidi_open() twice and then have two handles, similar to two file handles. alsa-lib/test/control.c enumerates rawmidi devices.

BTW: Are you soure you want to use rawmidi ports? Many software synthesizers create sequencer ports only.

Quoted 10 lines

P.S. One thing I just realized is that there is something rather unclear to me in the explanation generously provided by Clemens:

Quoted 6 lines

/dev/midi0 -> card 0, device 0, subdevice 0
/dev/amidi0 -> card 0, device 1, subdevice 0
/dev/midi1 -> card 1, device 0, subdevice 0
/dev/amidi1 -> card 1, device 1, subdevice 0
/dev/midi2 -> card 2, device 0, subdevice 0
/dev/amidi2 -> card 2, device 1, subdevice 0

Quoted 2 lines

since none of the amidi devices does not work on my setup (see my last e-mail for more info) and it seems as if it should.

Your two ports are subdevices 0 and 1 of card 1, device 0. /dev/amidi1 points to device 1 which doesn't exist.

Quoted 2 lines

Furthermore, what happens when the midi interface has more than 2 I/O ports?

If the ports are subdevices of one device, only the first can be accessed with the OSS /dev/midiX file.
If each port is a seperate device, the first two ports can be accessed with /dev/midiX and /dev/amidiX.

Drivers for multiport interfaces usually use the first alternative (one device with subdevices) because there is a limit of 8 rawmidi devices per card.

HTH
Clemens

-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/

#2 lore raw

Re: More Midisport 2x2 troubles (help from the Alsa developers is greatly appreciated!)

Hmm, I've tried running the alsa-lib/test/ramidi test and tried using it as:

rawmidi -i hw:2,0

This starts it up but I don't get any events in. Can anyone tell me why?

Any other setting (i.e. hw:2,1) reports an error that such a device was not found.

Interesting thing is that when I do ./rawmidi -o hw:2,0 I get the note-on/off signal on the midisport, which means that the send part of it works ok.

However, when I do -i nothing comes into the cpu.
Same is with the ./rawmidi -I /dev/midi2 (there are no errors, but no input either).

cat /dev/midi2 works just fine.

My /dev/snd/ only has 1 midi device (midiC2D0), so it does seem like it's a problem with Alsa.

Running latency in the same dir freezes the machine with a loud sound going on.

I am using MDK 9.1 on Inspiron 8200. Any help is greatly appreciated!

Any other suggestions?

Ico

Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:[email protected] halle.de] On Behalf Of Clemens Ladisch
Sent: Thursday, April 03, 2003 9:50 AM
To: Ivica Bukvic
Cc: [email protected]
Subject: Re: [Alsa-devel] Re: More Midisport 2x2 troubles

Quoted 1 line · Ivica Bukvic

However, I am a bit confused, since this feature with /dev/midi

stuff

Quoted 6 lines
Quoted 2 lines

worked like a charm just a couple weeks ago (ver. 0.9.1). So, did something change dramatically since?

No. The USB MIDI driver has behaved in this way since 0.9.0rc4.

Quoted 1 line

Can you also point me in the right direction where I can see a

simple

Quoted 3 lines
Quoted 1 line

ALSA code to accessing the both of the MIDI raw ports?

alsa-lib/test/rawmidi.c does some operations with both OSS and ALSA

ports.

Quoted 1 line

When using two ports, you'd call snd_rawmidi_open() twice and then

have

Quoted 7 lines

two handles, similar to two file handles. alsa-lib/test/control.c enumerates rawmidi devices.

BTW: Are you soure you want to use rawmidi ports? Many software synthesizers create sequencer ports only.

Quoted 1 line

P.S. One thing I just realized is that there is something rather

unclear

Quoted 10 lines
Quoted 10 lines

to me in the explanation generously provided by Clemens:

Quoted 6 lines

/dev/midi0 -> card 0, device 0, subdevice 0
/dev/amidi0 -> card 0, device 1, subdevice 0
/dev/midi1 -> card 1, device 0, subdevice 0
/dev/amidi1 -> card 1, device 1, subdevice 0
/dev/midi2 -> card 2, device 0, subdevice 0
/dev/amidi2 -> card 2, device 1, subdevice 0

since none of the amidi devices does not work on my setup (see my

last

Quoted 6 lines
Quoted 1 line

e-mail for more info) and it seems as if it should.

Your two ports are subdevices 0 and 1 of card 1, device 0. /dev/amidi1 points to device 1 which doesn't exist.

Quoted 1 line

Furthermore, what happens when the midi interface has more than 2

I/O

Quoted 3 lines
Quoted 1 line

ports?

If the ports are subdevices of one device, only the first can be

accessed

Quoted 5 lines

with the OSS /dev/midiX file.
If each port is a seperate device, the first two ports can be accessed with /dev/midiX and /dev/amidiX.

Drivers for multiport interfaces usually use the first alternative

(one

Quoted 1 line

device with subdevices) because there is a limit of 8 rawmidi devices

per

Quoted 6 lines

card.

HTH
Clemens

-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/

#3 lore raw

Re: More Midisport 2x2 troubles (help from the Alsa developers is greatly appreciated!)

Actually please disregard the part about not receiving input using rawmidi. Forgot to include -v option for verbose.

Yet, I still cannot get the second port of the Midisport 2x2 to become available no matter what. /proc/asound/cards lists only one midisport 2x2 device (which is ok, I guess, since even Fernando's webpage mentions that this is the case with the latest CVS stuff), but even in the /proc/asound/card2 (which is indexed as such) it only lists one midi port. Same is the case with the /dev/snd/midi* stuff.

I would at this point like to know if this is a bug (so that I can stop wasting time on it) and if so, will it be addressed any time soon, and furthermore what will be the future approach to this issue, will the notion of assigning one /dev/midi device for each port prevail, or will we have to access other ports on the same device through alsa's hw:0,<subdevice> kind of approach, or perhaps something completely different.

This is rather important to me since now I am in process of implementing multiple midi i/o port monitoring capability in my app and am currently stuck waiting for this issue to be resolved, so before I can proceed I would like to know what will be the best way of implementing that. This will ensure that I do not end up having to revise a large body of my code.

Apologies for the cross-posts, just trying to get to the bottom of this issue that seemed fixed as of the ver.0.9.1 and now is back with a vengeance. :-(

Again, any help on this matter is greatly appreciated! Sincerely,

Ico

Quoted 2 lines

-----Original Message-----
From: [email protected]

[mailto:linux-audio-user-

Quoted 5 lines

[email protected]] On Behalf Of Ivica Bukvic
Sent: Thursday, April 03, 2003 7:24 PM
To: 'Clemens Ladisch'; [email protected]
Cc: [email protected]; [email protected]
Subject: [linux-audio-user] Re: More Midisport 2x2 troubles (help from

the

Quoted 4 lines

Alsa developers is greatly appreciated!)

Hmm, I've tried running the alsa-lib/test/ramidi test and tried using

it

Quoted 5 lines

as:

rawmidi -i hw:2,0

This starts it up but I don't get any events in. Can anyone tell me

why?

Quoted 2 lines

Any other setting (i.e. hw:2,1) reports an error that such a device

was

Quoted 15 lines

not found.

Interesting thing is that when I do ./rawmidi -o hw:2,0 I get the note-on/off signal on the midisport, which means that the send part of it works ok.

However, when I do -i nothing comes into the cpu.
Same is with the ./rawmidi -I /dev/midi2 (there are no errors, but no input either).

cat /dev/midi2 works just fine.

My /dev/snd/ only has 1 midi device (midiC2D0), so it does seem like it's a problem with Alsa.

Quoted 9 lines

Running latency in the same dir freezes the machine with a loud sound going on.

I am using MDK 9.1 on Inspiron 8200. Any help is greatly appreciated!

Any other suggestions?

Ico

-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/

#4 lore raw

Re: [Alsa-user] [linux-audio-user] Re: More Midisport 2x2 troubles (help from the Alsa developers is greatly appreciated!)

Quoted 6 lines · Ivica Bukvic

Hmm, I've tried running the alsa-lib/test/ramidi test and tried using it as:
rawmidi -i hw:2,0
...
Any other setting (i.e. hw:2,1) reports an error that such a device was not found.

The first number is the card number, the second is the device number, and the third is the subdevice number. Your two ports are "hw:2,0,0" and "hw:2,0,1", respectively.

HTH
Clemens

-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/