static SDL_AudioDevice *Audio_CreateDevice(int devindex) { SDL_AudioDevice *this; /* Initialize all variables that we clean on shutdown */ LoadARTSLibrary(); this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); if ( this ) { memset(this, 0, (sizeof *this)); this->hidden = (struct SDL_PrivateAudioData *) malloc((sizeof *this->hidden)); } if ( (this == NULL) || (this->hidden == NULL) ) { SDL_OutOfMemory(); if ( this ) { free(this); } return(0); } memset(this->hidden, 0, (sizeof *this->hidden)); stream = 0; /* Set the function pointers */ this->OpenAudio = ARTSC_OpenAudio; this->WaitAudio = ARTSC_WaitAudio; this->PlayAudio = ARTSC_PlayAudio; this->GetAudioBuf = ARTSC_GetAudioBuf; this->CloseAudio = ARTSC_CloseAudio; this->free = Audio_DeleteDevice; return this; }
static SDL_AudioDevice *Audio_CreateDevice(int devindex) { SDL_AudioDevice *this; LoadARTSLibrary(); this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice)); if ( this ) { SDL_memset(this, 0, (sizeof *this)); this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); } if ( (this == NULL) || (this->hidden == NULL) ) { SDL_OutOfMemory(); if ( this ) { SDL_free(this); } return(0); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); stream = 0; this->OpenAudio = ARTS_OpenAudio; this->WaitAudio = ARTS_WaitAudio; this->PlayAudio = ARTS_PlayAudio; this->GetAudioBuf = ARTS_GetAudioBuf; this->CloseAudio = ARTS_CloseAudio; this->free = Audio_DeleteDevice; return this; }
static int Audio_Available(void) { int available = 0; if ( LoadARTSLibrary() < 0 ) { return available; } if ( SDL_NAME(arts_init)() == 0 ) { #define ARTS_CRASH_HACK /* Play a stream so aRts doesn't crash */ #ifdef ARTS_CRASH_HACK arts_stream_t stream2; stream2=SDL_NAME(arts_play_stream)(44100, 16, 2, "SDL"); SDL_NAME(arts_write)(stream2, "", 0); SDL_NAME(arts_close_stream)(stream2); #endif available = 1; SDL_NAME(arts_free)(); } UnloadARTSLibrary(); return available; }
static int Audio_Available(void) { int available = 0; if ( LoadARTSLibrary() < 0 ) { return available; } if ( SDL_NAME(arts_init)() == 0 ) { if ( ARTS_Suspend() ) { arts_stream_t stream2; stream2=SDL_NAME(arts_play_stream)(44100, 16, 2, "SDL"); SDL_NAME(arts_write)(stream2, "", 0); SDL_NAME(arts_close_stream)(stream2); available = 1; } SDL_NAME(arts_free)(); } UnloadARTSLibrary(); return available; }