tarenar
06-07-2007 20:24:46
I'm trying to attach a sound object to many projectiles. The projectiles constantly emit a windy sound so when they fly by the player, they make a whooshing sound.
In the constructor of the class representing the projectile I have:
However I get the error:
An exception has been thrown!
----------------------
Details:
----------------------
Error #: 4
Function: SceneNode::attachObject
Description: Object already attached to a SceneNode or a Bone.
...
I think what it's saying is I'm trying to attach a single sound node to many different projectiles. Is there an alternative solution that would give me the same effect?
In the constructor of the class representing the projectile I have:
OgreAL::SoundManager *soundManager;
soundManager = OgreAL::SoundManager::getSingletonPtr();
OgreAL::Sound *sound;
if (!soundManager->hasSound("9992"))
{
sound = soundManager->createSound("9992", "wind.wav", true);
}
else
{
sound = soundManager->getSound("9992");
}
snowBall->getSceneNode()->attachObject(sound);
sound->setRelativeToListener(true);
sound->setGain(50);
sound->play();
However I get the error:
An exception has been thrown!
----------------------
Details:
----------------------
Error #: 4
Function: SceneNode::attachObject
Description: Object already attached to a SceneNode or a Bone.
...
I think what it's saying is I'm trying to attach a single sound node to many different projectiles. Is there an alternative solution that would give me the same effect?