diff options
author | David Runge <dave@sleepmap.de> | 2021-01-01 21:36:58 +0100 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2021-01-01 21:36:58 +0100 |
commit | dc662a180174f1bf560fd46a1746d55098f17af6 (patch) | |
tree | 119d21f7a45cb3a403b8d0a5e1f4c197df058bf0 /classes | |
parent | 43c0ea0daafefd0b367ac8e7741e40ecb3750f25 (diff) | |
download | zzz-dc662a180174f1bf560fd46a1746d55098f17af6.tar.gz zzz-dc662a180174f1bf560fd46a1746d55098f17af6.tar.bz2 zzz-dc662a180174f1bf560fd46a1746d55098f17af6.tar.xz zzz-dc662a180174f1bf560fd46a1746d55098f17af6.zip |
Guard setSynchronous
classes/ZZZDevice.sc:
Guard all .setSynchronous calls with a check for server.hasShmInterface.
Set the default input amplitude of the gate to 1.0.
Add all heuristics at the top of addTempo.
Diffstat (limited to 'classes')
-rw-r--r-- | classes/ZZZDevice.sc | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/classes/ZZZDevice.sc b/classes/ZZZDevice.sc index b10a6b0..60206ed 100644 --- a/classes/ZZZDevice.sc +++ b/classes/ZZZDevice.sc @@ -61,15 +61,18 @@ ZZZDevice : ZZZ{ if(tempo < 0.0, { ZZZError("ZZZDevice: The provided tempo is not valid (needs to be >= 0.0).").throw; }); + if(tempos.at(slot).notNil, { + ZZZError("ZZZDevice: Cannot add tempo "++ tempo ++" in slot "++ slot ++". There is a TempoBusClock already.").throw; + }); - if(tempos.at(slot).isNil, { - ("Create new TempoBusClock in slot "++ slot++" with tempo "++tempo).postln; - tempoBusses.add(slot -> Bus.control()); + ("Create new TempoBusClock in slot "++ slot++" with tempo "++tempo).postln; + tempoBusses.add(slot -> Bus.control()); + if(super.server.hasShmInterface,{ tempoBusses.at(slot).setSynchronous(tempo); - tempos.add(slot -> TempoBusClock.new(control: tempoBusses.at(slot))); },{ - ZZZError("ZZZDevice: Cannot add tempo "++ tempo ++" in slot "++ slot ++". There is a TempoBusClock already.").throw; + tempoBusses.at(slot).set(tempo); }); + tempos.add(slot -> TempoBusClock.new(control: tempoBusses.at(slot))); } removeTempo{|slot, playType = \beat, quant = 1| @@ -112,7 +115,11 @@ ZZZDevice : ZZZ{ ZZZError("ZZZDevice: Cannot set tempo "++ tempo ++" at slot "++ slot ++". There is no TempoBusClock.").throw; }); - tempoBusses.at(slot).setSynchronous(tempo); + if(super.server.hasShmInterface,{ + tempoBusses.at(slot).setSynchronous(tempo); + },{ + tempoBusses.at(slot).set(tempo); + }); } addClock{ |output, slot, type = \zeroFive, playType = \beat, quant = 1, replace = false| @@ -213,7 +220,7 @@ ZZZDevice : ZZZ{ this.addClock(output: output, slot: slot, playType: playType, quant: quant, replace: true, type: type); } - addGate{ |output, input = 0.9| + addGate{ |output, input = 1.0| if(output.isNil || output.isInteger.not, { ZZZError("ZZZDevice: The provided output number is not valid (needs to be >= 1).").throw; }); @@ -231,7 +238,12 @@ ZZZDevice : ZZZ{ }); gateBusses.add(output -> Bus.control()); - gateBusses.at(output).setSynchronous(input); + + if(super.server.hasShmInterface,{ + gateBusses.at(output).setSynchronous(input); + },{ + gateBusses.at(output).set(input); + }); gates.add( output -> Synth(\ZZZGate, [\out, this.outputOnHardware(output: output), \bus, gateBusses.at(output)]).onFree({ gateBusses.removeAt(output); |