comparison src/audio/mme/SDL_mmeaudio.c @ 755:b1595db396a7

Date: Fri, 12 Dec 2003 11:51:21 +0900 From: Hayashi Naoyuki Subject: Tru64 audio(mme) fix ./src/audio/mme/SDL_mmeaudio.c Fix the sound skip problem which is caused even if it recover from high load.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 14 Dec 2003 06:28:07 +0000
parents e92bcf2573cb
children b8d311d90021
comparison
equal deleted inserted replaced
754:623b453a3219 755:b1595db396a7
189 return 0; 189 return 0;
190 } 190 }
191 191
192 static void MME_WaitAudio(_THIS) 192 static void MME_WaitAudio(_THIS)
193 { 193 {
194 mmeWaitForCallbacks (); 194 while ( inUse[next_buffer] ) {
195 mmeProcessCallbacks (); 195 mmeWaitForCallbacks();
196 mmeProcessCallbacks();
197 }
196 } 198 }
197 199
198 static Uint8 *MME_GetAudioBuf(_THIS) 200 static Uint8 *MME_GetAudioBuf(_THIS)
199 { 201 {
200 Uint8 *retval; 202 Uint8 *retval;
201
202 while ( inUse[next_buffer] )
203 ;
204 203
205 inUse[next_buffer] = TRUE; 204 inUse[next_buffer] = TRUE;
206 retval = (Uint8 *)(shm->wHdr[next_buffer].lpData); 205 retval = (Uint8 *)(shm->wHdr[next_buffer].lpData);
207 return retval; 206 return retval;
208 } 207 }
218 { 217 {
219 MMRESULT result; 218 MMRESULT result;
220 int i; 219 int i;
221 220
222 if ( shm->sound ) { 221 if ( shm->sound ) {
222 for (i = 0; i < NUM_BUFFERS; i++)
223 while ( inUse[i] ) {
224 mmeWaitForCallbacks();
225 mmeProcessCallbacks();
226 }
223 result = waveOutReset(shm->sound); 227 result = waveOutReset(shm->sound);
224 if ( result != MMSYSERR_NOERROR ) 228 if ( result != MMSYSERR_NOERROR )
225 SetMMerror("waveOutReset()", result); 229 SetMMerror("waveOutReset()", result);
226 else { 230 mmeProcessCallbacks();
227 mmeWaitForCallbacks ();
228 mmeProcessCallbacks ();
229 }
230 } 231 }
231 } 232 }
232 233
233 static void MME_CloseAudio(_THIS) 234 static void MME_CloseAudio(_THIS)
234 { 235 {
244 if ( shm ) { 245 if ( shm ) {
245 if ( shm->sound ) { 246 if ( shm->sound ) {
246 result = waveOutClose(shm->sound); 247 result = waveOutClose(shm->sound);
247 if (result != MMSYSERR_NOERROR ) 248 if (result != MMSYSERR_NOERROR )
248 SetMMerror("waveOutClose()", result); 249 SetMMerror("waveOutClose()", result);
250 mmeProcessCallbacks();
249 } 251 }
250 result = mmeFreeMem(shm); 252 result = mmeFreeMem(shm);
251 if (result != MMSYSERR_NOERROR ) 253 if (result != MMSYSERR_NOERROR )
252 SetMMerror("mmeFreeMem()", result); 254 SetMMerror("mmeFreeMem()", result);
253 shm = NULL; 255 shm = NULL;