static SDL_AudioDevice *Audio_CreateDevice(int devindex) { SDL_AudioDevice *this; LoadPulseLibrary(); 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)); this->OpenAudio = PULSE_OpenAudio; this->WaitAudio = PULSE_WaitAudio; this->PlayAudio = PULSE_PlayAudio; this->GetAudioBuf = PULSE_GetAudioBuf; this->CloseAudio = PULSE_CloseAudio; this->WaitDone = PULSE_WaitDone; this->SetCaption = PULSE_SetCaption; this->free = Audio_DeleteDevice; return this; }
static SDL_AudioDevice *Audio_CreateDevice(int devindex) { SDL_AudioDevice *this; /* Initialize all variables that we clean on shutdown */ LoadPulseLibrary(); 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)); /* Set the function pointers */ this->OpenAudio = PULSE_OpenAudio; this->WaitAudio = PULSE_WaitAudio; this->PlayAudio = PULSE_PlayAudio; this->GetAudioBuf = PULSE_GetAudioBuf; this->CloseAudio = PULSE_CloseAudio; this->free = Audio_DeleteDevice; return this; }
static int Audio_Available(void) { pa_sample_spec paspec; pa_simple *connection; int available; available = 0; if ( LoadPulseLibrary() < 0 ) { return available; } paspec.format = PA_SAMPLE_U8; paspec.rate = 11025; paspec.channels = 1; connection = SDL_NAME(pa_simple_new)( NULL, "Test stream", PA_STREAM_PLAYBACK, NULL, "Simple DirectMedia Layer", &paspec, NULL, NULL, NULL ); if ( connection != NULL ) { available = 1; SDL_NAME(pa_simple_free)(connection); } UnloadPulseLibrary(); return(available); }
static int Audio_Available(void) { pa_sample_spec paspec; pa_simple *connection; int available; available = 0; if ( LoadPulseLibrary() < 0 ) { return available; } /* Connect with a dummy format. */ paspec.format = PA_SAMPLE_U8; paspec.rate = 11025; paspec.channels = 1; connection = SDL_NAME(pa_simple_new)( SDL_getenv("PASERVER"), /* server */ "Test stream", /* application name */ PA_STREAM_PLAYBACK, /* playback mode */ SDL_getenv("PADEVICE"), /* device on the server */ "Simple DirectMedia Layer", /* stream description */ &paspec, /* sample format spec */ NULL, /* channel map */ NULL, /* buffering attributes */ NULL /* error code */ ); if ( connection != NULL ) { available = 1; SDL_NAME(pa_simple_free)(connection); } UnloadPulseLibrary(); return(available); }