final class NativeAudioClip extends AudioClip
Modifier and Type | Class and Description |
---|---|
private static class |
NativeAudioClip.NativeAudioClipDisposer |
Modifier and Type | Field and Description |
---|---|
private static NativeAudioClip.NativeAudioClipDisposer |
clipDisposer |
private Locator |
mediaSource |
private long |
nativeHandle |
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 |
NativeAudioClip(byte[] data,
int dataOffset,
int sampleCount,
int sampleFormat,
int channels,
int sampleRate) |
private |
NativeAudioClip(Locator 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) long |
getNativeHandle() |
static boolean |
init() |
boolean |
isPlaying()
Test if any AudioClipPlayer has this AudioClip in its effect chain.
|
static AudioClip |
load(java.net.URI source) |
private NativeAudioClip |
nacAppend(long handle,
long otherClip) |
private static long |
nacCreate(byte[] data,
int dataOffset,
int sampleCount,
int sampleFormat,
int channels,
int sampleRate) |
private NativeAudioClip |
nacCreateSegment(long handle,
double startTime,
double stopTime) |
private NativeAudioClip |
nacCreateSegment(long handle,
int startSample,
int endSample) |
private static boolean |
nacInit() |
private boolean |
nacIsPlaying(long handle) |
private static long |
nacLoad(Locator source) |
private void |
nacPlay(long handle,
double volume,
double balance,
double pan,
double rate,
int loopCount,
int priority) |
private NativeAudioClip |
nacResample(long handle,
int startSample,
int endSample,
int sampleRate) |
private void |
nacStop(long handle) |
private static void |
nacStopAll() |
private static void |
nacUnload(long handle) |
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.
|
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 final Locator mediaSource
private long nativeHandle
private static NativeAudioClip.NativeAudioClipDisposer clipDisposer
private NativeAudioClip(Locator source)
private NativeAudioClip(byte[] data, int dataOffset, int sampleCount, int sampleFormat, int channels, int sampleRate)
private static boolean nacInit()
private static long nacLoad(Locator source)
private static long nacCreate(byte[] data, int dataOffset, int sampleCount, int sampleFormat, int channels, int sampleRate)
private static void nacUnload(long handle)
private static void nacStopAll()
public static boolean init()
public static AudioClip load(java.net.URI source)
public static AudioClip create(byte[] data, int dataOffset, int sampleCount, int sampleFormat, int channels, int sampleRate)
private NativeAudioClip nacCreateSegment(long handle, double startTime, double stopTime)
private NativeAudioClip nacCreateSegment(long handle, int startSample, int endSample)
private NativeAudioClip nacResample(long handle, int startSample, int endSample, int sampleRate)
private NativeAudioClip nacAppend(long handle, long otherClip)
private boolean nacIsPlaying(long handle)
private void nacPlay(long handle, double volume, double balance, double pan, double rate, int loopCount, int priority)
private void nacStop(long handle)
long getNativeHandle()
public AudioClip createSegment(double startTime, double stopTime)
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.public AudioClip createSegment(int startSample, int endSample)
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.public AudioClip resample(int startSample, int endSample, int newSampleRate)
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.public AudioClip append(AudioClip clip)
AudioClip
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()