From cfaecc12a3088979370dc6c0ca7e90fe805c142c Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 8 Feb 2013 01:33:01 +0000 Subject: [PATCH] Update DUMB to revision 73da922bddede1f81fffc7e5e895cace755b378d - Implemented support for the obscure S9F sample reverse effect SVN r4115 (trunk) --- dumb/include/internal/it.h | 1 + dumb/src/it/itrender.c | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/dumb/include/internal/it.h b/dumb/include/internal/it.h index 1ab5d3b27..922d9bed0 100644 --- a/dumb/include/internal/it.h +++ b/dumb/include/internal/it.h @@ -467,6 +467,7 @@ struct IT_PLAYING_ENVELOPE #define IT_PLAYING_SUSTAINOFF 2 #define IT_PLAYING_FADING 4 #define IT_PLAYING_DEAD 8 +#define IT_PLAYING_REVERSE 16 struct IT_PLAYING { diff --git a/dumb/src/it/itrender.c b/dumb/src/it/itrender.c index 11433e192..739ced68f 100644 --- a/dumb/src/it/itrender.c +++ b/dumb/src/it/itrender.c @@ -905,6 +905,15 @@ static void it_pickup_stop_at_end(DUMB_RESAMPLER *resampler, void *data) +static void it_pickup_stop_after_reverse(DUMB_RESAMPLER *resampler, void *data) +{ + (void)data; + + resampler->dir = 0; +} + + + static void it_playing_update_resamplers(IT_PLAYING *playing) { if ((playing->sample->flags & IT_SAMPLE_SUS_LOOP) && !(playing->flags & IT_PLAYING_SUSTAINOFF)) { @@ -925,8 +934,13 @@ static void it_playing_update_resamplers(IT_PLAYING *playing) playing->resampler.pickup = &it_pickup_pingpong_loop; else playing->resampler.pickup = &it_pickup_loop; - } else { - if (playing->sample->flags & IT_SAMPLE_SUS_LOOP) + } else if (playing->flags & IT_PLAYING_REVERSE) { + playing->resampler.start = 0; + playing->resampler.end = playing->sample->length; + playing->resampler.dir = -1; + playing->resampler.pickup = &it_pickup_stop_after_reverse; + } else { + if (playing->sample->flags & IT_SAMPLE_SUS_LOOP) playing->resampler.start = playing->sample->sus_loop_start; else playing->resampler.start = 0; @@ -2753,7 +2767,13 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than channel->playing->panbrello_depth = 0; break; case IT_S_SET_SURROUND_SOUND: - if ((effectvalue & 15) == 1) { + if ((effectvalue & 15) == 15) { + if (channel->playing && channel->playing->sample && + !(channel->playing->sample->flags & (IT_SAMPLE_LOOP | IT_SAMPLE_SUS_LOOP))) { + channel->playing->flags |= IT_PLAYING_REVERSE; + it_playing_reset_resamplers( channel->playing, channel->playing->sample->length - 1 ); + } + } else if ((effectvalue & 15) == 1) { channel->pan = IT_SURROUND; channel->truepan = channel->pan << IT_ENVELOPE_SHIFT; }