[jmsl] JavaSound To Use System Default Midi Device
jmsl at music.columbia.edu
jmsl at music.columbia.edu
Wed May 13 09:09:23 EDT 2009
Yes I tried that, equals() does not work for this...
Nick
jmsl at music.columbia.edu wrote:
> What about comparing MidiSystem.getReceiver() with
> midiDevice.getReceiver()?
>
> Chi
> ----- Original Message ----- From: <jmsl at music.columbia.edu>
> To: <jmsl at music.columbia.edu>
> Sent: Wednesday, May 13, 2009 6:43 AM
> Subject: Re: [jmsl] JavaSound To Use System Default Midi Device
>
>
>> Hi Chi
>>
>> Thanks for the example code, which shows how to find the default
>> Receiver.
>> How to retrieve the default MidiDevice ?
>>
>> 1) Either get the device directly , like:
>> MidiDevice defaultMidiDevice = MidiSystem.getDefaultMidiDevice(); //
>> non-existent method
>>
>> or iterate and test:
>> 2) MidiDevice.Info[] minfo = MidiSystem.getMidiDeviceInfo();
>> for (int i = 0; i < minfo.length; i++) {
>> Info midiInfo = minfo[i]; System.out.println("Device
>> " + i + " = " + midiInfo);
>> MidiDevice midiDevice = MidiSystem.getMidiDevice(midiInfo); // DO
>> SOME TEST ON midiDevice HERE TO CHECK IF IT IS THE DEFAULT SYSTEM DEVICE
>> // perhaps check if the device's receiver equals the default
>> MidiSystem.getReceiver()
>> }
>> If all we can get is the default receiver then I'd have to do a
>> bigger rewrite of MidiIO_JavaSound which is currently based on the
>> MidiDevice .
>>
>> Thanks
>> Nick Didkovsky
>>
>> jmsl at music.columbia.edu wrote:
>>> Hi,
>>>
>>> When JavaSound is chosen as the JMSL output, it seems to use the
>>> first device on the list, not the default Midi device set by OS.
>>> If you use
>>> MidiSystem.getReceiver()';
>>> instead of using
>>> MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo();
>>> device = MidiSystem.getMidiDevice(infos[index]);
>>> rcvr = device.getReceiver();
>>> it will return the default device set by OS.
>>>
>>>
>>> static Sequencer getSequencer()
>>> static Synthesizer getSynthesizer()
>>> static Receiver getReceiver()
>>> static Transmitter getTransmitter()
>>> The first two of these methods obtain the system's default
>>> sequencing and synthesis resources, which either represent physical
>>> devices or are implemented wholly in software. The getReceiver
>>> method obtains a Receiver object that takes MIDI messages sent to it
>>> and relays them to the default receiving device. Similarly, the
>>> getTransmitter method obtains a Transmitter object that can send
>>> MIDI messages to some receiver on behalf of the default transmitting
>>> device.
>>>
>>> Chi
>>> _______________________________________________
>>> jmsl mailing list
>>> jmsl at music.columbia.edu
>>> http://music.columbia.edu/mailman/listinfo/jmsl
>> _______________________________________________
>> jmsl mailing list
>> jmsl at music.columbia.edu
>> http://music.columbia.edu/mailman/listinfo/jmsl
>>
>
> _______________________________________________
> jmsl mailing list
> jmsl at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/jmsl
More information about the jmsl
mailing list