From 6ce25fe6c3e5f7e1f80aa109b5b4e870931244b2 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 25 Apr 2008 01:28:06 +0000 Subject: [PATCH] - 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. SVN r938 (trunk) --- docs/rh-log.txt | 2 + src/timidity/instrum.cpp | 4 +- src/timidity/mix.cpp | 5 +- tools/updaterevision/updaterevision.vcproj | 158 ++++++++++----------- 4 files changed, 87 insertions(+), 82 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 360b5d7d5c..3f0e661860 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 46f310083e..338908623e 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 8c004612fe..cd0443a7ae 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 c418495936..f3c1ebdf7a 100644 --- a/tools/updaterevision/updaterevision.vcproj +++ b/tools/updaterevision/updaterevision.vcproj @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - -