From 2a5a3d7035575262b47a9641d873f02762552fd2 Mon Sep 17 00:00:00 2001 From: Julian Rohrhuber Date: Sun, 16 Nov 2014 09:07:53 +0100 Subject: [PATCH 1/4] plugins: EnvGen and Linen check for prehistoric release message --- server/plugins/LFUGens.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/plugins/LFUGens.cpp b/server/plugins/LFUGens.cpp index d816c9c9173..e61183eea13 100644 --- a/server/plugins/LFUGens.cpp +++ b/server/plugins/LFUGens.cpp @@ -2703,6 +2703,8 @@ enum { void EnvGen_next_ak_nova(EnvGen *unit, int inNumSamples); #endif +static bool check_gate(EnvGen * unit, float prevGate, float gate, int & counter, double level, int counterOffset); + void EnvGen_Ctor(EnvGen *unit) { //Print("EnvGen_Ctor A\n"); @@ -2736,11 +2738,12 @@ void EnvGen_Ctor(EnvGen *unit) const int initialShape = (int32)*envPtr[2]; if (initialShape == shape_Hold) unit->m_level = *envPtr[0]; // we start at the end level; + check_gate(unit, 0.f, ZIN0(kEnvGen_gate), unit->m_counter, unit->m_level, 0); EnvGen_next_k(unit, 1); } -static inline bool check_gate(EnvGen * unit, float prevGate, float gate, int & counter, double level, int counterOffset = 0) +static bool check_gate(EnvGen * unit, float prevGate, float gate, int & counter, double level, int counterOffset = 0) { if (prevGate <= 0.f && gate > 0.f) { unit->m_stage = -1; @@ -3186,6 +3189,7 @@ void Linen_Ctor(Linen *unit) unit->m_level = 0.f; unit->m_stage = 4; unit->m_prevGate = 0.f; + if(ZIN0(0) <= -1.f) { unit->m_stage = 1; } // early release Linen_next_k(unit, 1); } From 0945701684a132a48f193634ca4cf30bc75f5d5b Mon Sep 17 00:00:00 2001 From: Julian Rohrhuber Date: Sun, 16 Nov 2014 13:16:37 +0100 Subject: [PATCH 2/4] class library: node proxy: avoid hanging notes When setting the source of a NodeProxy repeatedly and very quickly, the gate = 0 would arrive before the synth was actually running. Now this can be avoided by sending a release time (< -1.0). This fixes #1246. --- SCClassLibrary/JITLib/ProxySpace/ProxyInterfaces.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SCClassLibrary/JITLib/ProxySpace/ProxyInterfaces.sc b/SCClassLibrary/JITLib/ProxySpace/ProxyInterfaces.sc index abf04bb4105..534be59d871 100644 --- a/SCClassLibrary/JITLib/ProxySpace/ProxyInterfaces.sc +++ b/SCClassLibrary/JITLib/ProxySpace/ProxyInterfaces.sc @@ -232,7 +232,7 @@ SynthControl : AbstractPlayControl { stopToBundle { | bundle, fadeTime | if(nodeID.notNil) { if(canReleaseSynth) { - bundle.addAll([['/error', -1], [15, nodeID, \gate, 0.0, \fadeTime, fadeTime], ['/error', -2]]); + bundle.addAll([['/error', -1], [15, nodeID, \gate, -1.0 - fadeTime, \fadeTime, fadeTime], ['/error', -2]]); } { if(canFreeSynth.not) { //"/n_free" bundle.addAll([['/error', -1], [11, nodeID], ['/error', -2]]); From b573dfd328b3f51322d7ff7cf036e802aa3dcfe5 Mon Sep 17 00:00:00 2001 From: Julian Rohrhuber Date: Sun, 16 Nov 2014 18:53:20 +0100 Subject: [PATCH 3/4] class library: env release trick not needed anymore. This is the only potentially intrusive fix in this branch - EnvGate could, since it had the Impulse.ar(0) added to the gate input, be released with gate = 0 even in the same block the synth was created. This was added a while ago to avoid hanging synths in node proxy. Now it needs to be released with a gate <= -1 in the first block, and the node proxy does this. On the other hand, it can now be started with gate = 0 and started later. --- SCClassLibrary/Common/Control/GraphBuilder.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SCClassLibrary/Common/Control/GraphBuilder.sc b/SCClassLibrary/Common/Control/GraphBuilder.sc index 1025401714a..685eaff2f79 100644 --- a/SCClassLibrary/Common/Control/GraphBuilder.sc +++ b/SCClassLibrary/Common/Control/GraphBuilder.sc @@ -38,7 +38,7 @@ GraphBuilder { EnvGate { *new { arg i_level=1, gate, fadeTime, doneAction=2, curve='sin'; - var synthGate = gate ?? { NamedControl.kr(\gate, 1.0) + Impulse.kr(0) }; + var synthGate = gate ?? { NamedControl.kr(\gate, 1.0) }; var synthFadeTime = fadeTime ?? { NamedControl.kr(\fadeTime, 0.02) }; var startVal = (synthFadeTime <= 0); ^EnvGen.kr( From 174cc89f7e064ecb9244fa6c2543c23725bbc90c Mon Sep 17 00:00:00 2001 From: Julian Rohrhuber Date: Sun, 16 Nov 2014 20:55:19 +0100 Subject: [PATCH 4/4] plugins: no change was needed for EnvGen, only Linen failed. This commit undoes the call of check_gate in EnvGen_Ctor, as it is called in next_k anyway. --- server/plugins/LFUGens.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/server/plugins/LFUGens.cpp b/server/plugins/LFUGens.cpp index e61183eea13..194f7ee4dd2 100644 --- a/server/plugins/LFUGens.cpp +++ b/server/plugins/LFUGens.cpp @@ -2703,8 +2703,6 @@ enum { void EnvGen_next_ak_nova(EnvGen *unit, int inNumSamples); #endif -static bool check_gate(EnvGen * unit, float prevGate, float gate, int & counter, double level, int counterOffset); - void EnvGen_Ctor(EnvGen *unit) { //Print("EnvGen_Ctor A\n"); @@ -2738,7 +2736,6 @@ void EnvGen_Ctor(EnvGen *unit) const int initialShape = (int32)*envPtr[2]; if (initialShape == shape_Hold) unit->m_level = *envPtr[0]; // we start at the end level; - check_gate(unit, 0.f, ZIN0(kEnvGen_gate), unit->m_counter, unit->m_level, 0); EnvGen_next_k(unit, 1); }