Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 27, 2009, 3:30:34 PM (15 years ago)
Author:
erwin
Message:

Sound: implemented sample file loading via alut

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound/src/sound/SoundBase.cc

    r2931 r2932  
    113113    }
    114114
     115    bool SoundBase::loadFile(std::string filename) {
     116        this->buffer_ = alutCreateBufferFromFile(filename.c_str());
     117        if(this->buffer_ == AL_NONE) {
     118            COUT(2) << "OpenAL ALUT: " << alutGetErrorString(alutGetError());
     119            return false;
     120        }
     121
     122        alGenSources(1, &this->source_);
     123        alSourcei(this->source_, AL_BUFFER, this->buffer_);
     124        if(alGetError() != AL_NO_ERROR) {
     125            COUT(2) << "OpenAL: Error loading sample file";
     126            return false;
     127        }
     128        return true;
     129    }
     130
    115131    ALint SoundBase::getSourceState() {
    116132        ALint state;
Note: See TracChangeset for help on using the changeset viewer.