Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 15, 2009, 3:43:06 PM (16 years ago)
Author:
rgrieder
Message:

Detail changes in the sound classes.
Plus fixed the level sound problem (order of XML parameters was wrong).
There is still a large issue when changing an ambient sound source though.

File:
1 edited

Legend:

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

    r6046 r6069  
    9393        if (alIsSource(this->audioSource_))
    9494            return getSourceState() == AL_PAUSED;
    95         return true;
     95        return false;
    9696    }
    9797
     
    103103    }
    104104
    105     void BaseSound::setPlayOnLoad(bool val)
    106     {
    107         this->bPlayOnLoad_ = val;
    108         if(val)
    109         {
    110             this->play();
    111         }
     105    void BaseSound::setVolume(float vol)
     106    {
     107        if (vol > 1 || vol < 0)
     108        {
     109            COUT(2) << "Sound warning: volume out of range, cropping value." << std::endl;
     110            vol = vol > 1 ? 1 : vol;
     111            vol = vol < 0 ? 0 : vol;
     112        }
     113        this->volume_ = vol;
     114        if (alIsSource(this->audioSource_))
     115            alSourcef(this->audioSource_, AL_GAIN, vol);
    112116    }
    113117
     
    178182        alSource3f(this->audioSource_, AL_POSITION,  0, 0, 0);
    179183
     184        this->setVolume(this->volume_);
     185
    180186        if (this->bPlayOnLoad_)
    181187            this->play();
    182     }
    183 
    184     ALuint BaseSound::getALAudioSource()
    185     {
    186         return audioSource_;
    187188    }
    188189
     
    275276        return buffer;
    276277    }
    277 
    278 } // namespace: orxonox
     278}
Note: See TracChangeset for help on using the changeset viewer.