com.softsynth.jsyn.util
Class BussedVoiceAllocator
java.lang.Object
com.softsynth.jsyn.util.VoiceAllocator
com.softsynth.jsyn.util.BussedVoiceAllocator
public abstract class BussedVoiceAllocator
- extends VoiceAllocator
Voice Allocator that mixes the voice onto a bus using a BusWriter.
Uses an abstract method makeVoice() which the user must define in a subclass.
Here is an example of how to define makeVoice from TJ_PlayKeys1.
It creates an allocator with a maximum of 4 voices. When a new voice is required,
it is created using the method below.
BussedVoiceAllocator ringAllocator = new BussedVoiceAllocator( 4 )
{
public SynthCircuit makeVoice() throws SynthException
{
SynthNote circ = new RingModBell();
return addVoiceToMix( circ ); // mix through bus writer
}
};
Mixed result can be obtained from a SynthOutput port obtained using getOutput()
or the public member "output".
- Author:
- (C) 1997 Phil Burk, SoftSynth.com, All Rights Reserved
- See Also:
com.softsynth.jsyn.examples.TJ_PlayKeys1
,
BusWriter
Methods inherited from class com.softsynth.jsyn.util.VoiceAllocator |
allocate, allocate, allocate, allocate, free, free, getMaxVoices, getNthVoice, getNumVoices, makeVoice, steal, steal, steal, steal, stop, stop |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
output
public SynthOutput output
BussedVoiceAllocator
public BussedVoiceAllocator(SynthContext synthContext,
int maxVoices)
BussedVoiceAllocator
public BussedVoiceAllocator(int maxVoices)
addVoiceToMix
public SynthCircuit addVoiceToMix(SynthCircuit circuit)
throws SynthException
- This connect the output defined in SynthCircuit to the bus using a BusWriter.
If you get a NullPointerException here it may be because you declared output in your subclass,
or you forgot to connect the output in your circuit.
- Parameters:
circuit
-
- Returns:
-
- Throws:
SynthException
getOutput
public SynthOutput getOutput()
delete
public void delete()
- Calls clear() and also deletes the busReader.
- Overrides:
delete
in class VoiceAllocator
clear
public void clear()
- Delete all of the allocated voices and their busWriters.
- Overrides:
clear
in class VoiceAllocator