From 85c71e09ce3ab3ecf1acb92652b92c39bd63c6d2 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 29 May 2016 20:51:52 +0200 Subject: BowelyzerAnalyzer.sc: Making local versions of controls and config obsolete. Moving setting of configuration to BowelyzerConfig.sc. Dividing the creation of SynthDefs and Synths by introducing a Routine in init. Now the SynthDefs are created with empty parameters on the server and called with proper parameters from the config, when the Synth is actually created (and added to the synths Dictionary). --- BowelyzerAnalyzer.sc | 85 +++++++++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 47 deletions(-) diff --git a/BowelyzerAnalyzer.sc b/BowelyzerAnalyzer.sc index f6dda05..bccc733 100644 --- a/BowelyzerAnalyzer.sc +++ b/BowelyzerAnalyzer.sc @@ -1,8 +1,6 @@ BowelyzerAnalyzer{ - var <>config; var SynthDef(name, { + SynthDef(name, { arg sendReplyFreq, amplitudeAttackTime, amplitudeReleaseTime, @@ -90,50 +86,45 @@ BowelyzerAnalyzer{ '/'++config.at("names")[i].asSymbol, [amplitude, pitch, hasPitch, detect] ); - }).play( - target: analyzerGroup, - args: //arguments to the Synth. Order matters! + }).add; + }); + } + + startSynthsFromConfig{ + arg config; + config.at("names").do({|name, i| + var controls = config.at("controls").at(name); + postln("Synths: "++name++" at "++i); + synths.add(name -> Synth( + name, [ - controls.at("sendReplyFreq"), - controls.at("amplitudeAttackTime"), - controls.at("amplitudeReleaseTime"), - controls.at("hfHainsworth"), - controls.at("hfFoote"), - controls.at("hfThreshold"), - controls.at("hfWaitTime"), - controls.at("pitchInitFreq"), - controls.at("pitchMinFreq"), - controls.at("pitchMaxFreq"), - controls.at("pitchExecFreq"), - controls.at("pitchMaxBinsPerOctave"), - controls.at("pitchMedian"), - controls.at("pitchAmpThreshold"), - controls.at("pitchPeakThreshold"), - controls.at("pitchDownSample") - ] - ) + 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 + ); ); }); } - setAnalysisSynthControl{ + setSynthControl{ arg name, control; - controls.at(name).put(control[0], control[1]); synths.at(name).set(control[0], control[1]); } -//TODO: get all this from BowelyzerConfig - getAnalysisSynthControl{ - arg name, control; - synths.at(name).get( - control, - { - arg value; - controls.at(name).put(control, value); - } - ); - //TODO: wait for the control to be set - ^controls.at(name.asSymbol).at(control.asSymbol); - } startAnalysisSynth{ arg name; -- cgit v1.2.3-54-g00ecf