jmslexamples.jsyn
Class SquareSineSawSynthNote
java.lang.Object
java.util.Observable
com.softsynth.jsyn.SynthObject
com.softsynth.jsyn.SynthSound
com.softsynth.jsyn.SynthCircuit
com.softsynth.jsyn.SynthNote
jmslexamples.jsyn.SquareSineSawSynthNote
- All Implemented Interfaces:
- OutputProvider
public class SquareSineSawSynthNote
- extends com.softsynth.jsyn.SynthNote
- implements OutputProvider
This SynthNote has three outputs: output, output2, and output3 each with one
part. JSyn does not support a single SynthOutput with multiple parts so we
implement OutputProvider interface and manage it on our own. The three outputs are:
output sends a sine osc, output2 sends a sawtooth osc, output3 sends a square osc.
The key idea is to implement OutputProvider and assign each SynthOutput to an index
Then you can hand this classname to SynthNoteAllPortsInstrument and its will create
an Instrument with three outputs. See ThreeOutputSynthNoteApplet
- Author:
- Nick Didkovsky, (c) 2004 Nick Didkovsky, All rights reserved,
didkovn@mail.rockefeller.edu
Field Summary |
com.softsynth.jsyn.SynthOutput |
output2
|
com.softsynth.jsyn.SynthOutput |
output3
|
com.softsynth.jsyn.SynthInput |
rate
|
Fields inherited from class com.softsynth.jsyn.SynthNote |
amplitude, frequency |
Fields inherited from class com.softsynth.jsyn.SynthCircuit |
output |
Method Summary |
int |
getNumOutputs()
OutputProvider interface, return 3 |
java.lang.Object |
getOutput()
OutputProvider interface , return getOutput(0) |
java.lang.Object |
getOutput(int n)
OutputProvider interface |
void |
setStage(int time,
int stage)
|
Methods inherited from class com.softsynth.jsyn.SynthNote |
note, noteOff, noteOn, noteOnFor |
Methods inherited from class com.softsynth.jsyn.SynthCircuit |
add, compile, delete, getPeer, loadByName |
Methods inherited from class com.softsynth.jsyn.SynthSound |
addPort, addPort, findNamedPort, getName, getNumPorts, getPortAt, getPriority, setPriority, 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 |
rate
public com.softsynth.jsyn.SynthInput rate
output2
public com.softsynth.jsyn.SynthOutput output2
output3
public com.softsynth.jsyn.SynthOutput output3
SquareSineSawSynthNote
public SquareSineSawSynthNote()
setStage
public void setStage(int time,
int stage)
- Overrides:
setStage
in class com.softsynth.jsyn.SynthSound
getOutput
public java.lang.Object getOutput(int n)
- OutputProvider interface
public Object getOutput(int n) {
Object outputToReturn = null;
switch (n) {
case 0:
outputToReturn = output;
break;
case 1:
outputToReturn = output2;
break;
case 2:
outputToReturn = output3;
break;
}
return outputToReturn;
}
- Specified by:
getOutput
in interface OutputProvider
getNumOutputs
public int getNumOutputs()
- OutputProvider interface, return 3
- Specified by:
getNumOutputs
in interface OutputProvider
getOutput
public java.lang.Object getOutput()
- OutputProvider interface , return getOutput(0)
- Specified by:
getOutput
in interface OutputProvider