< prev index next >
src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java
Print this page
@@ -26,42 +26,32 @@
package com.sun.media.sound;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.spi.MixerProvider;
-
/**
* DirectAudioDevice provider.
*
* @author Florian Bomers
*/
public final class DirectAudioDeviceProvider extends MixerProvider {
- // STATIC VARIABLES
-
/**
* Set of info objects for all port input devices on the system.
*/
private static DirectAudioDeviceInfo[] infos;
/**
* Set of all port input devices on the system.
*/
private static DirectAudioDevice[] devices;
-
- // STATIC
-
static {
// initialize
Platform.initialize();
}
-
- // CONSTRUCTOR
-
-
/**
* Required public no-arg constructor.
*/
public DirectAudioDeviceProvider() {
synchronized (DirectAudioDeviceProvider.class) {
@@ -90,19 +80,20 @@
}
if (Printer.trace) Printer.trace("DirectAudioDeviceProvider: init(): found numDevices: " + numDevices);
}
}
+ @Override
public Mixer.Info[] getMixerInfo() {
synchronized (DirectAudioDeviceProvider.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 (DirectAudioDeviceProvider.class) {
// if the default device is asked, we provide the mixer
// with SourceDataLine's
if (info == null) {
@@ -123,22 +114,18 @@
}
throw new IllegalArgumentException(
String.format("Mixer %s not supported by this provider", info));
}
-
private static Mixer getDevice(DirectAudioDeviceInfo info) {
int index = info.getIndex();
if (devices[index] == null) {
devices[index] = new DirectAudioDevice(info);
}
return devices[index];
}
- // INNER CLASSES
-
-
/**
* Info class for DirectAudioDevices. Adds an index value and a string for
* making native references to a particular device.
* This constructor is called from native.
*/
@@ -169,10 +156,9 @@
int getDeviceID() {
return deviceID;
}
} // class DirectAudioDeviceInfo
- // NATIVE METHODS
private static native int nGetNumDevices();
// index: [0..nGetNumDevices()-1]
private static native DirectAudioDeviceInfo nNewDirectAudioDeviceInfo(int deviceIndex);
}
< prev index next >