public class VoiceAllocator extends java.lang.Object implements Instrument
Constructor and Description |
---|
VoiceAllocator(UnitVoice[] voices)
Create an allocator for the array of UnitVoices.
|
Modifier and Type | Method and Description |
---|---|
void |
allNotesOff(TimeStamp timeStamp)
Turn off all the note currently on.
|
protected UnitVoice |
allocate(int tag)
Allocate a Voice associated with this tag.
|
Synthesizer |
getSynthesizer() |
int |
getVoiceCount() |
protected boolean |
isOn(int tag) |
void |
noteOff(int tag,
TimeStamp timeStamp)
Turn off the voice associated with the given tag if allocated.
|
void |
noteOn(int tag,
double frequency,
double amplitude,
TimeStamp timeStamp)
Play a note on the voice and associate it with the given tag.
|
void |
noteOn(int tag,
double frequency,
double amplitude,
VoiceOperation operation,
TimeStamp timeStamp)
Play a note on the voice and associate it with the given tag.
|
protected UnitVoice |
off(int tag) |
void |
setPort(int tag,
java.lang.String portName,
double value,
TimeStamp timeStamp)
Set a port on the voice associated with the given tag if allocated.
|
void |
usePreset(int presetIndex,
TimeStamp timeStamp) |
public VoiceAllocator(UnitVoice[] voices)
voices
- public Synthesizer getSynthesizer()
public int getVoiceCount()
protected UnitVoice allocate(int tag)
tag
- protected boolean isOn(int tag)
protected UnitVoice off(int tag)
public void allNotesOff(TimeStamp timeStamp)
allNotesOff
in interface Instrument
public void noteOn(int tag, double frequency, double amplitude, TimeStamp timeStamp)
noteOn
in interface Instrument
public void noteOn(int tag, double frequency, double amplitude, VoiceOperation operation, TimeStamp timeStamp)
public void noteOff(int tag, TimeStamp timeStamp)
noteOff
in interface Instrument
public void setPort(int tag, java.lang.String portName, double value, TimeStamp timeStamp)
setPort
in interface Instrument
public void usePreset(int presetIndex, TimeStamp timeStamp)
usePreset
in interface Instrument