Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6411


Ignore:
Timestamp:
Dec 24, 2009, 4:01:23 PM (15 years ago)
Author:
rgrieder
Message:

BaseSound should release the buffer upon destruction and the SoundManager should delete all remaining buffers and sources.

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

Legend:

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

    r6397 r6411  
    6060    {
    6161        this->stop();
     62        // Release buffer
     63        if (this->soundBuffer_ != NULL)
     64        {
     65            assert(GameMode::playsSound());
     66            SoundManager::getInstance().releaseSoundBuffer(this->soundBuffer_, this->bPooling_);
     67        }
    6268    }
    6369
  • code/branches/presentation2/src/orxonox/sound/SoundManager.cc

    r6409 r6411  
    162162    SoundManager::~SoundManager()
    163163    {
     164        // Erase fade lists because of the smart pointers
     165        this->fadeInList_.clear();
     166        this->fadeOutList_.clear();
     167
     168        // If there are still used buffers around, well, that's just very bad...
     169        if (this->soundBuffers_.size() != this->effectsPool_.size())
     170            COUT(1) << "Sound Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
     171        // Empty buffer pool and buffer list
     172        this->effectsPool_.clear();
     173        this->soundBuffers_.clear();
     174
     175        // There should not be any sources in use anymore
     176        if (!this->usedSoundSources_.empty())
     177            COUT(1) << "Sound Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
     178        while (!this->availableSoundSources_.empty())
     179        {
     180            alDeleteSources(1, &this->availableSoundSources_.back());
     181            this->availableSoundSources_.pop_back();
     182        }
     183
    164184        GameMode::setPlaysSound(false);
    165185
Note: See TracChangeset for help on using the changeset viewer.