From 8f1d76bd929dcc75a13bcba39160d646605b73b2 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Fri, 23 Jan 2015 17:09:37 -0800 Subject: [PATCH] Updated playptmod and modplay --- Frameworks/modplay/modplay/ft2play.c | 6 ++++ Frameworks/modplay/modplay/st3play.c | 6 ++++ Frameworks/playptmod/playptmod/playptmod.c | 36 ++++++++++++++++++---- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Frameworks/modplay/modplay/ft2play.c b/Frameworks/modplay/modplay/ft2play.c index 41a7539ba..b9e076bca 100644 --- a/Frameworks/modplay/modplay/ft2play.c +++ b/Frameworks/modplay/modplay/ft2play.c @@ -2210,6 +2210,8 @@ static void MainPlayer(PLAYER *p) /* periodically called from mixer */ resampler_dup_inplace(p->resampler[SPARE_OFFSET + ChNr], p->resampler[ChNr]); resampler_dup_inplace(p->resampler[TOTAL_VOICES + SPARE_OFFSET + ChNr], p->resampler[TOTAL_VOICES + ChNr]); + resampler_clear(p->resampler[ChNr]); + resampler_clear(p->resampler[TOTAL_VOICES + ChNr]); } #endif @@ -3744,6 +3746,7 @@ void ft2play_RenderFixed32(void *_p, int32_t *buffer, int32_t count, int8_t dept float sample; assert(sizeof(int32_t) == sizeof(float)); ft2play_RenderFloat(_p, fbuffer, count); + if (buffer) for (i = 0; i < count * 2; ++i) { sample = fbuffer[i] * scale; @@ -3759,6 +3762,9 @@ void ft2play_RenderFixed16(void *_p, int16_t *buffer, int32_t count, int8_t dept float scale = (float)(1 << (depth - 1)); float sample; float fbuffer[1024]; + if (!buffer) + ft2play_RenderFloat(_p, 0, count); + else while (count) { SamplesTodo = (count < 512) ? count : 512; diff --git a/Frameworks/modplay/modplay/st3play.c b/Frameworks/modplay/modplay/st3play.c index 2df4c86d2..b338f8c56 100644 --- a/Frameworks/modplay/modplay/st3play.c +++ b/Frameworks/modplay/modplay/st3play.c @@ -1048,6 +1048,8 @@ static inline void doamiga(PLAYER *p, uint8_t ch) setvol(p, ch, 32, 0); resampler_dup_inplace(p->resampler[ch + 32], p->resampler[ch]); resampler_dup_inplace(p->resampler[ch + 32 + 64], p->resampler[ch + 64]); + resampler_clear(p->resampler[ch]); + resampler_clear(p->resampler[ch + 64]); if (p->chn[ch].vol != 255) { if (p->chn[ch].vol <= 64) @@ -3845,6 +3847,7 @@ void st3play_RenderFixed32(void *_p, int32_t *buffer, int32_t count, int8_t dept float sample; assert(sizeof(int32_t) == sizeof(float)); st3play_RenderFloat(_p, fbuffer, count); + if (buffer) for (i = 0; i < count * 2; ++i) { sample = fbuffer[i] * scale; @@ -3860,6 +3863,9 @@ void st3play_RenderFixed16(void *_p, int16_t *buffer, int32_t count, int8_t dept float scale = (float)(1 << (depth - 1)); float sample; float fbuffer[1024]; + if (!buffer) + st3play_RenderFloat(_p, 0, count); + else while (count) { SamplesTodo = (count < 512) ? count : 512; diff --git a/Frameworks/playptmod/playptmod/playptmod.c b/Frameworks/playptmod/playptmod/playptmod.c index 13683ce11..c08d7181c 100644 --- a/Frameworks/playptmod/playptmod/playptmod.c +++ b/Frameworks/playptmod/playptmod/playptmod.c @@ -1,6 +1,10 @@ /* -** - playptmod v1.15b - 29th of September 2014 - -** This is the foobar2000 version, with code by kode54 +** - playptmod v1.16 - 23rd of January 2015 - +** This is the foobar2000 version, with added code by kode54 +** +** Changelog from 1.15b: +** - Glissando (3xx/5xy) should not continue after its slide was done, +** but this only applies to MODs playing in ProTracker mode. ** ** Changelog from 1.15a: ** - Added a hack to find out what 8xx pan is used (7-bit/8-bit) @@ -131,6 +135,7 @@ typedef struct unsigned char invertLoopDelay; unsigned char invertLoopSpeed; unsigned char chanIndex; + unsigned char doGlissando; short period; short tempPeriod; int noNote; @@ -1861,22 +1866,30 @@ static void handleGlissando(player *p, mod_channel *ch) char h; short *tablePointer; + + // quirk for glissando in PT mode + if ((p->minPeriod == PT_MIN_PERIOD) && !ch->doGlissando) + return; if (p->tempPeriod > 0) { if (ch->period < ch->tempPeriod) { ch->period += ch->glissandoSpeed; - - if (ch->period > ch->tempPeriod) + if (ch->period >= ch->tempPeriod) + { ch->period = ch->tempPeriod; + ch->doGlissando = false; + } } else { ch->period -= ch->glissandoSpeed; - - if (ch->period < ch->tempPeriod) + if (ch->period <= ch->tempPeriod) + { ch->period = ch->tempPeriod; + ch->doGlissando = false; + } } if (ch->glissandoControl != 0) @@ -2488,6 +2501,17 @@ static void fetchPatternData(player *p, mod_channel *ch) ch->tempPeriod = (p->minPeriod == PT_MIN_PERIOD) ? rawAmigaPeriods[(ch->fineTune * 37) + tempNote] : extendedRawPeriods[(ch->fineTune * 85) + tempNote]; ch->flags |= FLAG_NOTE; } + + // 3xx/5xy quirk for PT MODs + if (p->minPeriod == PT_MIN_PERIOD) + { + if ((ch->command == 0x03) || (ch->command == 0x05)) + { + ch->doGlissando = true; + if (!ch->period || (ch->period == ch->tempPeriod)) + ch->doGlissando = false; + } + } } else {