mirror of https://github.com/AxioDL/amuse.git
Fix unwanted cutoff bug
This commit is contained in:
parent
7719459ac7
commit
d80f1346bb
|
@ -27,7 +27,7 @@ public:
|
|||
void keyOff();
|
||||
float advance(double dt, const Voice& vox);
|
||||
float advance(double dt);
|
||||
bool isComplete() const { return m_phase == State::Complete; }
|
||||
bool isComplete(const Voice& vox) const;
|
||||
bool isAdsrSet() const { return m_adsrSet; }
|
||||
};
|
||||
} // namespace amuse
|
||||
|
|
|
@ -51,6 +51,9 @@ void Envelope::keyOff() {
|
|||
}
|
||||
|
||||
float Envelope::advance(double dt, const Voice& vox) {
|
||||
if (!m_adsrSet && !vox.m_state.m_useAdsrControllers)
|
||||
return 1.f;
|
||||
|
||||
double thisTime = m_curTime;
|
||||
m_curTime += dt;
|
||||
|
||||
|
@ -131,6 +134,9 @@ float Envelope::advance(double dt, const Voice& vox) {
|
|||
}
|
||||
|
||||
float Envelope::advance(double dt) {
|
||||
if (!m_adsrSet)
|
||||
return 1.f;
|
||||
|
||||
double thisTime = m_curTime;
|
||||
m_curTime += dt;
|
||||
|
||||
|
@ -196,4 +202,8 @@ float Envelope::advance(double dt) {
|
|||
return 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
bool Envelope::isComplete(const Voice& vox) const {
|
||||
return (m_adsrSet || vox.m_state.m_useAdsrControllers) && m_phase == State::Complete;
|
||||
}
|
||||
} // namespace amuse
|
||||
|
|
|
@ -87,7 +87,7 @@ bool Voice::_checkSamplePos(bool& looped) {
|
|||
}
|
||||
|
||||
/* Looped samples issue sample end when ADSR envelope complete */
|
||||
if (m_volAdsr.isComplete()) {
|
||||
if (m_volAdsr.isComplete(*this)) {
|
||||
_macroSampleEnd();
|
||||
m_curSample = nullptr;
|
||||
return true;
|
||||
|
@ -456,7 +456,7 @@ void Voice::preSupplyAudio(double dt) {
|
|||
}
|
||||
|
||||
if (dead && (!m_curSample || m_voxState == VoiceState::KeyOff) && m_sampleEndTrap.macroId == 0xffff &&
|
||||
m_messageTrap.macroId == 0xffff && (!m_curSample || (m_curSample && m_volAdsr.isComplete()))) {
|
||||
m_messageTrap.macroId == 0xffff && (!m_curSample || (m_curSample && m_volAdsr.isComplete(*this)))) {
|
||||
m_voxState = VoiceState::Dead;
|
||||
m_backendVoice->stop();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue