DiNeRo
08-11-2012 14:04:17
Hi, im working on a semestral project and im using OgreOggSound.
Ive hit a problem though, lemme explain the situation properly:
There are various instances of the same enemy in the scene and all of them should use the sound "shoot.ogg". I can easily create the sound using sceneManager->createSound("enemyFire","shoot.ogg",....), ive already attached the listener to the camera
and i can also attach it to an object using my own method
this is where two questions arise:
1) how can i now access the sound and play it? object->getAttachedObject(name) wont be an OgreOggISound, so i cant use the play() method
2) as i said, there are several "identical" enemies flying around in the scene and each of them needs to have a sound that is attached to it and can be played individualy for that one enemy (of course, several enemies can play a sound at once)
thanks
Ive hit a problem though, lemme explain the situation properly:
There are various instances of the same enemy in the scene and all of them should use the sound "shoot.ogg". I can easily create the sound using sceneManager->createSound("enemyFire","shoot.ogg",....), ive already attached the listener to the camera
void Audio::setEars(Ogre::SceneNode* node){
node->attachObject(soundManager->getListener());
}
and i can also attach it to an object using my own method
void Audio::attachSoundToObject(string name, Ogre::SceneNode *object){
auto sound=sounds.find(name);
if(sound!=sounds.end()){
object->attachObject(sound->second);
} else {
throw Ogre::Exception(3502,"Sound "+name+" is not loaded properly.", __FILE__);
}
}
this is where two questions arise:
1) how can i now access the sound and play it? object->getAttachedObject(name) wont be an OgreOggISound, so i cant use the play() method
2) as i said, there are several "identical" enemies flying around in the scene and each of them needs to have a sound that is attached to it and can be played individualy for that one enemy (of course, several enemies can play a sound at once)
thanks