|
|
@ -71,7 +71,10 @@ int32_t Env::getsample() { |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
if (ix_ < 3 || ((ix_ < 4) && !down_)) { |
|
|
|
if (ix_ < 3 || ((ix_ < 4) && !down_)) { |
|
|
|
if (rising_) { |
|
|
|
if (staticcount_) { |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (rising_) { |
|
|
|
const int jumptarget = 1716; |
|
|
|
const int jumptarget = 1716; |
|
|
|
if (level_ < (jumptarget << 16)) { |
|
|
|
if (level_ < (jumptarget << 16)) { |
|
|
|
level_ = jumptarget << 16; |
|
|
|
level_ = jumptarget << 16; |
|
|
@ -83,9 +86,6 @@ int32_t Env::getsample() { |
|
|
|
advance(ix_ + 1); |
|
|
|
advance(ix_ + 1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (staticcount_) { |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { // !rising
|
|
|
|
else { // !rising
|
|
|
|
level_ -= inc_; |
|
|
|
level_ -= inc_; |
|
|
|
if (level_ <= targetlevel_) { |
|
|
|
if (level_ <= targetlevel_) { |
|
|
@ -126,7 +126,7 @@ void Env::advance(int newix) { |
|
|
|
qrate = min(qrate, 63); |
|
|
|
qrate = min(qrate, 63); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef ACCURATE_ENVELOPE |
|
|
|
#ifdef ACCURATE_ENVELOPE |
|
|
|
if (targetlevel_ == level_) { |
|
|
|
if (targetlevel_ == level_ || (ix_ == 0 && newlevel == 0)) { |
|
|
|
// approximate number of samples at 44.100 kHz to achieve the time
|
|
|
|
// approximate number of samples at 44.100 kHz to achieve the time
|
|
|
|
// empirically gathered using 2 TF1s, could probably use some double-checking
|
|
|
|
// empirically gathered using 2 TF1s, could probably use some double-checking
|
|
|
|
// and cleanup, but it's pretty close for now.
|
|
|
|
// and cleanup, but it's pretty close for now.
|
|
|
@ -134,6 +134,9 @@ void Env::advance(int newix) { |
|
|
|
staticrate += rate_scaling_; // needs to be checked, as well, but seems correct
|
|
|
|
staticrate += rate_scaling_; // needs to be checked, as well, but seems correct
|
|
|
|
staticrate = min(staticrate, 99); |
|
|
|
staticrate = min(staticrate, 99); |
|
|
|
staticcount_ = staticrate < 77 ? statics[staticrate] : 20 * (99 - staticrate); |
|
|
|
staticcount_ = staticrate < 77 ? statics[staticrate] : 20 * (99 - staticrate); |
|
|
|
|
|
|
|
if (staticrate < 77 && (ix_ == 0 && newlevel == 0)) { |
|
|
|
|
|
|
|
staticcount_ /= 20; // attack is scaled faster
|
|
|
|
|
|
|
|
} |
|
|
|
staticcount_ = (int)(((int64_t)staticcount_ * (int64_t)sr_multiplier) >> 24); |
|
|
|
staticcount_ = (int)(((int64_t)staticcount_ * (int64_t)sr_multiplier) >> 24); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|