kinggori
11-03-2007 22:25:40
Hi guys
I've been trying to attach sounds to objects fpr days now. I didn't want to be a pain in the ass as usual so I didn't post asking for help but I just tried everything and can't seem to get rid of runtime errors.
The game runs perfectly fine and background music is running perfectly. But when I add the three lines:
in
I get the error:
I've been trying to attach sounds to objects fpr days now. I didn't want to be a pain in the ass as usual so I didn't post asking for help but I just tried everything and can't seem to get rid of runtime errors.
The game runs perfectly fine and background music is running perfectly. But when I add the three lines:
OgreAL::SoundManager *soundManager;
soundManager = new OgreAL::SoundManager();
mSceneNode->attachObject(soundManager->getListener());
in
namespace CAXCore {
// OgreAL::SoundManager *soundManager;
// initialise the static value
int CAXWorldObject::sNumObjects = 0;
CAXWorldObject::CAXWorldObject ( string meshName,
SceneManager* scnMgr,
const Vector3& initPos,
const float scale,
const float rotate)
{
// entities are automatically named
char bufstr[64];
sprintf ( bufstr, "cax_object_ent_%d", sNumObjects );
mEntity = scnMgr->createEntity ( bufstr, meshName.c_str() );
mEntity->setCastShadows(true);
mSceneManager = scnMgr;
// scene nodes are automatically named
sprintf ( bufstr, "cax_object_node_%d", sNumObjects++ );
mSceneNode = scnMgr->getRootSceneNode()->createChildSceneNode(bufstr, initPos);
mSceneNode->scale ( scale, scale, scale );
mSceneNode->yaw( (Ogre::Radian)rotate);
// To get things right
mSceneNode->attachObject(mEntity);
OgreAL::SoundManager *soundManager;
soundManager = new OgreAL::SoundManager();
mSceneNode->attachObject(soundManager->getListener());
}
void CAXWorldObject::setMesh( string meshName )
{
string name = mEntity->getName();
mSceneNode->detachObject( mEntity );
mSceneManager->destroyEntity( mEntity );
mEntity = mSceneManager->createEntity ( name.c_str(), meshName.c_str() );
mEntity->setCastShadows(true);
mSceneNode->attachObject(mEntity);
}
.................
I get the error:
Assertion failed!
Program c:\mydev\LIAV\bin\Release\LIAV_864.exe
File c:\mydev\ogrenew\include\OgreSingleton.h
Line: 59
Expression: !ms_Singleton
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts