Can I copyEntity a 3dsound?
Blitz3D Forums/Blitz3D Programming/Can I copyEntity a 3dsound?
| ||
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. |
| ||
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 blahThen 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 soundPerhaps this is what you're trying to do? |
| ||
You can also dynamically change the pitch etc as you would a normal sound. |
| ||
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. |
| ||
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? |
| ||
Hey Shambler. I think I'll do that instead then. Basicly, your suggestion does "copy" the sound. |
| ||
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. |