Top Description Fields Constructors Methods
com.sun.media.jfxmediaimpl

pack-priv final Class NativeMediaAudioClip

extends AudioClip
Class Inheritance
Imports
com.sun.media.jfxmedia.AudioClip, com.sun.media.jfxmedia.locator.Locator, com.sun.media.jfxmedia.logging.Logger, java.io.FileNotFoundException, .IOException, java.net.URI, .URISyntaxException, java.util.concurrent.atomic.AtomicInteger

AudioClip implementation that uses NativeMediaPlayer to play sounds.

Field Summary

Modifier and TypeField and Description
private Locator
private AtomicInteger
private URI
Inherited from com.sun.media.jfxmedia.AudioClip:
clipBalanceclipPanclipPriorityclipRateclipVolumeloopCountSAMPLE_FORMAT_S16BESAMPLE_FORMAT_S16LESAMPLE_FORMAT_S24BESAMPLE_FORMAT_S24LESAMPLE_FORMAT_S8SAMPLE_FORMAT_U16BESAMPLE_FORMAT_U16LESAMPLE_FORMAT_U24BESAMPLE_FORMAT_U24LESAMPLE_FORMAT_U8

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public AudioClip
append(AudioClip clip)

Implements abstract com.sun.media.jfxmedia.AudioClip.append.

Create a new AudioClip by appending the given clip to the current clip.

public static AudioClip
create(byte[] data, int dataOffset, int sampleCount, int sampleFormat, int channels, int sampleRate)

Hides com.sun.media.jfxmedia.AudioClip.create.

Generate a AudioClip from raw LPCM audio data.

public AudioClip
createSegment(double startTime, double stopTime)

Implements abstract com.sun.media.jfxmedia.AudioClip.createSegment.

Create a new AudioClip from a segment of an existing AudioClip.

public AudioClip
createSegment(int startSample, int endSample)

Implements abstract com.sun.media.jfxmedia.AudioClip.createSegment.

Create a new AudioClip from a segment of an existing AudioClip.

public AudioClip
flatten()

Implements abstract com.sun.media.jfxmedia.AudioClip.flatten.

Creates a completely independent AudioClip.

pack-priv Locator
public boolean
isPlaying()

Implements abstract com.sun.media.jfxmedia.AudioClip.isPlaying.

Test if any AudioClipPlayer has this AudioClip in its effect chain.

public static AudioClip
load(URI source)

Hides com.sun.media.jfxmedia.AudioClip.load.

Load an audio clip from the specified source URI.

public void
play()

Implements abstract com.sun.media.jfxmedia.AudioClip.play.

Play this AudioClip with the default parameters.

public void
play(double volume)

Implements abstract com.sun.media.jfxmedia.AudioClip.play.

Play this AudioClip at the given volume level.

public void
play(double volume, double balance, double rate, double pan, int loopCount, int priority)

Implements abstract com.sun.media.jfxmedia.AudioClip.play.

Play this AudioClip at the given volume level and relative pitch.

pack-priv void
public AudioClip
resample(int startSample, int endSample, int newSampleRate)

Implements abstract com.sun.media.jfxmedia.AudioClip.resample.

Create a new AudioClip from an existing clip by resampling a segment of the source clip to the specified sample playbackRate.

public void
stop()

Implements abstract com.sun.media.jfxmedia.AudioClip.stop.

Stops all playback of this AudioClip.

public static void
stopAllClips()

Hides com.sun.media.jfxmedia.AudioClip.stopAllClips.

Stop all AudioClips that are currently playing.

Inherited from com.sun.media.jfxmedia.AudioClip:
balanceloopCountpanplaybackRateprioritysetBalancesetLoopCountsetPansetPlaybackRatesetPrioritysetVolumevolume

Field Detail

mediaLocatorback to summary
private Locator mediaLocator
playCountback to summary
private AtomicInteger playCount
sourceURIback to summary
private URI sourceURI

Constructor Detail

NativeMediaAudioClipback to summary
private NativeMediaAudioClip(URI source) throws URISyntaxException, FileNotFoundException, IOException

Method Detail

appendback to summary
public AudioClip append(AudioClip clip) throws IOException

Implements abstract com.sun.media.jfxmedia.AudioClip.append.

Doc from com.sun.media.jfxmedia.AudioClip.append.

Create a new AudioClip by appending the given clip to the current clip. The new clip is independent of the two source clips. If the sample rates are mismatched, the new clip will contain at least one resampled copy of a source clip. Which clip is resampled is implementation dependent.

Annotations
@Override
Exceptions
IOException:
If an error occurred during the concatenation, generally during rate conversion if it's necessary.
createback to summary
public static AudioClip create(byte[] data, int dataOffset, int sampleCount, int sampleFormat, int channels, int sampleRate)

Hides com.sun.media.jfxmedia.AudioClip.create.

Doc from com.sun.media.jfxmedia.AudioClip.create.

Generate a AudioClip from raw LPCM audio data. This can be used to programmatically create sound effects, either generated mathematically or loaded from some arbitrary source. Multiple channels must be interleaved properly, for stereo audio left channel is always first.

