- java.lang.Object
-
- com.tagtraum.audioplayer4j.AudioPlayerFactory
-
public class AudioPlayerFactory extends Object
Factory forAudioPlayerinstances. To get an instance, useopen(URI)or, if playback on a specificAudioDeviceis desired, useopen(URI, AudioDevice).
You may disable certain implementations by callingsetJavaEnabled(boolean),setJavaFXEnabled(boolean), orsetNativeEnabled(boolean).- Author:
- Hendrik Schreiber
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisJavaEnabled()Indicates whether a Java-based implementation is enabled.static booleanisJavaFXEnabled()Indicates whether a JavaFX-based implementation is enabled.static booleanisNativeEnabled()Indicates whether a native implementation is enabled.static AudioPlayeropen(URI uri)Opens anAudioPlayerinstance suitable for the given URI using the default audio device for playback.static AudioPlayeropen(URI uri, AudioDevice audioDevice)Opens anAudioPlayerinstance suitable for the given URI using the given audio device for playback.static voidsetJavaEnabled(boolean javaEnabled)Enables/disables the Java-based implementation.static voidsetJavaFXEnabled(boolean javaFXEnabled)Enables/disables the JavaFX-based implementation (if available at all).static voidsetNativeEnabled(boolean nativeEnabled)Enables/disables the native implementation (if available at all).
-
-
-
Method Detail
-
isNativeEnabled
public static boolean isNativeEnabled()
Indicates whether a native implementation is enabled.- Returns:
- true or false
-
setNativeEnabled
public static void setNativeEnabled(boolean nativeEnabled)
Enables/disables the native implementation (if available at all).- Parameters:
nativeEnabled- true or false
-
isJavaEnabled
public static boolean isJavaEnabled()
Indicates whether a Java-based implementation is enabled.- Returns:
- true or false
-
setJavaEnabled
public static void setJavaEnabled(boolean javaEnabled)
Enables/disables the Java-based implementation.- Parameters:
javaEnabled- true or false
-
isJavaFXEnabled
public static boolean isJavaFXEnabled()
Indicates whether a JavaFX-based implementation is enabled.- Returns:
- true or false
-
setJavaFXEnabled
public static void setJavaFXEnabled(boolean javaFXEnabled)
Enables/disables the JavaFX-based implementation (if available at all).- Parameters:
javaFXEnabled- true or false
-
open
public static AudioPlayer open(URI uri) throws IOException, UnsupportedAudioFileException
Opens anAudioPlayerinstance suitable for the given URI using the default audio device for playback.- Parameters:
uri- audio resource URI- Returns:
- audio player instance
- Throws:
IOException- if the URI cannot be openedUnsupportedAudioFileException- See Also:
open(URI, AudioDevice)
-
open
public static AudioPlayer open(URI uri, AudioDevice audioDevice) throws IOException, UnsupportedAudioFileException
Opens anAudioPlayerinstance suitable for the given URI using the given audio device for playback.- Parameters:
uri- audio resource URIaudioDevice- desired audio device- Returns:
- audio player instance
- Throws:
IOException- if the URI cannot be openedUnsupportedAudioFileException- See Also:
open(URI)
-
-