Can I copyEntity a 3dsound?

Blitz3D Forums/Blitz3D Programming/Can I copyEntity a 3dsound?

Jeroen(Posted 2003) [#1]
Hi,

Can I CopyEntity a previously loaded 3d sound?

I have a rather large function a.t.m, but if the principle isn't working, I can "undo" this feature if it's not possible.


GfK(Posted 2003) [#2]
No. Sounds aren't entities.

I'm not sure why you would want to copy a sound - you can't modify it so why not just use the original?

You can do this though:
sound = Loadsound("MySound.wav")
blah = sound
PlaySound blah
Then add these two lines - you'll see that it generates an error because 'blah' and 'sound' both point to the same sound:
Freesound blah
Playsound sound
Perhaps this is what you're trying to do?


Rob(Posted 2003) [#3]
You can also dynamically change the pitch etc as you would a normal sound.


Jeroen(Posted 2003) [#4]
Well I use sound entities for my game: birds, sounds of wind etc. Sometimes the same sound is copied multiple times (more soundentities playing the same sound). Copying the sound entity would only copy a pointer to the original one.


Shambler(Posted 2003) [#5]
In my game I check if the sound has already been loaded and if it has then just return a pointer to the already loaded sound.

Sounds are never copied at all.

Why do you need actual copies of the sound?


Jeroen(Posted 2003) [#6]
Hey Shambler.
I think I'll do that instead then.
Basicly, your suggestion does "copy" the sound.


Zethrax(Posted 2003) [#7]
I think a sound channel is basically a copy, or 'instance', of a sound, that persists until the channel stops playing. Check out some of the sound channel specific commands in the docs for more info on sound channels.