From a62f82350aff40158e1eb21b5d5299dea8ce3ca6 Mon Sep 17 00:00:00 2001 From: BitJag <6295215+BitJag@users.noreply.github.com> Date: Wed, 29 May 2024 10:56:03 -0600 Subject: [PATCH] Added function 'set_song_position(int position)'. Changes the current playback position of the song to the start of the pattern at the given position. --- include/sound.h | 4 ++++ sound/protracker.s | 4 ++++ sound/pt-play.s | 4 ++++ sound/sound.s | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/include/sound.h b/include/sound.h index c23366e..3799531 100644 --- a/include/sound.h +++ b/include/sound.h @@ -93,6 +93,10 @@ void clear_module(); /** Play/Pause the replay of the current music */ void pause_module(); +/** Set specific postiont to start playback from. */ +void set_song_position(/** Position in song to play */ + int position); + /** Set modules voices mask. It returns the mask set. */ int enable_module_voices(/** Mask to enable/disable voice of a module. Bit 0 = Voice 0, Bit 1 = Voice 1, diff --git a/sound/protracker.s b/sound/protracker.s index 4e32eb0..abc66be 100644 --- a/sound/protracker.s +++ b/sound/protracker.s @@ -30,3 +30,7 @@ _pause_module equ mt_pause ;; enable_module_voices(int mask); _enable_module_voices equ mt_enable_voices + .globl _set_song_position +;; set_song_position(int position); +_set_song_position equ mt_SetSongPos + diff --git a/sound/pt-play.s b/sound/pt-play.s index 06ab79c..f5239d6 100644 --- a/sound/pt-play.s +++ b/sound/pt-play.s @@ -1246,6 +1246,10 @@ mt_PositionJump: MOVE.B n_cmdlo(A6),D0 .endif SUBQ.B #1,D0 + bra.s skip_SetSongPos +mt_SetSongPos: + MOVE.L 4(sp),D0 +skip_SetSongPos: MOVE.B D0,mt_SongPos mt_pj2: CLR.B mt_PBreakPos diff --git a/sound/sound.s b/sound/sound.s index 4c703c0..c9ebba5 100644 --- a/sound/sound.s +++ b/sound/sound.s @@ -579,4 +579,8 @@ _pause_module equ mt_pause .globl _enable_module_voices ;; enable_module_voices(int mask); _enable_module_voices equ mt_enable_voices + + .globl _set_song_position +;; set_song_position(int position); +_set_song_position equ mt_SetSongPos