FreeSound trouble

BlitzPlus Forums/BlitzPlus Programming/FreeSound trouble

wavematt(Posted 2006) [#1]
ive tried and tried but how can i free a sound? for instance, ill have a function start the sound like this...

bgm = PlaySound("bgm.mp3", 1)

then later ill want to stop the sound and free it like this...

StopChannel bgm
FreeSound bgm

but when i do that, it stops the sound, but crashes when it tries to free the sound and tells me that the "bgm" handle doesnt exist.

help me please! its driving me crazy that i cant figure it out


Yan(Posted 2006) [#2]
'bgm' is a handle to a channel not a sound.

You should be doing something like...
bgm = LoadSound("bgm.mp3")
...ETC...
bgm_chn = PlaySound(bgm)
...ETC...
StopChannel bgm_chn
FreeSound bgm

[edit]
Did you mean PlayMusic()?
The sound is streamed with this command and therefore does not need freeing.
[/edit]


wavematt(Posted 2006) [#3]
ah, playmusic does work better for me. i couldnt get that to work at first because i was trying to use a handle for a sound i had already loaded, but then figured out you cant do that.

thanks for your help though ;)