public class RTMixer extends java.lang.Object implements AudioChainListener
Modifier and Type | Field and Description |
---|---|
protected int |
channels
The number of channels to be used when setting up SourceDataLine
|
protected double |
controlRate
The control rate is used to set how often in instrument returns a full
buffer of audio samples.
|
long |
currentTime
A Timer which keeps track of how many samples have been written since
this object started
|
protected int |
sampleRate
The sampleRate to be used when establishing the JMF SourceDataLine
|
Constructor and Description |
---|
RTMixer(RTLine[] rtlines)
The RTMixer constructor sets a number of attributes and opens a JMF java
sound sourceDataLine.
|
RTMixer(RTLine[] rtlines,
double controlRate)
The RTMixer constructor sets a number of attributes and opens a JMF java
sound sourceDataLine.
|
Modifier and Type | Method and Description |
---|---|
void |
actionLines(java.lang.Object obj,
int actionNumber)
This method passes on external action requests (i.e.
|
void |
addLines(RTLine[] lines) |
void |
begin()
Begin starts RTMixer.
|
void |
controlChange(float[] buffer,
int returned,
boolean finished)
The controlChange method is called every time an instrument fills a
sample buffer.
|
void |
finalize() |
void |
pause()
Pauses RTMixer playback.
|
void |
stop()
Stops RTMixer playback.
|
void |
unPause()
Continues the RTMixer playback.
|
protected int sampleRate
protected int channels
public long currentTime
protected double controlRate
public RTMixer(RTLine[] rtlines)
inst
- the Instruments to be processed by this object.public RTMixer(RTLine[] rtlines, double controlRate)
inst
- - The Instruments to be processed by this object.controlRate
- - Sets the regularity of audio parameter change.
The control rate is used to set how often in instrument returns a full
buffer of audio samples. This is acheived by changing the size of the
instrument buffers. Control rate is critical to the audio performance and can be tuned to the suit different computers. Smaller values are prefereable because the resulting smaller buffer equates to a less latency, but values that are too small will cause the audio system to choke and splutter. Values typically fall in the rage 0.01 - 0.005.
public void addLines(RTLine[] lines)
public void controlChange(float[] buffer, int returned, boolean finished)
controlChange
in interface AudioChainListener
buffer
- a sample array filled by an instrumentreturned
- the number of samples in the bufferfinished
- indicates whether the instruments current note is
finished or not.public void begin()
public void pause()
public void unPause()
public void stop()
public void actionLines(java.lang.Object obj, int actionNumber)
obj
- an unspecified object type (externalAction will cast)actionNumber
- an indentifyer for the originator of the action
request (i.e. if there are three buttons there would actionNumbers 1,2
and 3)public void finalize()
finalize
in class java.lang.Object