Well, I have issues with a delay during gapless replay I cannot explain. The changes in data providing the stream are affecting the acual stream with quite a delay (1-2s). Just look to the little example code provided below.
Dunno why that is the case. If you press the button (the red box), it takes a while until the audio changes, albeit the box changes its colour rather immediaely. I don't understand what makes that delay. I also know that it is possible to modify the audio output realtime, since I did that already. Unfortunately I lost that sourcecode (I overwrote it by accident) and now I don't remember what did. Must have been something trivial I guess. Some parameter of FillMusicBuffer() maybe? I appreciate any help.
Code: Select all
ampx=10
ampx=10
bla=False
mtoggle=True
noise={2500}
;*** FUNCTIONS ***** FUNCTIONS **** FUNCTIONS **** FUNCTIONS ****
Function p_makenoise()
If mtoggle=True
ampy=1
ampz=1
Box (100, 100, 50, 50, #BLUE)
Else
ampy=0.5
ampz=0.5
Box (100, 100, 50, 50, #RED)
EndIf
For k=0 To 2500
noise[k]=Sin(k/ampx)*60*Ampz+Cos(k/ampy/2)*60*Ampz
Next
CreateSample(1, noise, 10000)
bla=1
EndFunction
Function p_dobutton1()
mtoggle= ~mtoggle
p_makenoise()
EndFunction
Function p_FillMusicBuffer()
If bla >0
FillMusicBuffer (1, "sample", 2500, {id=1} )
Else
FillMusicBuffer(1, "Mute", 500)
EndIf
EndFunction
Box (100, 100, 50, 50, #RED)
evtmatch1={ OnMouseUp = p_dobutton1 }
MakeButton (1, #SIMPLEBUTTON,100, 100, 50, 50, evtmatch1)
InstallEventHandler({FillMusicBuffer = p_FillMusicBuffer} )
CreateMusic (1, 10000, #MONO8)
PlayMusic (1)