com.jsyn.util
Class VoiceAllocator
java.lang.Object
com.jsyn.util.VoiceAllocator
public class VoiceAllocator
- extends java.lang.Object
Allocate voices based on an integer tag. The tag could, for example, be a
MIDI note number. When new voices are needed, they are created using the
VoiceFactory. If no new voices are available then a voice in use will be
stolen.
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VoiceAllocator
public VoiceAllocator(int max)
setVoiceFactory
public void setVoiceFactory(VoiceFactory factory)
getVoiceFactory
public VoiceFactory getVoiceFactory()
getMaxVoices
public int getMaxVoices()
allocate
public UnitVoice allocate(int tag)
- Allocate a Voice associated with this tag. It will first pick a voice
already assigned to that tag. Next it will pick the oldest voice that is
off. Next it will pick the oldest voice that is on. If no voices are
allocated it will create a new voice.
- Parameters:
tag
-
- Returns:
- Voice that is most
isOn
public boolean isOn(int tag)
off
public UnitVoice off(int tag)
allOff
public java.util.Collection<UnitVoice> allOff()
- Turn all the voices off and return the ones that were on.