EmitSound, breaking my head on this :)
Blitz3D Forums/Blitz3D Programming/EmitSound, breaking my head on this :)
| ||
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? |
| ||
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 :) ). |
| ||
aaaah okay, I didn't know that. Thank you! |
| ||
would FreeSound work to actually delete the sound? |
| ||
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. |
| ||
FreeSound does not appear to work with Load3Dsound |
| ||
Ok, my mistake. Did you try to use Freeentity? (cannot test it right now) |
| ||
I did! Thanks! Works! |