package rosshendler2604; import java.io.*; import com.softsynth.jsyn.*; /************** ** WARNING - this code automatically generated by Wire. ** The real source is probably a Wire patch. ** Do NOT edit this file unless you copy it to another directory and change the name. ** Otherwise it is likely to get clobbered the next time you ** export Java source code from Wire. ** ** Wire is available from: http://www.softsynth.com/wire/ */ public class PhilsDrumWoodFM extends SynthNote { // Declare units and ports. SineOscillator sinOsc; AddUnit add; EnvelopePlayer envPlay; EnvelopePlayer envPlay2; SineOscillator sinOsc2; SynthEnvelope envelope; SynthEnvelope envelope2; MultiplyUnit mult; public SynthInput mcratio; public SynthInput index; MultiplyUnit mult2; public PhilsDrumWoodFM() { this( Synth.getSharedContext() ); } public PhilsDrumWoodFM( SynthContext synthContext ) { super( synthContext ); // Create unit generators. frequency = new SynthDistributor( this, "frequency" ); add( sinOsc = new SineOscillator(synthContext) ); add( add = new AddUnit(synthContext) ); add( envPlay = new EnvelopePlayer(synthContext) ); add( envPlay2 = new EnvelopePlayer(synthContext) ); add( sinOsc2 = new SineOscillator(synthContext) ); double[] envelopeData = { 0.004767648244147845, 0.7583333333333333, 0.008235028785346281, 0.9875, 0.04767648244147846, 0.43333333333333335, 0.04897675014442787, 0.17083333333333334, 0.03294011514138513, 0.12916666666666668, 0.03163984743843572, 0.0375, 0.022195329529546476, 0.0, }; envelope = new SynthEnvelope( synthContext, envelopeData ); envelopeData = null; envelope.setSustainLoop( -1, -1 ); envelope.setReleaseLoop( -1, -1 ); double[] envelope2Data = { 0.0016291223352477191, 0.9583333333333334, 0.005498287881461053, 0.15, 0.006720129632896844, 0.04583333333333333, 0.02036402919059649, 0.0, }; envelope2 = new SynthEnvelope( synthContext, envelope2Data ); envelope2Data = null; envelope2.setSustainLoop( -1, -1 ); envelope2.setReleaseLoop( -1, -1 ); add( mult = new MultiplyUnit(synthContext) ); add( mult2 = new MultiplyUnit(synthContext) ); // Connect units and ports. frequency.connect( add.inputB); frequency.connect( mult.inputA); frequency.setup( 0.0, 349.22923456435507, 3000.0 ); addPort( amplitude = envPlay.amplitude, "amplitude" ); amplitude.setup( 0.0, 0.5, 1.0 ); addPort( output = sinOsc.output, "output" ); sinOsc.phase.set( 0, 0.049587398767471313 ); add.output.connect( sinOsc.frequency); envPlay.rate.set( 0, 1.0 ); envPlay.output.connect( sinOsc.amplitude); envPlay2.rate.set( 0, 1.0 ); envPlay2.output.connect( mult2.inputA); sinOsc2.phase.set( 0, 0.6213033199310303 ); sinOsc2.output.connect( add.inputA); mult.output.connect( sinOsc2.frequency); mult.output.connect( envPlay2.amplitude); addPort( mcratio = mult.inputB, "mcratio" ); mcratio.setup( 0.0, 0.6947156131384291, 20.0 ); addPort( index = mult2.inputB, "index" ); index.setup( 0.0, 22.296036648649608, 1.0 ); mult2.output.connect( sinOsc2.amplitude); } public void setStage( int time, int stage ) { switch( stage ) { case 0: envPlay.envelopePort.clear( time ); envPlay.envelopePort.queue( time, envelope, 0, envelope.getNumFrames(), Synth.FLAG_AUTO_STOP ); envPlay2.envelopePort.clear( time ); envPlay2.envelopePort.queueOn( time, envelope2 ); start( time ); break; case 1: envPlay.envelopePort.queueOff( time, envelope, true ); envPlay2.envelopePort.queueOff( time, envelope2 ); break; default: break; } } }