< prev index next >

src/java.desktop/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java

Print this page

        

*** 25,35 **** package com.sun.media.sound; import javax.sound.midi.MidiDevice; - /** * MIDI output device provider. * * @author Kara Kytle * @author Florian Bomers --- 25,34 ----
*** 42,100 **** /** 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 ! AbstractMidiDeviceProvider.Info createInfo(int index) { if (!enabled) { return null; } return new MidiOutDeviceInfo(index, MidiOutDeviceProvider.class); } MidiDevice createDevice(AbstractMidiDeviceProvider.Info info) { if (enabled && (info instanceof MidiOutDeviceInfo)) { return new MidiOutDevice(info); } return null; } int getNumDevices() { if (!enabled) { if (Printer.debug)Printer.debug("MidiOutDevice not enabled, returning 0 devices"); return 0; } return nGetNumDevices(); } MidiDevice[] getDeviceCache() { return devices; } void setDeviceCache(MidiDevice[] devices) { MidiOutDeviceProvider.devices = devices; } Info[] getInfoCache() { return infos; } 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 --- 41,97 ---- /** Cache of open MIDI output devices on the system. */ private static MidiDevice[] devices = null; private static final boolean enabled; static { // initialize Platform.initialize(); enabled = Platform.isMidiIOEnabled(); } /** * Required public no-arg constructor. */ public MidiOutDeviceProvider() { if (Printer.trace) Printer.trace("MidiOutDeviceProvider: constructor"); } ! @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; } /** * 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,123 **** 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); --- 108,117 ----
< prev index next >