src/audio/SDL_audio.c
changeset 6977 b73d51026c68
parent 6905 4882bcc19578
child 7009 161b7b6a5303
equal deleted inserted replaced
6976:177d1dc3dba6 6977:b73d51026c68
   198 SDL_AudioLockDevice_Default(SDL_AudioDevice * device)
   198 SDL_AudioLockDevice_Default(SDL_AudioDevice * device)
   199 {
   199 {
   200     if (device->thread && (SDL_ThreadID() == device->threadid)) {
   200     if (device->thread && (SDL_ThreadID() == device->threadid)) {
   201         return;
   201         return;
   202     }
   202     }
   203     SDL_mutexP(device->mixer_lock);
   203     SDL_LockMutex(device->mixer_lock);
   204 }
   204 }
   205 
   205 
   206 static void
   206 static void
   207 SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device)
   207 SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device)
   208 {
   208 {
   209     if (device->thread && (SDL_ThreadID() == device->threadid)) {
   209     if (device->thread && (SDL_ThreadID() == device->threadid)) {
   210         return;
   210         return;
   211     }
   211     }
   212     SDL_mutexV(device->mixer_lock);
   212     SDL_UnlockMutex(device->mixer_lock);
   213 }
   213 }
   214 
   214 
   215 
   215 
   216 static void
   216 static void
   217 finalize_audio_entry_points(void)
   217 finalize_audio_entry_points(void)
   405                         istream = device->fake_stream;
   405                         istream = device->fake_stream;
   406                     }
   406                     }
   407                 }
   407                 }
   408 
   408 
   409                 /* Read from the callback into the _input_ stream */
   409                 /* Read from the callback into the _input_ stream */
   410                 SDL_mutexP(device->mixer_lock);
   410                 SDL_LockMutex(device->mixer_lock);
   411                 (*fill) (udata, istream, istream_len);
   411                 (*fill) (udata, istream, istream_len);
   412                 SDL_mutexV(device->mixer_lock);
   412                 SDL_UnlockMutex(device->mixer_lock);
   413 
   413 
   414                 /* Convert the audio if necessary and write to the streamer */
   414                 /* Convert the audio if necessary and write to the streamer */
   415                 if (device->convert.needed) {
   415                 if (device->convert.needed) {
   416                     SDL_ConvertAudio(&device->convert);
   416                     SDL_ConvertAudio(&device->convert);
   417                     if (istream == NULL) {
   417                     if (istream == NULL) {
   478                 if (stream == NULL) {
   478                 if (stream == NULL) {
   479                     stream = device->fake_stream;
   479                     stream = device->fake_stream;
   480                 }
   480                 }
   481             }
   481             }
   482 
   482 
   483             SDL_mutexP(device->mixer_lock);
   483             SDL_LockMutex(device->mixer_lock);
   484             (*fill) (udata, stream, stream_len);
   484             (*fill) (udata, stream, stream_len);
   485             SDL_mutexV(device->mixer_lock);
   485             SDL_UnlockMutex(device->mixer_lock);
   486 
   486 
   487             /* Convert the audio if necessary */
   487             /* Convert the audio if necessary */
   488             if (device->convert.needed) {
   488             if (device->convert.needed) {
   489                 SDL_ConvertAudio(&device->convert);
   489                 SDL_ConvertAudio(&device->convert);
   490                 stream = current_audio.impl.GetDeviceBuf(device);
   490                 stream = current_audio.impl.GetDeviceBuf(device);