I can imagine the DirectX stuff going on within PlaySound() and propose that something along the following lines would be reasonable simple to add and powerful enough for a competent programmer to put to good effect.
Code: Select all
; CatchSound() works as before, defining the file header and buffer. 'Length' is mandatory for what follows.
CatchSound(#Sound,*Header,Length)
.
.
.
; PlaySound() has extra flag and the address of a callback routine.
; SoundCallback() is called when SoundPosition reaches 0% and 50% (Using 'SetNotificationPositions'?)
; so user can update sound in the original buffer.
PlaySound(#Sound,#PB_Sound_UserUpdate | #PB_Sound_Loop ,Volume,@SoundCallback())
.
.
.
Procedure SoundCallback(Sound,*Buf,Bytes)
; Sound Should match #Sound (To allow for multiple sounds)
; *Buf Real address' *Header / *Header+(Length/2)
; Bytes should correspond to Length/2
; User writes appropriate section of buffer ahead of it being played
; and sets Result = #True
; If Result is returned #True caller copies appropriate half of user's
; buffer into DS Buffer
ProcedureReturn Result
EndProcedure