APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.media.jfxmediaimpl

pack-priv final Class NativeMediaAudioClipPlayer

extends Object
implements PlayerStateListener, MediaErrorListener
Class Inheritance
All Implemented Interfaces
com.sun.media.jfxmedia.events.MediaErrorListener, com.sun.media.jfxmedia.events.PlayerStateListener
Imports
com.sun.media.jfxmedia.MediaManager, .MediaPlayer, com.sun.media.jfxmedia.events.MediaErrorListener, .PlayerStateEvent, .PlayerStateListener, com.sun.media.jfxmedia.locator.Locator, com.sun.media.jfxmedia.logging.Logger, java.net.URI, java.util.ArrayList, .List, java.util.concurrent.CountDownLatch, .LinkedBlockingQueue, .TimeUnit, java.util.concurrent.locks.ReentrantLock

This is a stop-gap solution to eliminate the JavaSound implementation. It's not meant to be perfect, just work well enough to demonstrate functionality.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final List<NativeMediaAudioClipPlayer>
private double
private int
private static final int
private MediaPlayer
private double
private int
private static final ReentrantLock
private final ReentrantLock
private boolean
private int
private double
private boolean
private static final LinkedBlockingQueue<NativeMediaAudioClipPlayer.SchedulerEntry>
private NativeMediaAudioClip
private double

Constructor Summary

AccessConstructor and Description
private
NativeMediaAudioClipPlayer(NativeMediaAudioClip clip, double volume, double balance, double rate, double pan, int loopCount, int priority)

Method Summary

Modifier and TypeMethod and Description
private static boolean
public double
private static void
public boolean
equals(Object that)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public static int
public static int
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public synchronized void
public boolean
private boolean
public int
public void
onError(Object source, int errorCode, String message)

Implements com.sun.media.jfxmedia.events.MediaErrorListener.onError.

Reports the occurrence of a error in media processing.

