< prev index next >

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

Print this page

        

*** 25,35 **** package com.sun.media.sound; import javax.sound.midi.MidiDevice; - /** * MIDI input device provider. * * @author Kara Kytle * @author Florian Bomers --- 25,34 ----
*** 42,102 **** /** Cache of open MIDI input 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 MidiInDeviceProvider() { if (Printer.trace) Printer.trace("MidiInDeviceProvider: constructor"); } // implementation of abstract methods in AbstractMidiDeviceProvider AbstractMidiDeviceProvider.Info createInfo(int index) { if (!enabled) { return null; } return new MidiInDeviceInfo(index, MidiInDeviceProvider.class); } MidiDevice createDevice(AbstractMidiDeviceProvider.Info info) { if (enabled && (info instanceof MidiInDeviceInfo)) { return new MidiInDevice(info); } return null; } int getNumDevices() { if (!enabled) { if (Printer.debug)Printer.debug("MidiInDevice not enabled, returning 0 devices"); return 0; } int numDevices = nGetNumDevices(); if (Printer.debug)Printer.debug("MidiInDeviceProvider.getNumDevices(): devices: " + numDevices); return numDevices; } MidiDevice[] getDeviceCache() { return devices; } void setDeviceCache(MidiDevice[] devices) { MidiInDeviceProvider.devices = devices; } Info[] getInfoCache() { return infos; } void setInfoCache(Info[] infos) { MidiInDeviceProvider.infos = infos; } - - // INNER CLASSES - /** * Info class for MidiInDevices. 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,101 ---- /** Cache of open MIDI input 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 MidiInDeviceProvider() { if (Printer.trace) Printer.trace("MidiInDeviceProvider: constructor"); } // implementation of abstract methods in AbstractMidiDeviceProvider + @Override AbstractMidiDeviceProvider.Info createInfo(int index) { if (!enabled) { return null; } return new MidiInDeviceInfo(index, MidiInDeviceProvider.class); } + @Override MidiDevice createDevice(AbstractMidiDeviceProvider.Info info) { if (enabled && (info instanceof MidiInDeviceInfo)) { return new MidiInDevice(info); } return null; } + @Override int getNumDevices() { if (!enabled) { if (Printer.debug)Printer.debug("MidiInDevice not enabled, returning 0 devices"); return 0; } int numDevices = nGetNumDevices(); if (Printer.debug)Printer.debug("MidiInDeviceProvider.getNumDevices(): devices: " + numDevices); return numDevices; } + @Override MidiDevice[] getDeviceCache() { return devices; } + @Override void setDeviceCache(MidiDevice[] devices) { MidiInDeviceProvider.devices = devices; } + @Override Info[] getInfoCache() { return infos; } + @Override void setInfoCache(Info[] infos) { MidiInDeviceProvider.infos = infos; } /** * Info class for MidiInDevices. 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
*** 113,125 **** this.providerClass = providerClass; } } // class MidiInDeviceInfo - - // 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); --- 112,121 ----
< prev index next >