magistr
14-01-2008 15:24:39
I have following problem.
In my project exists back ground music, and two sounds:
1. Sound for button press in GUI
2. Sound for my game objects in 3D
My projects is started normaly, but getSound give many problems:
1. After one of call getSound function, project is crashed (in getSound function!!!, not after!)
2. In my project I get one of my sound, but sometimes getSound ceases correct work, and return ONE sound for ALL SOUND NAMES.
i.e. i call this lines:
and
But SoudManager play CubeClick1 sound for both calls (CubeClick1 and GUIBtn or any other)
My code for load sounds:
Code for load BG music:
In my project exists back ground music, and two sounds:
1. Sound for button press in GUI
2. Sound for my game objects in 3D
My projects is started normaly, but getSound give many problems:
1. After one of call getSound function, project is crashed (in getSound function!!!, not after!)
2. In my project I get one of my sound, but sometimes getSound ceases correct work, and return ONE sound for ALL SOUND NAMES.
i.e. i call this lines:
OgreAL::SoundManager::getSingleton().getSound("GUIBtn")->stop();
OgreAL::SoundManager::getSingleton().getSound("GUIBtn")->play();
and
OgreAL::SoundManager::getSingleton().getSound("CubeClick1")->stop();
OgreAL::SoundManager::getSingleton().getSound("CubeClick1")->play();
But SoudManager play CubeClick1 sound for both calls (CubeClick1 and GUIBtn or any other)
My code for load sounds:
sndButtonClick = OgreAL::SoundManager::getSingleton().createSound("GUIBtn", "buttonClick.wav", false, false);
sndButtonClick->setPriority(OgreAL::Sound::Priority::HIGH);
sndButtonClick->setRelativeToListener(true);
cubeSound1 = OgreAL::SoundManager::getSingleton().createSound("CubeClick1", "cubeClick.wav", false, false);
cubeSound2 = OgreAL::SoundManager::getSingleton().createSound("CubeClick2", "cubeClick.wav", false, false);
cubeSound1->setGain(0.4);
cubeSound2->setGain(0.4);
Code for load BG music:
OgreAL::Sound *sound = OgreAL::SoundManager::getSingleton().createSound("SoundStream3", "gamemusic1.ogg", true, true);
sound->setGain(0.15);
sound->setPriority(OgreAL::Sound::LOW);
sound->setLoop(true);
sound->play();