Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6070


Ignore:
Timestamp:
Nov 15, 2009, 3:53:12 PM (14 years ago)
Author:
rgrieder
Message:

OpenAL sources should be linked to the lifetime of a BaseSound.

File:
1 edited

Legend:

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

    r6069 r6070  
    4646    {
    4747        RegisterRootObject(BaseSound);
     48
     49        if (GameMode::playsSound())
     50            alGenSources(1, &this->audioSource_);
    4851    }
    4952
     
    5154    {
    5255        this->setSource("");
     56        if (this->audioSource_)
     57            alDeleteSources(1, &this->audioSource_);
    5358    }
    5459
     
    124129        }
    125130       
    126         if (alIsSource(this->audioSource_))
     131        if (alIsSource(this->audioBuffer_))
    127132        {
    128133            this->stop();
    129134            // Unload old sound first
    130135            alSourcei(this->audioSource_, AL_BUFFER, 0);
    131             alDeleteSources(1, &this->audioSource_);
    132             this->audioSource_ = 0;
    133136            alDeleteBuffers(1, &this->audioBuffer_);
    134137            this->audioBuffer_ = 0;
     
    172175        }
    173176
    174         alGenSources(1, &this->audioSource_);
    175177        alSourcei(this->audioSource_, AL_BUFFER, this->audioBuffer_);
    176178        if (alGetError() != AL_NO_ERROR)
Note: See TracChangeset for help on using the changeset viewer.