createSegmentback to summary
public AudioClip createSegment(double startTime, double stopTime) throws IllegalArgumentException

Implements abstract com.sun.media.jfxmedia.AudioClip.createSegment.

Doc from com.sun.media.jfxmedia.AudioClip.createSegment.

Create a new AudioClip from a segment of an existing AudioClip. The new clip may copy or simply reference this existing clip, so be aware that this operation may have a severe memory usage impact for long segments. The default parameters are copied to the new clip. This variant specifies the start and end times of the segment. Specifying an end time beyond the duration of the clip will crop the new AudioClip to the end of the source clip. Specifying a start time less than zero or greater than end time is undefined and will return null.

Annotations
@Override
Exceptions
IllegalArgumentException:
If startTime or stopTime are not valid for this AudioClip.
createSegmentback to summary
public AudioClip createSegment(int startSample, int endSample) throws IllegalArgumentException

Implements abstract com.sun.media.jfxmedia.AudioClip.createSegment.

Doc from com.sun.media.jfxmedia.AudioClip.createSegment.

Create a new AudioClip from a segment of an existing AudioClip. The new clip may copy or simply reference this existing clip, so be aware that this operation may have a severe memory usage impact for long segments. The default parameters are copied to the new clip. This variant specifies the exact sample offsets of the segment, starting at sample zero. If endSample is greater than the number of samples in the source clip, it will be cropped to the last sample. Specifying a start sample less than zero or higher than endSample is undefined and will return null.

Annotations
@Override
Exceptions
IllegalArgumentException:
If the given sample range is invalid for this AudioClip.
flattenback to summary
public AudioClip flatten()

Implements abstract com.sun.media.jfxmedia.AudioClip.flatten.

Doc from com.sun.media.jfxmedia.AudioClip.flatten.

Creates a completely independent AudioClip. Any references contained will be copied and the references removed. The result will be a single AudioEffect containing all the audio data required to produce the effect. If the effect is already independent, then this will simply return the same AudioClip.

Annotations
@Override
getLocatorback to summary
pack-priv Locator getLocator()
isPlayingback to summary
public boolean isPlaying()

Implements abstract com.sun.media.jfxmedia.AudioClip.isPlaying.

Doc from com.sun.media.jfxmedia.AudioClip.isPlaying.

Test if any AudioClipPlayer has this AudioClip in its effect chain.

Annotations
@Override
loadback to summary
public static AudioClip load(URI source) throws URISyntaxException, FileNotFoundException, IOException

Hides com.sun.media.jfxmedia.AudioClip.load.

Doc from com.sun.media.jfxmedia.AudioClip.load.

Load an audio clip from the specified source URI. Currently supported formats are AIFF and WAV files. Audio data in the file must be raw PCM, loading compressed files is not supported at this time.

Exceptions
IOException:
If an error occurred while loading the clip.
playback to summary
public void play()

Implements abstract com.sun.media.jfxmedia.AudioClip.play.

Doc from com.sun.media.jfxmedia.AudioClip.play.

Play this AudioClip with the default parameters. This is a fire and forget method, the clip will play exactly once using the default parameters.

Annotations
@Override
playback to summary
public void play(double volume)

Implements abstract com.sun.media.jfxmedia.AudioClip.play.

Doc from com.sun.media.jfxmedia.AudioClip.play.

Play this AudioClip at the given volume level. This is a fire and forget method, the clip will play exactly once using the given volume and default pitch and pan.

Annotations
@Override
playback to summary
public void play(double volume, double balance, double rate, double pan, int loopCount, int priority)

Implements abstract com.sun.media.jfxmedia.AudioClip.play.

Doc from com.sun.media.jfxmedia.AudioClip.play.

Play this AudioClip at the given volume level and relative pitch. This is a fire and forget method, the clip will play exactly once using the given parameters.

Annotations
@Override
playFinishedback to summary
pack-priv void playFinished()
resampleback to summary
public AudioClip resample(int startSample, int endSample, int newSampleRate) throws IllegalArgumentException, IOException

Implements abstract com.sun.media.jfxmedia.AudioClip.resample.

Doc from com.sun.media.jfxmedia.AudioClip.resample.

Create a new AudioClip from an existing clip by resampling a segment of the source clip to the specified sample playbackRate.

Annotations
@Override
Exceptions
IllegalArgumentException:
If the sample range is invalid for this AudioClip, or the new sample rate is not supported.
IOException:
If an error occurred during rate conversion.
stopback to summary
public void stop()

Implements abstract com.sun.media.jfxmedia.AudioClip.stop.

Doc from com.sun.media.jfxmedia.AudioClip.stop.

Stops all playback of this AudioClip.

Annotations
@Override
stopAllClipsback to summary
public static void stopAllClips()

Hides com.sun.media.jfxmedia.AudioClip.stopAllClips.

Doc from com.sun.media.jfxmedia.AudioClip.stopAllClips.

Stop all AudioClips that are currently playing.