From eecc39834949e6affbf3268cb5405a296cd12216 Mon Sep 17 00:00:00 2001 From: Javier Degirolmo Date: Mon, 22 Apr 2013 05:30:00 -0300 Subject: Now you can change the sample rate of PCM instruments --- src-z80/player/pcm.z80 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src-z80/player') diff --git a/src-z80/player/pcm.z80 b/src-z80/player/pcm.z80 index 18527d9..b5a4434 100644 --- a/src-z80/player/pcm.z80 +++ b/src-z80/player/pcm.z80 @@ -239,3 +239,30 @@ LockChannelPCM: call StopPCM ; Stop PCM playback jp ProcessSFXRun ; End of subroutine + +;**************************************************************************** +; SetPCMRate [command $07] +; Changes the sample rate of PCM +;**************************************************************************** + +SetPCMRate: + ld a, (RAM_ComBank) ; Get new rate + cpl + ld b, a + + xor a ; Parsed command already + ld (RAM_Command), a + + ld a, b ; Set high bits of timer + ld (ix+0), $24 + rrca + rrca + or $C0 + ld (ix+1), a + + ld a, b ; Set low bits of timer + ld (ix+0), $25 + and $03 + ld (ix+1), a + + jp IdleLoop ; End of subroutine -- cgit v1.2.3