From 63955c90f2c16dffb3e59d9d3e37b58387154cbf Mon Sep 17 00:00:00 2001 From: David Runge Date: Thu, 30 Jun 2016 12:59:39 +0200 Subject: BowelyzerAnalyzer.sc: Extending startSynthWithNameAndControls by conditional on \active state of the input and thus whether to start it normally or paused. --- BowelyzerAnalyzer.sc | 75 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 23 deletions(-) diff --git a/BowelyzerAnalyzer.sc b/BowelyzerAnalyzer.sc index f6ad54e..39728bd 100644 --- a/BowelyzerAnalyzer.sc +++ b/BowelyzerAnalyzer.sc @@ -118,32 +118,61 @@ BowelyzerAnalyzer{ }); } + // add and start the Synth with name, controls and input channel startSynthWithNameAndControls{ arg name, controls, input; - synths.add(name -> Synth( - name, - [ - inputChannel: input, - sendReplyFreq: controls.at(\sendReplyFreq), - amplitudeAttackTime: controls.at(\amplitudeAttackTime), - amplitudeReleaseTime: controls.at(\amplitudeReleaseTime), - hfHainsworth: controls.at(\hfhainsworth), - hfFoote: controls.at(\hfFoote), - hfThreshold: controls.at(\hfThreshold), - hfWaitTime: controls.at(\hfWaitTime), - pitchInitFreq: controls.at(\pitchInitFreq), - pitchMinFreq: controls.at(\pitchMinFreq), - pitchMaxFreq: controls.at(\pitchMaxFreq), - pitchExecFreq: controls.at(\pitchExecFreq), - pitchMaxBinsPerOctave: controls.at(\pitchMaxBinsPerOctave), - pitchMedian: controls.at(\pitchMedian), - pitchAmpThreshold: controls.at(\pitchAmpThreshold), - pitchPeakThreshold: controls.at(\pitchPeakThreshold), - pitchDownSample: controls.at(\pitchDownSample) - ], - analyzerGroup + // if the input is set to active, start right away, else pause + if(controls.at(\active),{ + synths.add(name -> Synth.new( + name, + [ + inputChannel: input, + sendReplyFreq: controls.at(\sendReplyFreq), + amplitudeAttackTime: controls.at(\amplitudeAttackTime), + amplitudeReleaseTime: controls.at(\amplitudeReleaseTime), + hfHainsworth: controls.at(\hfhainsworth), + hfFoote: controls.at(\hfFoote), + hfThreshold: controls.at(\hfThreshold), + hfWaitTime: controls.at(\hfWaitTime), + pitchInitFreq: controls.at(\pitchInitFreq), + pitchMinFreq: controls.at(\pitchMinFreq), + pitchMaxFreq: controls.at(\pitchMaxFreq), + pitchExecFreq: controls.at(\pitchExecFreq), + pitchMaxBinsPerOctave: controls.at(\pitchMaxBinsPerOctave), + pitchMedian: controls.at(\pitchMedian), + pitchAmpThreshold: controls.at(\pitchAmpThreshold), + pitchPeakThreshold: controls.at(\pitchPeakThreshold), + pitchDownSample: controls.at(\pitchDownSample) + ], + analyzerGroup + ).register; + ); + },{ + synths.add(name -> Synth.newPaused( + name, + [ + inputChannel: input, + sendReplyFreq: controls.at(\sendReplyFreq), + amplitudeAttackTime: controls.at(\amplitudeAttackTime), + amplitudeReleaseTime: controls.at(\amplitudeReleaseTime), + hfHainsworth: controls.at(\hfhainsworth), + hfFoote: controls.at(\hfFoote), + hfThreshold: controls.at(\hfThreshold), + hfWaitTime: controls.at(\hfWaitTime), + pitchInitFreq: controls.at(\pitchInitFreq), + pitchMinFreq: controls.at(\pitchMinFreq), + pitchMaxFreq: controls.at(\pitchMaxFreq), + pitchExecFreq: controls.at(\pitchExecFreq), + pitchMaxBinsPerOctave: controls.at(\pitchMaxBinsPerOctave), + pitchMedian: controls.at(\pitchMedian), + pitchAmpThreshold: controls.at(\pitchAmpThreshold), + pitchPeakThreshold: controls.at(\pitchPeakThreshold), + pitchDownSample: controls.at(\pitchDownSample) + ], + analyzerGroup + ).register; ); - ); + }); } // set a synth control by provoding its name, its control name and control value -- cgit v1.2.3-54-g00ecf