< prev index next >
src/java.desktop/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java
Print this page
@@ -25,11 +25,10 @@
package com.sun.media.sound;
import javax.sound.midi.MidiDevice;
-
/**
* MIDI output device provider.
*
* @author Kara Kytle
* @author Florian Bomers
@@ -42,59 +41,57 @@
/** Cache of open MIDI output devices on the system. */
private static MidiDevice[] devices = null;
private static final boolean enabled;
- // STATIC
-
static {
// initialize
Platform.initialize();
enabled = Platform.isMidiIOEnabled();
}
- // CONSTRUCTOR
-
/**
* Required public no-arg constructor.
*/
public MidiOutDeviceProvider() {
if (Printer.trace) Printer.trace("MidiOutDeviceProvider: constructor");
}
- // implementation of abstract methods in AbstractMidiDeviceProvider
-
+ @Override
AbstractMidiDeviceProvider.Info createInfo(int index) {
if (!enabled) {
return null;
}
return new MidiOutDeviceInfo(index, MidiOutDeviceProvider.class);
}
+ @Override
MidiDevice createDevice(AbstractMidiDeviceProvider.Info info) {
if (enabled && (info instanceof MidiOutDeviceInfo)) {
return new MidiOutDevice(info);
}
return null;
}
+ @Override
int getNumDevices() {
if (!enabled) {
if (Printer.debug)Printer.debug("MidiOutDevice not enabled, returning 0 devices");
return 0;
}
return nGetNumDevices();
}
+ @Override
MidiDevice[] getDeviceCache() { return devices; }
+ @Override
void setDeviceCache(MidiDevice[] devices) { MidiOutDeviceProvider.devices = devices; }
+ @Override
Info[] getInfoCache() { return infos; }
+ @Override
void setInfoCache(Info[] infos) { MidiOutDeviceProvider.infos = infos; }
-
- // INNER CLASSES
-
/**
* Info class for MidiOutDevices. Adds the
* provider's Class to keep the provider class from being
* unloaded. Otherwise, at least on JDK1.1.7 and 1.1.8,
* the provider class can be unloaded. Then, then the provider
@@ -111,13 +108,10 @@
this.providerClass = providerClass;
}
} // class MidiOutDeviceInfo
-
- // NATIVE METHODS
-
private static native int nGetNumDevices();
private static native String nGetName(int index);
private static native String nGetVendor(int index);
private static native String nGetDescription(int index);
private static native String nGetVersion(int index);
< prev index next >