Changeset 7292 in orxonox.OLD for trunk/src/lib/sound
- Timestamp:
- Apr 14, 2006, 11:18:42 AM (19 years ago)
- Location:
- trunk/src/lib/sound
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/ogg_player.cc
r7290 r7292 99 99 alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE ); 100 100 alSourcef (source, AL_GAIN, SoundEngine::getInstance()->getMusicVolume()); 101 SoundEngine::checkError("OggPlayer::SetSourceProperties", __LINE__); 101 102 102 103 this->trackLoaded = true; … … 112 113 return; 113 114 alSourceStop(source); 115 SoundEngine::checkError("OggPlayer::release()::alSourceStop", __LINE__); 114 116 empty(); 115 117 SoundEngine::getInstance()->pushALSource(source); 116 118 this->source = 0; 117 check();118 119 alDeleteBuffers(2, buffers); 120 SoundEngine::checkError("OggPlayer::release()::alDeleteBuffers", __LINE__); 119 121 this->buffers[0] = 0; 120 122 this->buffers[1] = 0; 121 check();122 123 123 124 ov_clear(&oggStream); … … 138 139 return true; 139 140 140 if(!stream(buffers[0])) 141 return false; 142 143 if(!stream(buffers[1])) 144 return false; 145 146 alSourceQueueBuffers(source, 2, buffers); 147 alSourcePlay(source); 148 141 if(!stream(buffers[0]) || !stream(buffers[1])) 142 return false; 143 144 alSourceQueueBuffers(this->source, 2, this->buffers); 145 if (DEBUG >= 3) 146 SoundEngine::checkError("OggPlayer::playback()::alSourceQueueBuffers", __LINE__); 147 alSourcePlay(this->source); 148 if (DEBUG >= 3) 149 SoundEngine::checkError("OggPlayer::playback()::alSourcePlay", __LINE__); 150 printf("%d\n", this->source); 149 151 return true; 150 152 } … … 178 180 179 181 alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed); 182 if (DEBUG >= 3) 183 SoundEngine::checkError("OggPlayer::update()::alGetSourceI", __LINE__); 180 184 181 185 while(processed--) … … 184 188 185 189 alSourceUnqueueBuffers(source, 1, &buffer); 186 check(); 190 if (DEBUG >= 3) 191 SoundEngine::checkError("OggPlayer::update()::unqueue", __LINE__); 187 192 188 193 active = stream(buffer); 189 194 190 195 alSourceQueueBuffers(source, 1, &buffer); 191 check(); 196 if (DEBUG >= 3) 197 SoundEngine::checkError("OggPlayer::update()::queue", __LINE__); 192 198 } 193 199 … … 226 232 227 233 alBufferData(buffer, format, pcm, size, vorbisInfo->rate); 228 check(); 234 if (DEBUG >= 3) 235 SoundEngine::checkError("OggPlayer::playback()::BUFFER", __LINE__); 229 236 230 237 return true; … … 246 253 247 254 alSourceUnqueueBuffers(source, 1, &buffer); 248 check();255 SoundEngine::checkError("OggPlayer::empty()::unqueue Buffers", __LINE__); 249 256 } 250 257 } … … 273 280 } 274 281 275 /**276 * checks for errors277 */278 void OggPlayer::check()279 {280 int error = alGetError();281 if(error != AL_NO_ERROR)282 PRINTF(2)("OpenAL error was raised.");283 }284 282 285 283 /** -
trunk/src/lib/sound/ogg_player.h
r7287 r7292 38 38 39 39 protected: 40 41 40 bool stream(ALuint buffer); 42 41 void empty(); 43 void check();44 42 const char* errorString(int code); 45 43 -
trunk/src/lib/sound/sound_engine.cc
r7291 r7292 152 152 source = this->ALSources.top(); 153 153 this->ALSources.pop(); 154 printf("Retrieve Source %d\n", source); 154 155 } 155 156 }
Note: See TracChangeset
for help on using the changeset viewer.