public abstract class AudioSample extends AudioSource
AudioSample
keeps the entire file in an internal buffer and
all you can do is trigger()
the sound. However, you can trigger
the sound even if it is still playing back. It is not advised that you use
this class for long sounds (like entire songs, for example) because the
entire file is kept in memory.
To create an AudioSample you must use either the loadSample or createSample methods of the Minim class.
AudioSample also provides most of the same methods as AudioPlayer for controlling volume, panning, and so forth.
We now recommend using Sampler
class from the ugens package because it is more
full-featured than AudioSample
.
Modifier and Type | Field and Description |
---|---|
static int |
LEFT
int used to request the left channel of audio from the getChannel method.
|
static int |
RIGHT
int used to request the right channel of audio from the getChannel method.
|
left, mix, right
BALANCE, GAIN, MUTE, PAN, SAMPLE_RATE, VOLUME
Modifier | Constructor and Description |
---|---|
protected |
AudioSample(ddf.minim.spi.AudioOut output) |
Modifier and Type | Method and Description |
---|---|
abstract float[] |
getChannel(int channelNumber)
Gets the samples for the requested channel number as a float array.
|
abstract AudioMetaData |
getMetaData()
Get the AudioMetaData for this sample.
|
abstract int |
length()
Gets the length in milliseconds of this AudioSample.
|
abstract void |
stop()
Stops all sound being produced by this AudioSample.
|
abstract void |
trigger()
Triggers the sound to play once.
|
addEffect, addListener, bufferSize, clearEffects, close, disableEffect, disableEffect, effectCount, effects, enableEffect, enableEffect, getEffect, getFormat, hasEffect, isEffected, isEnabled, noEffects, removeEffect, removeEffect, removeListener, sampleRate, type
balance, gain, getBalance, getControl, getControls, getGain, getPan, getVolume, hasControl, isMuted, mute, pan, printControls, setBalance, setGain, setPan, setVolume, shiftBalance, shiftGain, shiftPan, shiftVolume, unmute, volume
public static final int LEFT
public static final int RIGHT
public abstract AudioMetaData getMetaData()
public abstract float[] getChannel(int channelNumber)
channelNumber
- int: the channel you want the samples forpublic abstract int length()
public abstract void trigger()
public abstract void stop()