Changeset 7221 in orxonox.OLD for trunk/src/lib/sound
- Timestamp:
- Mar 15, 2006, 3:10:45 PM (19 years ago)
- Location:
- trunk/src/lib/sound
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/ogg_player.cc
r6987 r7221 31 31 * @param fileName the file to load 32 32 */ 33 OggPlayer::OggPlayer(const char*fileName)33 OggPlayer::OggPlayer(const std::string& fileName) 34 34 { 35 35 this->setClassID(CL_SOUND_OGG_PLAYER, "OggPlayer"); … … 40 40 this->buffers[1] = 0; 41 41 42 if ( fileName != NULL)42 if (!fileName.empty()) 43 43 { 44 44 if (this->open(fileName)) … … 56 56 * @param fileName the file to open 57 57 */ 58 bool OggPlayer::open(const char*fileName)58 bool OggPlayer::open(const std::string& fileName) 59 59 { 60 60 if (this->buffers[0] == 0) … … 72 72 int result; 73 73 74 if(!(oggFile = fopen(fileName , "rb")))74 if(!(oggFile = fopen(fileName.c_str(), "rb"))) 75 75 { 76 76 PRINTF(2)("Could not open Ogg file."); -
trunk/src/lib/sound/ogg_player.h
r7054 r7221 27 27 { 28 28 public: 29 OggPlayer(const char* fileName = NULL);29 OggPlayer(const std::string& fileName = ""); 30 30 virtual ~OggPlayer(); 31 31 32 bool open(const char*fileName);32 bool open(const std::string& fileName); 33 33 void release(); 34 34 void debug(); -
trunk/src/lib/sound/sound_buffer.cc
r6836 r7221 32 32 * @param fileName The name of the File 33 33 */ 34 SoundBuffer::SoundBuffer(const char*fileName)34 SoundBuffer::SoundBuffer(const std::string& fileName) 35 35 { 36 36 this->setClassID(CL_SOUND_BUFFER, "SoundBuffer"); … … 54 54 * @returns true on success. 55 55 */ 56 bool SoundBuffer::loadWAV(const char*fileName)56 bool SoundBuffer::loadWAV(const std::string& fileName) 57 57 { 58 58 SDL_AudioSpec wavSpec; … … 61 61 62 62 /* Load the WAV */ 63 if( SDL_LoadWAV(fileName , &wavSpec, &wavBuffer, &wavLength) == NULL)63 if( SDL_LoadWAV(fileName.c_str(), &wavSpec, &wavBuffer, &wavLength) == NULL) 64 64 { 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()); 66 66 return false; 67 67 } -
trunk/src/lib/sound/sound_buffer.h
r6981 r7221 17 17 { 18 18 public: 19 SoundBuffer(const char*fileName);19 SoundBuffer(const std::string& fileName); 20 20 virtual ~SoundBuffer(); 21 21 22 bool loadWAV(const char*fileName);22 bool loadWAV(const std::string& fileName); 23 23 24 24 /** @returns the ID of the buffer used in this SoundBuffer */ -
trunk/src/lib/sound/sound_engine.cc
r7193 r7221 99 99 void SoundEngine::loadSettings(IniParser* iniParser) 100 100 { 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; 109 109 } 110 110 … … 117 117 acctualy this is nothing more than a wrapper around the ResourceManager. 118 118 */ 119 SoundSource* SoundEngine::createSource(const char*fileName, PNode* sourceNode)119 SoundSource* SoundEngine::createSource(const std::string& fileName, PNode* sourceNode) 120 120 { 121 121 return new SoundSource(sourceNode, (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL)); -
trunk/src/lib/sound/sound_engine.h
r6849 r7221 33 33 void loadSettings(IniParser* iniParser); 34 34 35 SoundSource* createSource(const char*fileName, PNode* sourceNode = NULL);35 SoundSource* createSource(const std::string& fileName, PNode* sourceNode = NULL); 36 36 37 37 /** @param listener the listener in the scene */
Note: See TracChangeset
for help on using the changeset viewer.