aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-05-29 20:51:52 +0200
committerDavid Runge <dave@sleepmap.de>2016-05-29 20:51:52 +0200
commit85c71e09ce3ab3ecf1acb92652b92c39bd63c6d2 (patch)
tree153ac28e27810f747562ffea0b055739b5f788f4
parent318e600239121c18359a612602c99964e6b03301 (diff)
downloadbowelyzer-85c71e09ce3ab3ecf1acb92652b92c39bd63c6d2.tar.gz
bowelyzer-85c71e09ce3ab3ecf1acb92652b92c39bd63c6d2.tar.bz2
bowelyzer-85c71e09ce3ab3ecf1acb92652b92c39bd63c6d2.tar.xz
bowelyzer-85c71e09ce3ab3ecf1acb92652b92c39bd63c6d2.zip
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).
-rw-r--r--BowelyzerAnalyzer.sc85
1 files 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 <synths;
- var <controls;
var <analyzerGroup;
var <monitoringGroup;
@@ -13,14 +11,13 @@ BowelyzerAnalyzer{
init{
arg config;
- this.config = config;
synths = Dictionary.new(config.at("names").size);
- controls = Dictionary.new(config.at("names").size);
- config.at("names").do({ |item, i|
- controls.putPairs([item, Dictionary.new(7)]);
- });
this.setupGroups;
- this.addAnalysisSynthsFromConfig(this.config);
+ this.addAnalysisSynthsFromConfig(config);
+ Routine{
+ 2.wait;
+ this.startSynthsFromConfig(config);
+ }.play;
}
// setup a synth group for the analyzers
@@ -35,10 +32,9 @@ BowelyzerAnalyzer{
addAnalysisSynthsFromConfig{
arg config;
config.at("names").size.do({|i|
- var name = config.at("names")[i],
- controls = config.at("controls").at(name);
+ var name = config.at("names")[i];
("Adding SynthDef '"++name++"' on input "++(i+config.at("channelOffset")[i])).postln;
- synths.add(name -> 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;