[Orxonox-commit 1516] r6234 - in code/branches/presentation2/src/orxonox: gamestates sound
rgrieder at orxonox.net
rgrieder at orxonox.net
Thu Dec 3 20:22:50 CET 2009
Author: rgrieder
Date: 2009-12-03 20:22:49 +0100 (Thu, 03 Dec 2009)
New Revision: 6234
Modified:
code/branches/presentation2/src/orxonox/gamestates/GSMainMenu.cc
code/branches/presentation2/src/orxonox/sound/BaseSound.cc
Log:
Fixed the sound bug where it didn't play when setting the source too late.
And fixed it again by moving setConfigValues in GSMainMenu.
Sound works for me now.
Modified: code/branches/presentation2/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/branches/presentation2/src/orxonox/gamestates/GSMainMenu.cc 2009-12-03 19:10:07 UTC (rev 6233)
+++ code/branches/presentation2/src/orxonox/gamestates/GSMainMenu.cc 2009-12-03 19:22:49 UTC (rev 6234)
@@ -100,13 +100,13 @@
KeyBinderManager::getInstance().setToDefault();
InputManager::getInstance().enterState("mainMenu");
+ this->setConfigValues();
+
if (GameMode::playsSound())
{
this->ambient_->setLooping(true);
- //this->ambient_->play(); // works without source
+ this->ambient_->play(); // works without source
}
-
- this->setConfigValues();
}
void GSMainMenu::deactivate()
@@ -140,7 +140,6 @@
if (GameMode::playsSound())
{
this->ambient_->setAmbientSource(soundPathMain_);
- this->ambient_->play();
}
}
Modified: code/branches/presentation2/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/BaseSound.cc 2009-12-03 19:10:07 UTC (rev 6233)
+++ code/branches/presentation2/src/orxonox/sound/BaseSound.cc 2009-12-03 19:22:49 UTC (rev 6234)
@@ -196,8 +196,12 @@
this->setPitch(this->getPitch());
this->setLooping(getLooping());
if (this->isPlaying() || this->isPaused())
- BaseSound::play();
+ {
+ alSourcePlay(this->audioSource_);
+ if (int error = alGetError())
+ COUT(2) << "Sound: Error playing sound: " << error << std::endl;
+ }
if (this->isPaused())
- BaseSound::pause();
+ alSourcePause(this->audioSource_);
}
}
More information about the Orxonox-commit
mailing list