Permalink
Browse files

bugfix: keyboard initialisation with default args

rather than defining default args in the instance vars define them in
*new. Otherwise, if no default args are given instance vars are set to
nil.

Signed-off-by: Stefan Nussbaumer <st9fan@gmail.com>
  • Loading branch information...
nuss committed Aug 4, 2018
1 parent 3971a1c commit 88f9ac19da8b0dc4ab5529a4148dbea2ed4b3beb
Showing with 5 additions and 13 deletions.
  1. +5 −13 CVCenter/CVCenterKeyboard.sc
@@ -1,10 +1,10 @@
CVCenterKeyboard {
classvar <all;
var <synthDefName, <keyboardArg = \freq, <velocArg = \veloc, <bendArg = \bend;
var <synthDefName, <keyboardArg, <velocArg, <bendArg;
var on, off, bend;
*new { |synthDefName|
^super.newCopyArgs(synthDefName).init;
*new { |synthDefName, keyboardArg = \freq, velocArg = \veloc, bendArg = \bend|
^super.newCopyArgs(synthDefName, keyboardArg, velocArg, bendArg).init;
}
init {
@@ -30,7 +30,7 @@ CVCenterKeyboard {
// keyboardArg is the arg that will be set through playing the keyboard
// bendArg will be the arg that's set through the pitch bend wheel
setUpControls { |keyboardControl, velocControl, bendControl, widgetsPrefix, tab, server|
setUpControls { |tab, widgetsPrefix, keyboardControl, velocControl, bendControl, server|
var testSynth, notesEnv;
var args = [];
@@ -47,10 +47,6 @@ CVCenterKeyboard {
CVCenter.scv.put(synthDefName, Array.newClear(128));
};
/*if (server.serverRunning.not) {
Error("The server '%' must be running before calling CVCenter:*midiKeyboardGated").throw;
};*/
tab ?? { tab = synthDefName };
server ?? { server = Server.default };
@@ -66,10 +62,6 @@ CVCenterKeyboard {
).throw;
};
/*args = SynthDescLib.at(synthDefName).controlDict.keys.asArray.takeThese({ |it|
it === keyboardArg or: { it === velocArg or: { it === bendArg or: { it === \gate }}}
});*/
server.waitForBoot {
// SynthDef *should* have an \amp arg, otherwise it will sound for moment
testSynth = Synth(synthDefName);
@@ -116,7 +108,7 @@ CVCenterKeyboard {
on = MIDIFunc.noteOn({ |veloc, num, chan, src|
var argsValues = [keyboardArg, num.midicps, velocArg, veloc * 0.005] ++ namesCVs.deepCollect(2, _.value);
// "on".postln;
// "on: %\n".postf(argsValues);
CVCenter.scv[synthDefName][num] = Synth(synthDefName, argsValues);
});

0 comments on commit 88f9ac1

Please sign in to comment.