final class NativeMediaAudioClip extends AudioClip
Modifier and Type | Field and Description |
---|---|
private Locator |
mediaLocator |
private java.util.concurrent.atomic.AtomicInteger |
playCount |
private java.net.URI |
sourceURI |
clipBalance, clipPan, clipPriority, clipRate, clipVolume, loopCount, SAMPLE_FORMAT_S16BE, SAMPLE_FORMAT_S16LE, SAMPLE_FORMAT_S24BE, SAMPLE_FORMAT_S24LE, SAMPLE_FORMAT_S8, SAMPLE_FORMAT_U16BE, SAMPLE_FORMAT_U16LE, SAMPLE_FORMAT_U24BE, SAMPLE_FORMAT_U24LE, SAMPLE_FORMAT_U8
Modifier | Constructor and Description |
---|---|
private |
NativeMediaAudioClip(java.net.URI source) |
Modifier and Type | Method and Description |
---|---|
AudioClip |
append(AudioClip clip)
Create a new AudioClip by appending the given clip to the current clip.
|
static AudioClip |
create(byte[] data,
int dataOffset,
int sampleCount,
int sampleFormat,
int channels,
int sampleRate) |
AudioClip |
createSegment(double startTime,
double stopTime)
Create a new AudioClip from a segment of an existing AudioClip.
|
AudioClip |
createSegment(int startSample,
int endSample)
Create a new AudioClip from a segment of an existing AudioClip.
|
AudioClip |
flatten()
Creates a completely independent AudioClip.
|
(package private) Locator |
getLocator() |
boolean |
isPlaying()
Test if any AudioClipPlayer has this AudioClip in its effect chain.
|
static AudioClip |
load(java.net.URI source) |
void |
play()
Play this AudioClip with the default parameters.
|
void |
play(double volume)
Play this AudioClip at the given volume level.
|
void |
play(double volume,
double balance,
double rate,
double pan,
int loopCount,
int priority)
Play this AudioClip at the given volume level and relative pitch.
|
(package private) void |
playFinished() |
AudioClip |
resample(int startSample,
int endSample,
int newSampleRate)
Create a new AudioClip from an existing clip by resampling a segment of
the source clip to the specified sample playbackRate.
|
void |
stop()
Stops all playback of this AudioClip.
|
static void |
stopAllClips() |
balance, loopCount, pan, playbackRate, priority, setBalance, setLoopCount, setPan, setPlaybackRate, setPriority, setVolume, volume
private java.net.URI sourceURI
private Locator mediaLocator
private java.util.concurrent.atomic.AtomicInteger playCount
private NativeMediaAudioClip(java.net.URI source) throws java.net.URISyntaxException, java.io.FileNotFoundException, java.io.IOException
java.net.URISyntaxException
java.io.FileNotFoundException
java.io.IOException
Locator getLocator()
public static AudioClip load(java.net.URI source) throws java.net.URISyntaxException, java.io.FileNotFoundException, java.io.IOException
java.net.URISyntaxException
java.io.FileNotFoundException
java.io.IOException
public static AudioClip create(byte[] data, int dataOffset, int sampleCount, int sampleFormat, int channels, int sampleRate)
public AudioClip createSegment(double startTime, double stopTime) throws java.lang.IllegalArgumentException
AudioClip
createSegment
in class AudioClip
startTime
- The start time for the segmentstopTime
- The end time of the segment or -1.0 for the remainder of
the source clip.java.lang.IllegalArgumentException
- If startTime or stopTime are not valid
for this AudioClip.public AudioClip createSegment(int startSample, int endSample) throws java.lang.IllegalArgumentException
AudioClip
createSegment
in class AudioClip
startSample
- The starting audio sample for the segmentendSample
- The ending audio sample of the segment, or -1 for the
remainder of the source clip.java.lang.IllegalArgumentException
- If the given sample range is invalid for
this AudioClip.public AudioClip resample(int startSample, int endSample, int newSampleRate) throws java.lang.IllegalArgumentException, java.io.IOException
AudioClip
resample
in class AudioClip
startSample
- starting sample to begin resampling at. The first
sample is always zero, negative values are not allowed.endSample
- The last sample to resample or -1 for the remainder of
the source clip.newSampleRate
- The sample playbackRate to create the new AudioClip at.java.lang.IllegalArgumentException
- If the sample range is invalid for this
AudioClip, or the new sample rate is not supported.java.io.IOException
- If an error occurred during rate conversion.public AudioClip append(AudioClip clip) throws java.io.IOException
AudioClip
append
in class AudioClip
clip
- The clip to be appended to the current clip.java.io.IOException
- If an error occurred during the concatenation,
generally during rate conversion if it's necessary.public AudioClip flatten()
AudioClip
public boolean isPlaying()
AudioClip
public void play()
AudioClip
public void play(double volume)
AudioClip
public void play(double volume, double balance, double rate, double pan, int loopCount, int priority)
AudioClip
play
in class AudioClip
volume
- Volume level to play this effect at. Valid volume range is
0.0 to 1.0, where 0.0 is effectively muted and 1.0 is full volume.balance
- Left/right balance or relative channel volumes for stereo
effects.rate
- Playback rate multiplier. 1.0 will play back at the normal
rate while 2.0 will double the rate.pan
- Left/right shift to be applied to the clip. A pan value of
-1.0 means full left channel, 1.0 means full right channel, 0.0 has no
effect.loopCount
- The number of times to play this clip, specify -1 to
loop indefinitelypriority
- Audio effect priority. Lower priority effects will be
dropped first if too many effects are trying to play simultaneously.public void stop()
AudioClip
public static void stopAllClips()
void playFinished()