src/audio/SDL_audio.c
changeset 1330 450721ad5436
parent 1312 c9b51268668f
child 1336 3692456e7b0f
equal deleted inserted replaced
1329:bc67bbf87818 1330:450721ad5436
    19     Sam Lantinga
    19     Sam Lantinga
    20     slouken@libsdl.org
    20     slouken@libsdl.org
    21 */
    21 */
    22 
    22 
    23 /* Allow access to a raw mixing buffer */
    23 /* Allow access to a raw mixing buffer */
    24 #include <stdlib.h>
       
    25 #include <stdio.h>
       
    26 #include <string.h>
       
    27 
    24 
    28 #include "SDL.h"
    25 #include "SDL.h"
    29 #include "SDL_audio.h"
    26 #include "SDL_audio.h"
    30 #include "SDL_timer.h"
    27 #include "SDL_timer.h"
    31 #include "SDL_error.h"
    28 #include "SDL_error.h"
       
    29 #include "SDL_string.h"
    32 #include "SDL_audio_c.h"
    30 #include "SDL_audio_c.h"
    33 #include "SDL_audiomem.h"
    31 #include "SDL_audiomem.h"
    34 #include "SDL_sysaudio.h"
    32 #include "SDL_sysaudio.h"
    35 
    33 
    36 #ifdef __OS2__
    34 #ifdef __OS2__
   454 	}
   452 	}
   455 #else
   453 #else
   456 	D(bug("Locking semaphore..."));
   454 	D(bug("Locking semaphore..."));
   457 	SDL_mutexP(audio->mixer_lock);
   455 	SDL_mutexP(audio->mixer_lock);
   458 
   456 
       
   457 #if (defined(_WIN32) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC)
       
   458 #undef SDL_CreateThread
       
   459 	audio->thread = SDL_CreateThread(SDL_RunAudio, audio, NULL, NULL);
       
   460 #else
   459 	audio->thread = SDL_CreateThread(SDL_RunAudio, audio);
   461 	audio->thread = SDL_CreateThread(SDL_RunAudio, audio);
       
   462 #endif
   460 	D(bug("Created thread...\n"));
   463 	D(bug("Created thread...\n"));
   461 
   464 
   462 	if ( audio->thread == NULL ) {
   465 	if ( audio->thread == NULL ) {
   463 		SDL_mutexV(audio->mixer_lock);
   466 		SDL_mutexV(audio->mixer_lock);
   464 		SDL_CloseAudio();
   467 		SDL_CloseAudio();
   514 #ifndef ENABLE_AHI
   517 #ifndef ENABLE_AHI
   515 	/* Start the audio thread if necessary */
   518 	/* Start the audio thread if necessary */
   516 	switch (audio->opened) {
   519 	switch (audio->opened) {
   517 		case  1:
   520 		case  1:
   518 			/* Start the audio thread */
   521 			/* Start the audio thread */
       
   522 #if (defined(_WIN32) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC)
       
   523 #undef SDL_CreateThread
       
   524 			audio->thread = SDL_CreateThread(SDL_RunAudio, audio, NULL, NULL);
       
   525 #else
   519 			audio->thread = SDL_CreateThread(SDL_RunAudio, audio);
   526 			audio->thread = SDL_CreateThread(SDL_RunAudio, audio);
       
   527 #endif
   520 			if ( audio->thread == NULL ) {
   528 			if ( audio->thread == NULL ) {
   521 				SDL_CloseAudio();
   529 				SDL_CloseAudio();
   522 				SDL_SetError("Couldn't create audio thread");
   530 				SDL_SetError("Couldn't create audio thread");
   523 				return(-1);
   531 				return(-1);
   524 			}
   532 			}