diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 360b5d7d5..3f0e66186 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ April 24, 2008 +- Fixed: When an instrument's envelope runs out, it does not immediately ramp + to zero. Rather, it lets the remainder of the sample finish playing. - Fixed: When playing a MIDI file with EMIDI track designations to turn a track off, any ticks that had only events on the disabled track would cause the delay for that track to be thrown away, and the following notes on diff --git a/src/timidity/instrum.cpp b/src/timidity/instrum.cpp index 46f310083..338908623 100644 --- a/src/timidity/instrum.cpp +++ b/src/timidity/instrum.cpp @@ -31,6 +31,7 @@ #include "timidity.h" #include "m_swap.h" #include "files.h" +#include "templates.h" namespace Timidity { @@ -417,7 +418,8 @@ fail: for (j = 0; j < 6; j++) { sp->envelope_rate[j] = convert_envelope_rate(song, patch_data.EnvelopeRate[j]); - sp->envelope_offset[j] = convert_envelope_offset(patch_data.EnvelopeOffset[j]); + // GF1NEW clamps the offsets to the range [5,251], so we do too. + sp->envelope_offset[j] = convert_envelope_offset(clamp(patch_data.EnvelopeOffset[j], 5, 251)); } /* Then read the sample data */ diff --git a/src/timidity/mix.cpp b/src/timidity/mix.cpp index 8c004612f..cd0443a7a 100644 --- a/src/timidity/mix.cpp +++ b/src/timidity/mix.cpp @@ -43,8 +43,9 @@ int recompute_envelope(Voice *v) /* Envelope ran out. */ /* play sampled release */ v->status &= ~(VOICE_SUSTAINING | VOICE_LPE); - v->status |= VOICE_RELEASING | VOICE_STOPPING; - return 1; + v->status |= VOICE_RELEASING; + v->envelope_increment = 0; + return 0; } if (stage == RELEASE && !(v->status & VOICE_RELEASING) && (v->sample->modes & PATCH_SUSTAIN)) diff --git a/tools/updaterevision/updaterevision.vcproj b/tools/updaterevision/updaterevision.vcproj index c41849593..f3c1ebdf7 100644 --- a/tools/updaterevision/updaterevision.vcproj +++ b/tools/updaterevision/updaterevision.vcproj @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - -