aboutsummaryrefslogtreecommitdiff
path: root/src-z80/player
diff options
context:
space:
mode:
authorJavier Degirolmo2013-04-22 05:30:00 -0300
committerJavier Degirolmo2013-04-22 05:30:00 -0300
commiteecc39834949e6affbf3268cb5405a296cd12216 (patch)
treed97fa90e4610ccc1afc52cf88b8db27b034ef3d4 /src-z80/player
parent40459d3587f607753dd2f5036d2b2471cdf23add (diff)
Now you can change the sample rate of PCM instruments
Diffstat (limited to 'src-z80/player')
-rw-r--r--src-z80/player/pcm.z8027
1 files changed, 27 insertions, 0 deletions
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