stefandrissen / SAM-MOD-player

SAM MOD player, an Amiga MOD player for the SAM Coupé

Home Page:https://www.worldofsam.org/products/sam-mod-player

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New sample combined with tone portamento fails

stefandrissen opened this issue · comments

Something introduced in v2.38 is causing playback stutter when using SAA1099.

https://www.youtube.com/watch?v=ATM-p3yexro&t=183s

When using SAMdac as output, playback is fine.
When using v2.37, playback is fine.

Commit 6febc45 is responsible for worsening the 'stutter' - not sure why.

The stutter occurs on a row in channel 1 with tone portamento (effect 3 / slide to note) with parameter F0, even prior to worsened stutter, it does not sound right.

position 11 / pattern 0F:

13 D#2 1A C20
14 G#3 08 3F0 <-- nasty
15 B#2    C20
...
29 D#2 1A C20
30 G#3 08 300 <-- nasty
31 B#2    C20

toneportamento.zip

SAMdac output has the same issue when SAA1099 channel swaps are applied by commenting out ret nz in burstplayer.s:

;---------------------------------------------------------------
;swap channel 3 and 4 addresses if device is SAA

    ld a,(burstplayer.device)
    ld (bp.device),a
    cp device.saa
;    ret nz

With just channel 1 enabled, the note with tone portamento is sending the sample pointer to lower RAM:

image

This has two effects:

  1. garbage sample data is played back
  2. since RAM is contended and external RAM is not, the burstplayer timing is incorrect resulting in more timing issues.

Issue stripped down to a mod with just one channel and four notes:
toneportamento2.mod.zip

Issue caused by tone portamento combined with a new sample. Tone portamento on a sample already being played is fine.

The end of loop boundaries are set based on the new instrument, but the current pointers are not set, so the old pointers are still used. The loop detection detects out of bounds, calculates overshoot on based on new instrument and adds that to old instrument.