Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2967


Ignore:
Timestamp:
May 11, 2009, 3:29:23 PM (16 years ago)
Author:
erwin
Message:

SoundBase now loads files relative to the mediapath

Location:
code/branches/sound/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound/src/CMakeLists.txt

    r2930 r2967  
    141141ADD_SUBDIRECTORY(util)
    142142ADD_SUBDIRECTORY(core)
    143 ADD_SUBDIRECTORY(sound)
    144143ADD_SUBDIRECTORY(network)
    145144ADD_SUBDIRECTORY(orxonox)
  • code/branches/sound/src/orxonox/CMakeLists.txt

    r2966 r2967  
    5454  ${OPENAL_LIBRARY}
    5555  ${ALUT_LIBRARY}
    56   #${VORBISFILE_LIBRARY}
    57   #${VORBIS_LIBRARY}
    58   #${OGG_LIBRARY}
     56  ${VORBISFILE_LIBRARY}
     57  ${VORBIS_LIBRARY}
     58  ${OGG_LIBRARY}
    5959  ogreceguirenderer_orxonox
    6060  tinyxml++_orxonox
  • code/branches/sound/src/orxonox/sound/SoundBase.cc

    r2966 r2967  
    2626 *
    2727 */
     28#include <AL/alut.h>
     29#include <vorbis/vorbisfile.h>
    2830
    2931#include "orxonox/objects/worldentities/WorldEntity.h"
     
    128130
    129131    bool SoundBase::loadFile(std::string filename) {
     132        filename = Core::getMediaPathString() + "/audio/" + filename;
    130133        COUT(3) << "OpenAL ALUT: loading file " << filename << std::endl;
    131134        this->buffer_ = alutCreateBufferFromFile(filename.c_str());
    132135        if(this->buffer_ == AL_NONE) {
    133136            COUT(2) << "OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl;
    134             return false;
     137            if(filename.find("ogg", 0) != string::npos)
     138            {
     139                this->buffer_ = loadOggFile(filename);
     140            }
     141
     142            if(this->buffer_ == AL_NONE)
     143                return false;
    135144        }
    136145
     
    149158        return state;
    150159    }
     160   
     161    ALuint SoundBase::loadOggFile(std::string filename)
     162    {
     163        // just a dummy
     164        return AL_NONE;
     165    }
    151166} // namespace: orxonox
  • code/branches/sound/src/orxonox/sound/SoundBase.h

    r2966 r2967  
    3030
    3131#include <AL/al.h>
    32 #include <AL/alut.h>
    3332#include <string>
    3433
     
    6261
    6362    private:
     63        ALuint loadOggFile(std::string filename);
    6464        ALuint source_;
    6565        ALuint buffer_;
Note: See TracChangeset for help on using the changeset viewer.