Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6730


Ignore:
Timestamp:
Apr 15, 2010, 1:57:51 PM (14 years ago)
Author:
erwin
Message:

Transfer changes again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound5/src/orxonox/sound/AmbientSound.cc

    r6674 r6730  
    149149    void AmbientSound::setStreamSource(const std::string& source)
    150150    {
     151        if (!GameMode::playsSound())
     152        {
     153            this->source_ = source;
     154            return;
     155        }
     156
    151157        this->audioSource_ = SoundManager::getInstance().getSoundSource(this);
    152158        if (this->source_ == source)
     
    178184            COUT(2) << "Sound: Failed to create thread." << std::endl;
    179185
     186        if (alIsSource(this->audioSource_)) // already playing or paused
     187        {
     188            // Sound was already playing or paused because there was a source acquired
     189            assert(this->isPlaying() || this->isPaused());
     190            alSourcePlay(this->audioSource_);
     191            if (int error = alGetError())
     192                COUT(2) << "Sound: Error playing sound: " << getALErrorString(error) << std::endl;
     193            if (this->isPaused())
     194                alSourcePause(this->audioSource_);
     195        }
     196        else // No source acquired so far, but might be set to playing or paused
     197        {
     198            if (this->isPlaying() || this->isPaused())
     199                doPlay();
     200            if (this->isPaused())
     201            {
     202                doPause();
     203            }
     204        }
    180205
    181206        this->updateVolume();
Note: See TracChangeset for help on using the changeset viewer.