public class AudioMixer extends AudioStream
AudioStream
s and mixes
then with some gain compensation into a single audio stream.Modifier and Type | Class and Description |
---|---|
static interface |
AudioMixer.MixEventListener
A listener for objects that wish to be informed of a mix event.
|
Constructor and Description |
---|
AudioMixer(AudioFormat af)
Default constructor that takes the format for the samples.
|
Modifier and Type | Method and Description |
---|---|
void |
addMixEventListener(AudioMixer.MixEventListener mel)
Add a mix event listener to this AudioMixer.
|
void |
addStream(AudioStream as,
float defaultGain)
Add an
AudioStream to this mixer. |
long |
getLength()
Returns the length of the audio stream in milliseconds.
|
SampleChunk |
nextSampleChunk()
Retrieve the next SampleChunk from the audio stream.
|
void |
removeMixEventListener(AudioMixer.MixEventListener mel)
Remove the given
AudioMixer.MixEventListener from this mixer. |
void |
removeStream(AudioStream as)
Remove the given audio stream from the mixer.
|
void |
reset()
Reset the audio stream.
|
void |
setAlwaysRun(boolean alwaysRun)
Whether to run the mixer when there are no audio streams to mix.
|
void |
setBufferSize(int bufferSize)
Set the size of the buffer that the mixer will mix.
|
void |
setMixEvents(boolean tf)
Whether to fire mix events or not (default is that the mixer doesn't)
|
void |
setTimecodeObject(AudioTimecode tc)
The timecode object
|
iterator, seek
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public AudioMixer(AudioFormat af)
af
- The AudioFormat
public void setTimecodeObject(AudioTimecode tc)
tc
- The timecode object.public void addStream(AudioStream as, float defaultGain)
AudioStream
to this mixer. It must conform to the same
format as this mixer. If not, an IllegalArgumentException
will be
thrown.as
- The AudioStream
to add to this mixer.defaultGain
- The default gain of this stream.public SampleChunk nextSampleChunk()
nextSampleChunk
in class AudioStream
AudioStream.nextSampleChunk()
public void reset()
reset
in class AudioStream
AudioStream.reset()
public void setBufferSize(int bufferSize)
bufferSize
- The buffer size in samples per channel.public void setAlwaysRun(boolean alwaysRun)
alwaysRun
- TRUE to make the mixer always run.public void addMixEventListener(AudioMixer.MixEventListener mel)
mel
- The AudioMixer.MixEventListener
to addpublic void removeMixEventListener(AudioMixer.MixEventListener mel)
AudioMixer.MixEventListener
from this mixer.mel
- The AudioMixer.MixEventListener
to removepublic long getLength()
getLength
in class AudioStream
AudioStream.getLength()
public void setMixEvents(boolean tf)
tf
- TRUE to fire mix events.public void removeStream(AudioStream as)
as
- The audio stream to remove