EmitSound, breaking my head on this :)

Blitz3D Forums/Blitz3D Programming/EmitSound, breaking my head on this :)

Jeroen(Posted 2003) [#1]
Hi!

Simple to explain, but I haven't been able to get this right:

Here I have an emitted sound:

; sound previously loaded with load3DSound
s\channel = EmitSound(m\sound,m\cubeEntity)


Later on, I want to delete the sound again:

FreeEntity s\channel ; doesnt work
FreeEntity s\cubeEntity ; works
delete s ; works


The weird thing is: s\channel DOES hold an entity
I did: RuntimeError (s\channel)
but when I want to free the entity and make the sound stop, it tells me the entity cannot be found.

What I'm doing wrong here?


jfk EO-11110(Posted 2003) [#2]
It's a Channel-ID, not an Entity. The Sound might be an Entity, but the Channel is only a channel. Channels are given away by the system, so don't worry. Use StopChannel instead. you don't have to delete or free a Channel. Once the emiting Entity is deleted the channel is released anyway (as I suspect :) ).


Jeroen(Posted 2003) [#3]
aaaah okay, I didn't know that. Thank you!


Perturbatio(Posted 2003) [#4]
would FreeSound work to actually delete the sound?


jfk EO-11110(Posted 2003) [#5]
Yes, of course. But I think usually a sound is loaded and then kept in memory to be reusable. So you can use it again and again for many emitters. Ok, if you want to use it only once, then delete it right after usage. I would reccomend to use StopChannel first, then delete the Sound using FreeSound, then set the Soundhandle to Zero to make it possible for other functions aso. to check if it still exists.


Jeroen(Posted 2003) [#6]
FreeSound does not appear to work with Load3Dsound


jfk EO-11110(Posted 2003) [#7]
Ok, my mistake. Did you try to use Freeentity? (cannot test it right now)


Jeroen(Posted 2003) [#8]
I did! Thanks! Works!