Portmidi does not lock anything, but it does call the underlying system API to open the device. I just ran a quick test on OS X and Vista, and both allowed me to open the same output device from two applications. OS X allows multiple applications to open the same input device, and copies of the input go to each application. I didn't have input conveniently set up on Vista, and I'm not sure what ALSA does. I think WinXP did not allow midi output devices to be opened multiple times.

-Roger

On 2/16/11 10:03 AM, Tim Burgess wrote:

Hi,

Thanks for the clarification. Does that lock apply, even with multi-client hardware drivers?

Best wishes.

Tim Burgess

Raised Bar Ltd

Phone:  +44 (0)1827 719822

Don't forget to vote for improved access to music and music technology at

http://www.raisedbar.net/petition.htm

*From:*Roger Dannenberg [mailto:[email protected]]
*Sent:* 16 February 2011 14:15
*To:* [email protected]
*Cc:* [email protected]
*Subject:* Re: [Media_api] PortMIDI Device enumeration

Yes, device ID values are 0-based. You should not assume any particular ordering, so if you want to separate the input and output devices, you should test each device for input or output and add it to the appropriate list.

The PmDefaults program does this. It is written in Java, but the code that populates the drop-down boxes should be easy to follow, and you might be interested to see the "test" button it provides where the user can verify correct output device selection, and a "test" light to show when input arrives on the selected input device.

I'll also mention that if you open devices for testing or anything else, you may end up with an exclusive lock on the device that prevents other applications from opening the device until the original program closes the device.

-Roger

On 2/16/11 7:40 AM, Tim Burgess wrote:

Hi,

I'm just checking my understanding of how PortMIDI enumerates the available I/O ports. I understand that device ID values are 0-based and that I can check whether a given port is an input or output device, but can I always assume that input ports are listed first, followed by output ports? I'm populating a couple of list boxes in a Windows application so that the user can choose which ports they want to use, so I need to convert the relevant list box index into a valid device ID to bind to a PmStream.

Best wishes.

Tim Burgess

Raised Bar Ltd

Phone:  +44 (0)1827 719822

Don't forget to vote for improved access to music and music technology at

http://www.raisedbar.net/petition.htm

_______________________________________________
media_api mailing list
[email protected]  <mailto:[email protected]>
http://lists.create.ucsb.edu/mailman/listinfo/media_api
_______________________________________________
media_api mailing list
[email protected]
http://lists.create.ucsb.edu/mailman/listinfo/media_api

Reply via email to