public void
onFinish(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onFinish.

The finish state indicates playback has completed playback to the end.

public void
onHalt(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onHalt.

The error notification provides information on any error during playback.

public void
onPause(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onPause.

The pause state indicates playback has paused.

public void
onPlaying(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onPlaying.

The play state indicates the media is beginning to play.

public void
onReady(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onReady.

The ready state indicates the media is loaded.

public void
public void
onStop(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onStop.

The stop state indicates playback has paused and presentation time has been reset back to 0.

public void
onWarning(Object source, String message)

public double
pan()

public synchronized void
play()

public double
public static void
playClip(NativeMediaAudioClip clip, double volume, double balance, double rate, double pan, int loopCount, int priority)

public int
public void
setBalance(double balance)

public void
setLoopCount(int loopCount)

public void
setPan(double pan)

public void
setPlaybackRate(double rate)

public void
setPriority(int priority)

public void
setVolume(double volume)

private Locator
public void
stop()

public static void
public double
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

activePlayersback to summary
private static final List<NativeMediaAudioClipPlayer> activePlayers
balanceback to summary
private double balance
loopCountback to summary
private int loopCount
MAX_PLAYER_COUNTback to summary
private static final int MAX_PLAYER_COUNT
mediaPlayerback to summary
private MediaPlayer mediaPlayer
panback to summary
private double pan
playCountback to summary
private int playCount
playerListLockback to summary
private static final ReentrantLock playerListLock
playerStateLockback to summary
private final ReentrantLock playerStateLock
playingback to summary
private boolean playing
priorityback to summary
private int priority
rateback to summary
private double rate
readyback to summary
private boolean ready
scheduleback to summary
private static final LinkedBlockingQueue<NativeMediaAudioClipPlayer.SchedulerEntry> schedule
sourceClipback to summary
private NativeMediaAudioClip sourceClip
volumeback to summary
private double volume

Constructor Detail

NativeMediaAudioClipPlayerback to summary
private NativeMediaAudioClipPlayer(NativeMediaAudioClip clip, double volume, double balance, double rate, double pan, int loopCount, int priority)

Method Detail

addPlayerback to summary
private static boolean addPlayer(NativeMediaAudioClipPlayer newPlayer)
balanceback to summary
public double balance()
clipSchedulerback to summary
private static void clipScheduler()
equalsback to summary
public boolean equals(Object that)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getPlayerCountback to summary
public static int getPlayerCount()
getPlayerLimitback to summary
public static int getPlayerLimit()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
invalidateback to summary
public synchronized void invalidate()
isPlayingback to summary
public boolean isPlaying()
isReadyback to summary
private boolean isReady()
loopCountback to summary
public int loopCount()
onErrorback to summary
public void onError(Object source, int errorCode, String message)

Implements com.sun.media.jfxmedia.events.MediaErrorListener.onError.

Doc from com.sun.media.jfxmedia.events.MediaErrorListener.onError.

Reports the occurrence of a error in media processing. An error may or may not cause a stop in processing.

Annotations
@Override
onFinishback to summary
public void onFinish(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onFinish.

Doc from com.sun.media.jfxmedia.events.PlayerStateListener.onFinish.

The finish state indicates playback has completed playback to the end.

Annotations
@Override
onHaltback to summary
public void onHalt(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onHalt.

Doc from com.sun.media.jfxmedia.events.PlayerStateListener.onHalt.

The error notification provides information on any error during playback.

Annotations
@Override
onPauseback to summary
public void onPause(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onPause.

Doc from com.sun.media.jfxmedia.events.PlayerStateListener.onPause.

The pause state indicates playback has paused.

Annotations
@Override
onPlayingback to summary
public void onPlaying(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onPlaying.

Doc from com.sun.media.jfxmedia.events.PlayerStateListener.onPlaying.

The play state indicates the media is beginning to play.

Annotations
@Override
onReadyback to summary
public void onReady(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onReady.

Doc from com.sun.media.jfxmedia.events.PlayerStateListener.onReady.

The ready state indicates the media is loaded. For best results, developers should wait on OnReady() before playing a media.

Annotations
@Override
onStallback to summary
public void onStall(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onStall.

Annotations
@Override
onStopback to summary
public void onStop(PlayerStateEvent evt)

Implements com.sun.media.jfxmedia.events.PlayerStateListener.onStop.

Doc from com.sun.media.jfxmedia.events.PlayerStateListener.onStop.

The stop state indicates playback has paused and presentation time has been reset back to 0. If the player is asked to play() again, playback begins from the beginning.

Annotations
@Override
onWarningback to summary
public void onWarning(Object source, String message)
panback to summary
public double pan()
playback to summary
public synchronized void play()
playbackRateback to summary
public double playbackRate()
playClipback to summary
public static void playClip(NativeMediaAudioClip clip, double volume, double balance, double rate, double pan, int loopCount, int priority)
priorityback to summary
public int priority()
setBalanceback to summary
public void setBalance(double balance)
setLoopCountback to summary
public void setLoopCount(int loopCount)
setPanback to summary
public void setPan(double pan)
setPlaybackRateback to summary
public void setPlaybackRate(double rate)
setPriorityback to summary
public void setPriority(int priority)
setVolumeback to summary
public void setVolume(double volume)
sourceback to summary
private Locator source()
stopback to summary
public void stop()
stopPlayersback to summary
public static void stopPlayers(Locator source)
volumeback to summary
public double volume()
com.sun.media.jfxmediaimpl back to summary

private Class NativeMediaAudioClipPlayer.Enthreaderator

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.media.jfxmediaimpl.NativeMediaAudioClipPlayer.Enthreaderator

Field Summary

Modifier and TypeField and Description
private static final Thread

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Thread
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

schedulerThreadback to summary
private static final Thread schedulerThread

Constructor Detail

Enthreaderatorback to summary
private Enthreaderator()

Method Detail

getSchedulerThreadback to summary
public static Thread getSchedulerThread()
com.sun.media.jfxmediaimpl back to summary

private Class NativeMediaAudioClipPlayer.SchedulerEntry

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.media.jfxmediaimpl.NativeMediaAudioClipPlayer.SchedulerEntry

Field Summary

Modifier and TypeField and Description
private final URI
private final int
private final CountDownLatch
private final MediaPlayer
private final NativeMediaAudioClipPlayer

Constructor Summary

AccessConstructor and Description
public
public
SchedulerEntry(URI sourceURI, CountDownLatch signal)

public

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object other)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public URI
public int
public MediaPlayer
public NativeMediaAudioClipPlayer
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

clipURIback to summary
private final URI clipURI
commandback to summary
private final int command
commandSignalback to summary
private final CountDownLatch commandSignal
mediaPlayerback to summary
private final MediaPlayer mediaPlayer
playerback to summary
private final NativeMediaAudioClipPlayer player

Constructor Detail

SchedulerEntryback to summary
public SchedulerEntry(NativeMediaAudioClipPlayer player)
SchedulerEntryback to summary
public SchedulerEntry(URI sourceURI, CountDownLatch signal)
SchedulerEntryback to summary
public SchedulerEntry(MediaPlayer mediaPlayer)

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getClipURIback to summary
public URI getClipURI()
getCommandback to summary
public int getCommand()
getMediaPlayerback to summary
public MediaPlayer getMediaPlayer()
getPlayerback to summary
public NativeMediaAudioClipPlayer getPlayer()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
signalback to summary
public void signal()