< prev index next >

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

Print this page

        

*** 26,67 **** package com.sun.media.sound; import javax.sound.sampled.Mixer; import javax.sound.sampled.spi.MixerProvider; - /** * Port provider. * * @author Florian Bomers */ public final class PortMixerProvider extends MixerProvider { - // STATIC VARIABLES - /** * Set of info objects for all port input devices on the system. */ private static PortMixerInfo[] infos; /** * Set of all port input devices on the system. */ private static PortMixer[] devices; - - // STATIC - static { // initialize Platform.initialize(); } - - // CONSTRUCTOR - - /** * Required public no-arg constructor. */ public PortMixerProvider() { synchronized (PortMixerProvider.class) { --- 26,57 ----
*** 91,108 **** --- 81,100 ---- } if (Printer.trace) Printer.trace("PortMixerProvider: init(): found numDevices: " + numDevices); } } + @Override public Mixer.Info[] getMixerInfo() { synchronized (PortMixerProvider.class) { Mixer.Info[] localArray = new Mixer.Info[infos.length]; System.arraycopy(infos, 0, localArray, 0, infos.length); return localArray; } } + @Override public Mixer getMixer(Mixer.Info info) { synchronized (PortMixerProvider.class) { for (int i = 0; i < infos.length; i++) { if (infos[i].equals(info)) { return getDevice(infos[i]);
*** 111,132 **** } throw new IllegalArgumentException( String.format("Mixer %s not supported by this provider", info)); } - private static Mixer getDevice(PortMixerInfo info) { int index = info.getIndex(); if (devices[index] == null) { devices[index] = new PortMixer(info); } return devices[index]; } - // INNER CLASSES - - /** * Info class for PortMixers. Adds an index value for * making native references to a particular device. * This constructor is called from native. */ --- 103,120 ----
*** 142,150 **** return index; } } // class PortMixerInfo - // NATIVE METHODS private static native int nGetNumDevices(); private static native PortMixerInfo nNewPortMixerInfo(int mixerIndex); } --- 130,137 ----
< prev index next >