Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/sound/BaseSound.cc

    r10624 r11071  
    4949        , volume_(0.7)
    5050        , bLooping_(false)
    51         , state_(Stopped)
     51        , state_(State::Stopped)
    5252        , pitch_ (1.0)
    5353    {
     
    6363    BaseSound::~BaseSound()
    6464    {
    65         if (this->state_ != Stopped)
     65        if (this->state_ != State::Stopped)
    6666            this->stop();
    6767        // Release buffer
    68         if (this->soundBuffer_ != NULL)
     68        if (this->soundBuffer_ != nullptr)
    6969        {
    7070            assert(GameMode::playsSound());
     
    8383    void BaseSound::doPlay()
    8484    {
    85         this->state_ = Playing;
    86         if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != NULL)
     85        this->state_ = State::Playing;
     86        if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != nullptr)
    8787        {
    8888            if (!alIsSource(this->audioSource_))
     
    102102    bool BaseSound::doStop()
    103103    {
    104         this->state_ = Stopped;
     104        this->state_ = State::Stopped;
    105105        if (alIsSource(this->audioSource_))
    106106        {
     
    123123        if (this->isStopped())
    124124            return;
    125         this->state_ = Paused;
     125        this->state_ = State::Paused;
    126126        if (alIsSource(this->audioSource_))
    127127            alSourcePause(this->audioSource_);
     
    151151            orxout(internal_warning, context::sound) << "Setting source parameters to 0 failed: "
    152152                                                     << SoundManager::getALErrorString(error) << endl;
    153         assert(this->soundBuffer_ != NULL);
     153        assert(this->soundBuffer_ != nullptr);
    154154        alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer());
    155155        if (ALuint error = alGetError())
     
    209209        }
    210210
    211         if (this->soundBuffer_ != NULL)
     211        if (this->soundBuffer_ != nullptr)
    212212        {
    213213            if (this->soundBuffer_->getFilename() == source)
     
    233233        // Get new sound buffer
    234234        this->soundBuffer_ = SoundManager::getInstance().getSoundBuffer(this->source_);
    235         if (this->soundBuffer_ == NULL)
     235        if (this->soundBuffer_ == nullptr)
    236236            return;
    237237
     
    256256        else // No source acquired so far, but might be set to playing or paused
    257257        {
    258             State state = static_cast<State>(this->state_); // save
     258            State state = this->state_; // save
    259259            if (this->isPlaying() || this->isPaused())
    260260                doPlay();
    261             if (state == Paused)
    262             {
    263                 this->state_ = Paused;
     261            if (state == State::Paused)
     262            {
     263                this->state_ = State::Paused;
    264264                doPause();
    265265            }
     
    271271        switch (this->state_)
    272272        {
    273             case Playing:
     273            case State::Playing:
    274274                this->play();
    275275                break;
    276             case Paused:
     276            case State::Paused:
    277277                this->pause();
    278278                break;
    279             case Stopped:
     279            case State::Stopped:
    280280            default:
    281281                this->stop();
Note: See TracChangeset for help on using the changeset viewer.