Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2009, 5:06:57 PM (15 years ago)
Author:
rgrieder
Message:

Better error handling for sound.

File:
1 edited

Legend:

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

    r6203 r6204  
    124124    {
    125125        if (alIsSource(this->audioSource_))
     126        {
    126127            alSourcef(this->audioSource_, AL_GAIN, this->volume_*this->getVolumeGain());
     128            if (int error = alGetError())
     129                COUT(2) << "Sound: Error setting volume: " << error << std::endl;
     130        }
    127131    }
    128132
     
    144148        this->pitch_ = pitch;
    145149        if (GameMode::playsSound())
     150        {
     151            if (int error = alGetError())
     152                COUT(2) << "Sound: Error setting pitch: " << error << std::endl;
    146153            alSourcei(this->audioSource_, AL_PITCH, pitch);
     154        }
    147155    }
    148156
     
    189197        this->updateVolume();
    190198        this->setPitch(this->getPitch());
    191         alSourcei (this->audioSource_, AL_LOOPING, (this->bLoop_ ? AL_TRUE : AL_FALSE));
     199        this->setLooping(getLooping());
    192200        if (this->isPlaying() || this->isPaused())
    193             alSourcePlay(this->audioSource_);
     201            BaseSound::play();
    194202        if (this->isPaused())
    195             alSourcePause(this->audioSource_);
    196 
    197         if (int error = alGetError())
    198             COUT(2) << "Sound: OpenAL: Error playing sound: " << error << std::endl;
     203            BaseSound::pause();
    199204    }
    200205}
Note: See TracChangeset for help on using the changeset viewer.