[SCM] calf/master: + Organ: added proper (though controversial) release handling
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:37:10 UTC 2013
The following commit has been merged in the master branch:
commit fe779866f8bb9f5cab326cc18dbbd34df7f158cf
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Sun Apr 13 09:52:49 2008 +0000
+ Organ: added proper (though controversial) release handling
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@160 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/src/calf/organ.h b/src/calf/organ.h
index d8085b5..62db8bc 100644
--- a/src/calf/organ.h
+++ b/src/calf/organ.h
@@ -148,7 +148,8 @@ public:
}
void note_off(int /* vel */) {
- released = true;
+ for (int i = 0; i < EnvCount; i++)
+ envs[i].note_off();
}
void render_block();
diff --git a/src/calf/synth.h b/src/calf/synth.h
index ab1c49c..797fc05 100644
--- a/src/calf/synth.h
+++ b/src/calf/synth.h
@@ -244,10 +244,14 @@ public:
else
thisrelease = thiss / release_time;
}
- inline bool released()
+ inline bool released() const
{
return state == LOCKDECAY || state == RELEASE || state == STOP;
}
+ inline bool stopped() const
+ {
+ return state == STOP;
+ }
inline void note_on()
{
state = ATTACK;
diff --git a/src/organ.cpp b/src/organ.cpp
index f90390c..15faae0 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -622,17 +622,22 @@ void organ_voice::render_block() {
amp_pre[i] = 1.f;
amp_post[i] = 1.f;
}
+ bool any_running = false;
for (int i = 0; i < EnvCount; i++)
{
float pre = envs[i].value;
envs[i].advance();
int mode = fastf2i_drm(parameters->envs[i].ampctl);
+ if (!envs[i].stopped())
+ any_running = true;
if (mode == ampctl_none)
continue;
float post = envs[i].value;
amp_pre[mode - 1] *= pre;
amp_post[mode - 1] *= post;
}
+ if (!any_running)
+ released = true;
// calculate delta from pre and post
for (int i = 0; i < ampctl_count; i++)
amp_post[i] = (amp_post[i] - amp_pre[i]) * (1.0 / BlockSize);
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list