Changeset 7284 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Apr 13, 2006, 8:52:41 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/sound_engine.cc
r7256 r7284 99 99 { 100 100 MultiType channels = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_AUDIO_CHANNELS, "32"); 101 printf("==== THIS IS A TEST "); 102 channels.debug(); 101 103 this->maxSourceCount = channels.getInt(); 102 104 … … 138 140 void SoundEngine::popALSource(ALuint& source) 139 141 { 140 if (source != 0) 141 return; 142 else 143 { 144 145 /// @TODO try to create more sources if needed 146 if (!this->ALSources.empty()) 147 { 148 source = this->ALSources.top(); 149 this->ALSources.pop(); 150 } 151 } 142 assert (source == 0); 143 144 /// @TODO try to create more sources if needed 145 if (!this->ALSources.empty()) 146 { 147 source = this->ALSources.top(); 148 this->ALSources.pop(); 149 } 150 152 151 } 153 152 … … 272 271 bool SoundEngine::initAudio() 273 272 { 274 // ALenum result;275 // PRINTF(3)("Initialisazing openAL sound engine\n");276 // const char* defaultDevice =(const char*) alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);277 // const char* deviceList = (const char*)alcGetString(NULL,ALC_DEVICE_SPECIFIER);278 // const char* devWalk = deviceList;279 // // if (alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE)280 // { // try out enumeration extension281 // PRINTF(3)("Enumeration-extension found\n");282 //283 // PRINTF(3)("Default device: %s\n", defaultDevice);284 // do285 // {286 // PRINTF(3)("%s\n", devWalk);287 // devWalk += strlen(devWalk)+1;288 // }289 // while (devWalk[0] != '\0');290 // }273 // ALenum result; 274 // PRINTF(3)("Initialisazing openAL sound engine\n"); 275 // const char* defaultDevice =(const char*) alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); 276 // const char* deviceList = (const char*)alcGetString(NULL,ALC_DEVICE_SPECIFIER); 277 // const char* devWalk = deviceList; 278 // // if (alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE) 279 // { // try out enumeration extension 280 // PRINTF(3)("Enumeration-extension found\n"); 281 // 282 // PRINTF(3)("Default device: %s\n", defaultDevice); 283 // do 284 // { 285 // PRINTF(3)("%s\n", devWalk); 286 // devWalk += strlen(devWalk)+1; 287 // } 288 // while (devWalk[0] != '\0'); 289 // } 291 290 292 291 // INITIALIZING THE DEVICE: 293 // char deviceName[] =294 // #ifdef __WIN32__295 // "Direct3D";296 // #else297 // "'( ( devices '( native null ) ) )";298 // #endif292 // char deviceName[] = 293 // #ifdef __WIN32__ 294 // "Direct3D"; 295 // #else 296 // "'( ( devices '( native null ) ) )"; 297 // #endif 299 298 300 299 this->device = alcOpenDevice(NULL); … … 312 311 // #endif 313 312 313 printf ("===== SOURCECOUNT: %d\n", this->maxSourceCount); 314 314 this->setDopplerValues(SOUND_DOPPLER_FACTOR, SOUND_DOPPLER_VELOCITY); 315 315 this->allocateSources(this->maxSourceCount); … … 409 409 { 410 410 switch(err) 411 411 { 412 412 case ALC_NO_ERROR: 413 413 return ("AL_NO_ERROR"); … … 422 422 case ALC_OUT_OF_MEMORY: 423 423 return("ALC_OUT_OF_MEMORY"); 424 425 } 426 424 }; 425 } 426 -
trunk/src/lib/sound/sound_source.cc
r6142 r7284 68 68 if (unlikely(this->sourceID == 0)) 69 69 SoundEngine::getInstance()->popALSource(this->sourceID); 70 assert (this->sourceID != 0); 70 71 71 72 alSourceStop(this->sourceID); … … 76 77 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 77 78 this->bPlay = true; 79 printf("%d\n", this->sourceID); 80 78 81 } 79 82 -
trunk/src/lib/util/multi_type.cc
r7221 r7284 296 296 else if (this->type & MT_STRING) 297 297 { 298 if (this->storedString == "") return 0; 299 char* endPtr = NULL; 300 int result = strtol(this->storedString.c_str(), &endPtr, 10); 301 if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + strlen(this->storedString.c_str())) 302 return 0; 303 else 304 return result; 298 std::stringstream ssStream(this->storedString); 299 int iReturn; 300 ssStream >> iReturn; 301 return iReturn; 305 302 } 306 303 return 0; … … 323 320 char* endPtr = NULL; 324 321 double result = strtod(this->storedString.c_str(), &endPtr); 325 if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + strlen(this->storedString.c_str()))322 if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + this->storedString.size()) 326 323 return 0.0f; 327 324 else
Note: See TracChangeset
for help on using the changeset viewer.