[Orxonox-commit 1537] r6255 - code/branches/presentation2/src/orxonox/sound
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Dec 6 17:02:56 CET 2009
Author: rgrieder
Date: 2009-12-06 17:02:56 +0100 (Sun, 06 Dec 2009)
New Revision: 6255
Modified:
code/branches/presentation2/src/orxonox/sound/BaseSound.cc
code/branches/presentation2/src/orxonox/sound/BaseSound.h
Log:
Temporarily resolved problem of sounds only playing once.
Modified: code/branches/presentation2/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/BaseSound.cc 2009-12-06 16:02:11 UTC (rev 6254)
+++ code/branches/presentation2/src/orxonox/sound/BaseSound.cc 2009-12-06 16:02:56 UTC (rev 6255)
@@ -75,9 +75,9 @@
void BaseSound::play()
{
- if (!this->isPlaying() && GameMode::showsGraphics())
+ this->state_ = Playing;
+ if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING)
{
- this->state_ = Playing;
alSourcePlay(this->audioSource_);
if (int error = alGetError())
@@ -101,6 +101,18 @@
alSourcePause(this->audioSource_);
}
+ ALint BaseSound::getSourceState() const
+ {
+ if (GameMode::playsSound())
+ {
+ ALint state;
+ alGetSourcei(this->audioSource_, AL_SOURCE_STATE, &state);
+ return state;
+ }
+ else
+ return AL_INITIAL;
+ }
+
void BaseSound::setVolume(float vol)
{
if (vol > 1 || vol < 0)
Modified: code/branches/presentation2/src/orxonox/sound/BaseSound.h
===================================================================
--- code/branches/presentation2/src/orxonox/sound/BaseSound.h 2009-12-06 16:02:11 UTC (rev 6254)
+++ code/branches/presentation2/src/orxonox/sound/BaseSound.h 2009-12-06 16:02:56 UTC (rev 6255)
@@ -83,7 +83,7 @@
//ALuint getALAudioSource(void);
protected:
- ALuint loadOggFile();
+ ALint getSourceState() const;
ALuint audioSource_;
bool bPooling_;
More information about the Orxonox-commit
mailing list