Changeset 6872 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Jan 30, 2006, 9:56:40 PM (19 years ago)
- Location:
- trunk/src/lib/sound
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/ogg_player.cc
r6842 r6872 47 47 } 48 48 49 OggPlayer::~ OggPlayer() 50 { 51 this->release(); 52 } 53 49 54 /** 50 55 * opens a file for playback … … 64 69 return false; 65 70 } 66 printf("OK\n");67 71 68 72 int result; 69 73 70 74 if(!(oggFile = fopen(fileName, "rb"))) 75 { 71 76 PRINTF(2)("Could not open Ogg file."); 77 return false; 78 } 72 79 73 80 if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0) … … 76 83 77 84 PRINTF(2)("Could not open Ogg stream. %s", errorString(result)); 85 fclose(oggFile); 86 return false; 78 87 } 79 88 … … 102 111 void OggPlayer::release() 103 112 { 113 if (!this->trackLoaded) 114 return; 104 115 alSourceStop(source); 105 116 empty(); … … 162 173 bool OggPlayer::update() 163 174 { 164 if ( !this->trackLoaded)175 if (unlikely(!this->trackLoaded)) 165 176 return false; 166 177 … … 238 249 } 239 250 } 240 241 /**242 * checks for errors243 */244 void OggPlayer::check()245 {246 int error = alGetError();247 248 if(error != AL_NO_ERROR)249 PRINTF(2)("OpenAL error was raised.");250 }251 252 251 253 252 … … 274 273 } 275 274 275 /** 276 * checks for errors 277 */ 278 void OggPlayer::check() 279 { 280 int error = alGetError(); 281 if(error != AL_NO_ERROR) 282 PRINTF(2)("OpenAL error was raised."); 283 } 276 284 277 285 /** -
trunk/src/lib/sound/ogg_player.h
r6871 r6872 28 28 public: 29 29 OggPlayer(const char* fileName = NULL); 30 ~OggPlayer(); 30 31 31 32 bool open(const char* fileName); … … 44 45 45 46 private: 46 47 47 FILE* oggFile; //!< general file-handler, to open the sound-file 48 48 OggVorbis_File oggStream; //!< The stream this Ogg-player is playing back
Note: See TracChangeset
for help on using the changeset viewer.