Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3075 for code/trunk/src


Ignore:
Timestamp:
May 25, 2009, 9:08:55 PM (16 years ago)
Author:
erwin
Message:

fixed ogg loader. it works, bitches

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/sound/SoundBase.cc

    r3060 r3075  
    161161        alGenSources(1, &this->source_);
    162162        alSourcei(this->source_, AL_BUFFER, this->buffer_);
     163//         ALenum
    163164        if(alGetError() != AL_NO_ERROR) {
    164165            COUT(2) << "Sound: OpenAL: Error loading sample file: " << filename << std::endl;
     
    179180        std::vector<char> outbuffer;
    180181        OggVorbis_File vf;
     182        vorbis_info* vorbisInfo;
    181183        int eof = false;
    182184        int current_section;
     185        ALuint buffer;
     186        ALenum format;
    183187
    184188        FILE* f = fopen(filename.c_str(), "rb");
     
    210214        }
    211215
     216        vorbisInfo = ov_info(&vf, -1);
     217        if(vorbisInfo->channels == 1)
     218            format = AL_FORMAT_MONO16;
     219        else
     220            format = AL_FORMAT_STEREO16;
     221
     222        alGenBuffers(1, &buffer);
     223        alBufferData(buffer, format, &outbuffer[0], outbuffer.size(), vorbisInfo->rate);
    212224        ov_clear(&vf);
    213225
    214         return alutCreateBufferFromFileImage(&outbuffer, outbuffer.size());
     226        return buffer;
    215227    }
    216228} // namespace: orxonox
Note: See TracChangeset for help on using the changeset viewer.