Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7221 in orxonox.OLD for trunk/src/lib/sound


Ignore:
Timestamp:
Mar 15, 2006, 3:10:45 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

Location:
trunk/src/lib/sound
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/sound/ogg_player.cc

    r6987 r7221  
    3131 * @param fileName the file to load
    3232 */
    33 OggPlayer::OggPlayer(const char* fileName)
     33OggPlayer::OggPlayer(const std::string& fileName)
    3434{
    3535  this->setClassID(CL_SOUND_OGG_PLAYER, "OggPlayer");
     
    4040  this->buffers[1] = 0;
    4141
    42   if (fileName != NULL)
     42  if (!fileName.empty())
    4343  {
    4444    if (this->open(fileName))
     
    5656 * @param fileName the file to open
    5757 */
    58 bool OggPlayer::open(const char* fileName)
     58bool OggPlayer::open(const std::string& fileName)
    5959{
    6060  if (this->buffers[0] == 0)
     
    7272  int result;
    7373
    74   if(!(oggFile = fopen(fileName, "rb")))
     74  if(!(oggFile = fopen(fileName.c_str(), "rb")))
    7575  {
    7676    PRINTF(2)("Could not open Ogg file.");
  • trunk/src/lib/sound/ogg_player.h

    r7054 r7221  
    2727{
    2828public:
    29   OggPlayer(const char* fileName = NULL);
     29  OggPlayer(const std::string& fileName = "");
    3030  virtual ~OggPlayer();
    3131
    32   bool open(const char* fileName);
     32  bool open(const std::string& fileName);
    3333  void release();
    3434  void debug();
  • trunk/src/lib/sound/sound_buffer.cc

    r6836 r7221  
    3232 * @param fileName The name of the File
    3333 */
    34 SoundBuffer::SoundBuffer(const char* fileName)
     34SoundBuffer::SoundBuffer(const std::string& fileName)
    3535{
    3636  this->setClassID(CL_SOUND_BUFFER, "SoundBuffer");
     
    5454 * @returns true on success.
    5555 */
    56 bool SoundBuffer::loadWAV(const char* fileName)
     56bool SoundBuffer::loadWAV(const std::string& fileName)
    5757{
    5858  SDL_AudioSpec wavSpec;
     
    6161
    6262  /* Load the WAV */
    63   if( SDL_LoadWAV(fileName, &wavSpec, &wavBuffer, &wavLength) == NULL)
     63  if( SDL_LoadWAV(fileName.c_str(), &wavSpec, &wavBuffer, &wavLength) == NULL)
    6464  {
    65     PRINTF(2)("Could not open %s: %s\n", fileName, SDL_GetError());
     65    PRINTF(2)("Could not open %s: %s\n", fileName.c_str(), SDL_GetError());
    6666    return false;
    6767  }
  • trunk/src/lib/sound/sound_buffer.h

    r6981 r7221  
    1717{
    1818  public:
    19     SoundBuffer(const char* fileName);
     19    SoundBuffer(const std::string& fileName);
    2020    virtual ~SoundBuffer();
    2121
    22     bool loadWAV(const char* fileName);
     22    bool loadWAV(const std::string& fileName);
    2323
    2424    /** @returns the ID of the buffer used in this SoundBuffer */
  • trunk/src/lib/sound/sound_engine.cc

    r7193 r7221  
    9999void SoundEngine::loadSettings(IniParser* iniParser)
    100100{
    101   const char* channels = iniParser->getVar(CONFIG_NAME_AUDIO_CHANNELS, CONFIG_SECTION_AUDIO, "32");
    102   this->maxSourceCount = atoi(channels);
    103 
    104   const char* effectsVolume = iniParser->getVar(CONFIG_NAME_EFFECTS_VOLUME, CONFIG_SECTION_AUDIO, "80");
    105   this->effectsVolume = atof(effectsVolume)/100.0;
    106 
    107   const char* musicVolume = iniParser->getVar(CONFIG_NAME_MUSIC_VOLUME, CONFIG_SECTION_AUDIO, "75");
    108   this->musicVolume = atof(musicVolume)/100.0;
     101  MultiType channels = iniParser->getVar(CONFIG_NAME_AUDIO_CHANNELS, CONFIG_SECTION_AUDIO, "32");
     102  this->maxSourceCount = channels.getInt();
     103
     104  MultiType effectsVolume = iniParser->getVar(CONFIG_NAME_EFFECTS_VOLUME, CONFIG_SECTION_AUDIO, "80");
     105  this->effectsVolume = effectsVolume.getFloat()/100.0;
     106
     107  MultiType musicVolume = iniParser->getVar(CONFIG_NAME_MUSIC_VOLUME, CONFIG_SECTION_AUDIO, "75");
     108  this->musicVolume = musicVolume.getFloat()/100.0;
    109109}
    110110
     
    117117   acctualy this is nothing more than a wrapper around the ResourceManager.
    118118*/
    119 SoundSource* SoundEngine::createSource(const char* fileName, PNode* sourceNode)
     119SoundSource* SoundEngine::createSource(const std::string& fileName, PNode* sourceNode)
    120120{
    121121  return new SoundSource(sourceNode, (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL));
  • trunk/src/lib/sound/sound_engine.h

    r6849 r7221  
    3333    void loadSettings(IniParser* iniParser);
    3434
    35     SoundSource* createSource(const char* fileName, PNode* sourceNode = NULL);
     35    SoundSource* createSource(const std::string& fileName, PNode* sourceNode = NULL);
    3636
    3737    /** @param listener the listener in the scene */
Note: See TracChangeset for help on using the changeset viewer.