Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6255 for code/branches


Ignore:
Timestamp:
Dec 6, 2009, 5:02:56 PM (15 years ago)
Author:
rgrieder
Message:

Temporarily resolved problem of sounds only playing once.

Location:
code/branches/presentation2/src/orxonox/sound
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/sound/BaseSound.cc

    r6254 r6255  
    7676    void BaseSound::play()
    7777    {
    78         if (!this->isPlaying() && GameMode::showsGraphics())
    79         {
    80             this->state_ = Playing;
     78        this->state_ = Playing;
     79        if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING)
     80        {
    8181            alSourcePlay(this->audioSource_);
    8282
     
    100100        if (GameMode::playsSound())
    101101            alSourcePause(this->audioSource_);
     102    }
     103
     104    ALint BaseSound::getSourceState() const
     105    {
     106        if (GameMode::playsSound())
     107        {
     108            ALint state;
     109            alGetSourcei(this->audioSource_, AL_SOURCE_STATE, &state);
     110            return state;
     111        }
     112        else
     113            return AL_INITIAL;
    102114    }
    103115
  • code/branches/presentation2/src/orxonox/sound/BaseSound.h

    r6254 r6255  
    8484
    8585    protected:
    86         ALuint loadOggFile();
     86        ALint getSourceState() const;
    8787
    8888        ALuint          audioSource_;
Note: See TracChangeset for help on using the changeset viewer.