Changeset 7304 in orxonox.OLD for trunk/src/lib/sound/ogg_player.cc
- Timestamp:
- Apr 16, 2006, 8:27:32 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/ogg_player.cc
r7303 r7304 40 40 this->buffers[0] = 0; 41 41 this->buffers[1] = 0; 42 this->musicThread = NULL; 42 43 43 44 if (!fileName.empty()) … … 135 136 return true; 136 137 } 138 139 140 141 int OggPlayer::createAudioThread(void* oggPlayer) 142 { 143 if (oggPlayer == NULL) 144 return -1; 145 OggPlayer* ogg = (OggPlayer*)oggPlayer; 146 PRINTF(4)("STARTIG AUDIO THREAD\n"); 147 148 ogg->playback(); 149 150 while (ogg->state & Playing) 151 { 152 ogg->update(); 153 SDL_Delay(1); 154 } 155 PRINTF(4)("End the AudioThread\n"); 156 } 157 137 158 138 159 /** … … 171 192 this->state &= ! FileOpened; 172 193 } 173 } 174 194 195 // Kill the Music Thread. 196 if (this->musicThread != NULL) 197 { 198 assert (!(this->state & Playing)); 199 SDL_WaitThread(this->musicThread, NULL); 200 this->musicThread = NULL; 201 } 202 } 203 204 205 bool OggPlayer::play() 206 { 207 if (this->musicThread == NULL) 208 this->musicThread = SDL_CreateThread(OggPlayer::createAudioThread, (void*)this); 209 } 175 210 176 211 /**
Note: See TracChangeset
for help on using the changeset viewer.