com.softsynth.jsyn
Class SynthCircuit

java.lang.Object
  extended by java.util.Observable
      extended by com.softsynth.jsyn.SynthObject
          extended by com.softsynth.jsyn.SynthSound
              extended by com.softsynth.jsyn.SynthCircuit
Direct Known Subclasses:
MultiTapDelay, PingSound, PoissonTrigger, Reverb1, SynthMixer, SynthNote, WindSound

public class SynthCircuit
extends SynthSound

SynthCircuits contain SynthUnits connected together to make a complex circuit or patch. The ports of the internal units can be exported with names and used by set() or connect().

Version:
JSyn Version 005
Author:
(C) 1997 Phil Burk, SoftSynth.com, All Rights Reserved
See Also:
Synth, SynthChannelData

Field Summary
 SynthOutput output
          Output of circuit.
 
Constructor Summary
SynthCircuit()
          Defaults to 8 initial sounds.
SynthCircuit(int numSounds)
           
SynthCircuit(SynthContext synthContext)
           
SynthCircuit(SynthContext synthContext, int numSounds)
           
 
Method Summary
 void add(SynthSound sound)
          Add this sound to internal vector of subUnits.
 void compile()
          Collect together the sounds added using add() into a circuit.
 void delete()
          Delete all subunits and then delete the circuit.
 int getPeer()
           
static SynthCircuit loadByName(java.lang.String name)
          Load a SynthCircuit by its name string.
 
Methods inherited from class com.softsynth.jsyn.SynthSound
addPort, addPort, findNamedPort, getName, getNumPorts, getPortAt, getPriority, setPriority, setStage, setStage, start, start, stop, stop
 
Methods inherited from class com.softsynth.jsyn.SynthObject
deleteAll, enableDeletionByGarbageCollector, enableTracking, getSynthContext, isTrackingEnabled, toString, track
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

output

public SynthOutput output
Output of circuit. May be left null by subclasses.

Constructor Detail

SynthCircuit

public SynthCircuit(SynthContext synthContext,
                    int numSounds)
             throws SynthException
Parameters:
numSounds - maximum number of sounds allowed in circuit
Throws:
SynthException - If memory allocation fails.

SynthCircuit

public SynthCircuit(SynthContext synthContext)
             throws SynthException
Throws:
SynthException

SynthCircuit

public SynthCircuit(int numSounds)
             throws SynthException
Throws:
SynthException

SynthCircuit

public SynthCircuit()
             throws SynthException
Defaults to 8 initial sounds.

Throws:
SynthException - If memory allocation fails.
Method Detail

add

public void add(SynthSound sound)
         throws SynthException
Add this sound to internal vector of subUnits. this will allow it to be automatically started, stopped, deleted.

Throws:
SynthException - If circuit already compiled by compile() or start() method.

getPeer

public int getPeer()
            throws SynthException
Overrides:
getPeer in class SynthObject
Returns:
peer. Compile if needed.
Throws:
SynthException - If compilation of circuit fails.

compile

public void compile()
             throws SynthException
Collect together the sounds added using add() into a circuit.

Throws:
SynthException - If any subunits are invalid.

delete

public void delete()
            throws SynthException
Delete all subunits and then delete the circuit.

Overrides:
delete in class SynthObject
Throws:
SynthException - If token already deleted.

loadByName

public static SynthCircuit loadByName(java.lang.String name)
Load a SynthCircuit by its name string. The circuit class must be in the CLASSPATH.

Note that because Class.newInstance() does not take any parameters, that circuits can only be loaded using the default Synth.getSharedContext().

Returns:
null if the class cannot be found or loaded.