final class NativeMediaAudioClipPlayer extends java.lang.Object implements PlayerStateListener, MediaErrorListener
Modifier and Type | Class and Description |
---|---|
private static class |
NativeMediaAudioClipPlayer.Enthreaderator |
private static class |
NativeMediaAudioClipPlayer.SchedulerEntry |
Modifier and Type | Field and Description |
---|---|
private static java.util.List<NativeMediaAudioClipPlayer> |
activePlayers |
private double |
balance |
private int |
loopCount |
private static int |
MAX_PLAYER_COUNT |
private MediaPlayer |
mediaPlayer |
private double |
pan |
private int |
playCount |
private static java.util.concurrent.locks.ReentrantLock |
playerListLock |
private java.util.concurrent.locks.ReentrantLock |
playerStateLock |
private boolean |
playing |
private int |
priority |
private double |
rate |
private boolean |
ready |
private static java.util.concurrent.LinkedBlockingQueue<NativeMediaAudioClipPlayer.SchedulerEntry> |
schedule |
private NativeMediaAudioClip |
sourceClip |
private double |
volume |
Modifier | Constructor and Description |
---|---|
private |
NativeMediaAudioClipPlayer(NativeMediaAudioClip clip,
double volume,
double balance,
double rate,
double pan,
int loopCount,
int priority) |
Modifier and Type | Method and Description |
---|---|
private static boolean |
addPlayer(NativeMediaAudioClipPlayer newPlayer) |
double |
balance() |
private static void |
clipScheduler() |
boolean |
equals(java.lang.Object that) |
static int |
getPlayerCount() |
static int |
getPlayerLimit() |
void |
invalidate() |
boolean |
isPlaying() |
private boolean |
isReady() |
int |
loopCount() |
void |
onError(java.lang.Object source,
int errorCode,
java.lang.String message)
Reports the occurrence of a error in media processing.
|
void |
onFinish(PlayerStateEvent evt)
The finish state indicates playback has completed playback to the end.
|
void |
onHalt(PlayerStateEvent evt)
The error notification provides information on any error during playback.
|
void |
onPause(PlayerStateEvent evt)
The pause state indicates playback has paused.
|
void |
onPlaying(PlayerStateEvent evt)
The play state indicates the media is beginning to play.
|
void |
onReady(PlayerStateEvent evt)
The ready state indicates the media is loaded.
|
void |
onStall(PlayerStateEvent evt) |
void |
onStop(PlayerStateEvent evt)
The stop state indicates playback has paused and presentation time has been reset back to 0.
|
void |
onWarning(java.lang.Object source,
java.lang.String message) |
double |
pan() |
void |
play() |
double |
playbackRate() |
static void |
playClip(NativeMediaAudioClip clip,
double volume,
double balance,
double rate,
double pan,
int loopCount,
int priority) |
int |
priority() |
void |
setBalance(double balance) |
void |
setLoopCount(int loopCount) |
void |
setPan(double pan) |
void |
setPlaybackRate(double rate) |
void |
setPriority(int priority) |
void |
setVolume(double volume) |
private Locator |
source() |
void |
stop() |
static void |
stopPlayers(Locator source) |
double |
volume() |
private MediaPlayer mediaPlayer
private int playCount
private int loopCount
private boolean playing
private boolean ready
private NativeMediaAudioClip sourceClip
private double volume
private double balance
private double pan
private double rate
private int priority
private final java.util.concurrent.locks.ReentrantLock playerStateLock
private static final int MAX_PLAYER_COUNT
private static final java.util.List<NativeMediaAudioClipPlayer> activePlayers
private static final java.util.concurrent.locks.ReentrantLock playerListLock
private static final java.util.concurrent.LinkedBlockingQueue<NativeMediaAudioClipPlayer.SchedulerEntry> schedule
private NativeMediaAudioClipPlayer(NativeMediaAudioClip clip, double volume, double balance, double rate, double pan, int loopCount, int priority)
public static int getPlayerLimit()
public static int getPlayerCount()
private static void clipScheduler()
public static void playClip(NativeMediaAudioClip clip, double volume, double balance, double rate, double pan, int loopCount, int priority)
private static boolean addPlayer(NativeMediaAudioClipPlayer newPlayer)
public static void stopPlayers(Locator source)
private Locator source()
public double volume()
public void setVolume(double volume)
public double balance()
public void setBalance(double balance)
public double pan()
public void setPan(double pan)
public double playbackRate()
public void setPlaybackRate(double rate)
public int priority()
public void setPriority(int priority)
public int loopCount()
public void setLoopCount(int loopCount)
public boolean isPlaying()
private boolean isReady()
public void play()
public void stop()
public void invalidate()
public void onReady(PlayerStateEvent evt)
PlayerStateListener
onReady
in interface PlayerStateListener
public void onPlaying(PlayerStateEvent evt)
PlayerStateListener
onPlaying
in interface PlayerStateListener
public void onPause(PlayerStateEvent evt)
PlayerStateListener
onPause
in interface PlayerStateListener
public void onStop(PlayerStateEvent evt)
PlayerStateListener
onStop
in interface PlayerStateListener
public void onStall(PlayerStateEvent evt)
onStall
in interface PlayerStateListener
public void onFinish(PlayerStateEvent evt)
PlayerStateListener
onFinish
in interface PlayerStateListener
public void onHalt(PlayerStateEvent evt)
PlayerStateListener
onHalt
in interface PlayerStateListener
public void onWarning(java.lang.Object source, java.lang.String message)
public void onError(java.lang.Object source, int errorCode, java.lang.String message)
MediaErrorListener
onError
in interface MediaErrorListener
source
- the source of the warning, likely the object calling this
method.errorCode
- an error code from the internal playback processormessage
- a String
containing the warning.public boolean equals(java.lang.Object that)
equals
in class java.lang.Object