LoadSound / StopChannel / FreeSound

Archives Forums/Blitz3D Bug Reports/LoadSound / StopChannel / FreeSound

Dirk Knoop(Posted 2007) [#1]
Hi,

why does this code do not run endless:


Graphics 1024,768,16,1
SetBuffer BackBuffer()
ClsColor 0,0,0

Color 0,255,255

insgesamt_start=millisecs()

start=millisecs()

lied1=LoadSound("Musik/spiel1.mp3"):ChannelID=PlaySound(lied1)


.schleife



jetzt=millisecs()

;start and stop music
If jetzt>start+10000



StopChannel(ChannelID):FreeSound lied1:lied1=0


anzahl=anzahl+1

datei$="zeit.txt"
file=WriteFile(datei$)
WriteLine file,laeuft_seit
WriteLine file,"Sekunden"
WriteLine file,anzahl
WriteLine file,"Durchgänge"
CloseFile file



start=millisecs()

lied1=LoadSound("Musik/spiel1.mp3"):ChannelID=PlaySound(lied1)


EndIf

laeuft_seit=(jetzt-insgesamt_start)/1000

;Ausgabe
Cls
Text 10,10,"Musik_tester"
Text 10,30,"Anzahl der Durchläufe: "+anzahl
Text 10,50,"läuft seit "+laeuft_seit+" Sekunden"

Flip

If KeyHit(1)=1 Then End


Goto schleife
By me the code stops after 4,5 hours.
With FreeSound the memory shoueld be cleared.

But it does not.

Regards,

Dirk Knoop


jfk EO-11110(Posted 2007) [#2]
It stops? how? Does it simply end, or does it crash with a MAV?

You may want to alter these lines:

...
Flip

If KeyHit(1)=1 Then
 print "Ending due to ESC keyhit! Press a key..."
 Waitkey()
 End
endif

Goto schleife

Print "If you read this then Goto didn't work - just impossible!"
Waitkey()