SDL  2.0
SDL_sysaudio.h File Reference
#include "../SDL_internal.h"
#include "SDL_mutex.h"
#include "SDL_thread.h"
+ Include dependency graph for SDL_sysaudio.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SDL_AudioBufferQueue
 
struct  SDL_AudioDriverImpl
 
struct  SDL_AudioDeviceItem
 
struct  SDL_AudioDriver
 
struct  SDL_AudioStreamer
 
struct  SDL_AudioDevice
 
struct  AudioBootStrap
 

Macros

#define _THIS   SDL_AudioDevice *_this
 
#define SDL_AUDIOBUFFERQUEUE_PACKETLEN   (8 * 1024)
 

Functions

void SDL_AddAudioDevice (const int iscapture, const char *name, void *handle)
 
void SDL_RemoveAudioDevice (const int iscapture, void *handle)
 
void SDL_OpenedAudioDeviceDisconnected (SDL_AudioDevice *device)
 

Macro Definition Documentation

#define _THIS   SDL_AudioDevice *_this

Definition at line 31 of file SDL_sysaudio.h.

#define SDL_AUDIOBUFFERQUEUE_PACKETLEN   (8 * 1024)

Definition at line 58 of file SDL_sysaudio.h.

Referenced by open_audio_device(), and SDL_QueueAudio().

Function Documentation

void SDL_AddAudioDevice ( const int  iscapture,
const char *  name,
void handle 
)

Definition at line 347 of file SDL_audio.c.

References add_capture_device(), add_output_device(), SDL_AUDIODEVICEADDED, SDL_ENABLE, SDL_GetEventState, SDL_PushEvent, and SDL_zero.

Referenced by SDL_AudioDetectDevices_Default().

348 {
349  const int device_index = iscapture ? add_capture_device(name, handle) : add_output_device(name, handle);
350  if (device_index != -1) {
351  /* Post the event, if desired */
354  SDL_zero(event);
355  event.adevice.type = SDL_AUDIODEVICEADDED;
356  event.adevice.which = device_index;
357  event.adevice.iscapture = iscapture;
358  SDL_PushEvent(&event);
359  }
360  }
361 }
static SDL_INLINE int add_output_device(const char *name, void *handle)
Definition: SDL_audio.c:324
#define SDL_ENABLE
Definition: SDL_events.h:718
GLuint const GLchar * name
#define SDL_GetEventState(type)
Definition: SDL_events.h:731
struct _cl_event * event
#define SDL_PushEvent
#define SDL_zero(x)
Definition: SDL_stdinc.h:355
static SDL_INLINE int add_capture_device(const char *name, void *handle)
Definition: SDL_audio.c:317
General event structure.
Definition: SDL_events.h:521
void SDL_OpenedAudioDeviceDisconnected ( SDL_AudioDevice device)

Definition at line 364 of file SDL_audio.c.

References SDL_AudioDevice::enabled, get_audio_device(), SDL_AudioDevice::id, SDL_AudioDriver::impl, SDL_AudioDevice::iscapture, SDL_AudioDriverImpl::LockDevice, SDL_assert, SDL_AUDIODEVICEREMOVED, SDL_ENABLE, SDL_GetEventState, SDL_PushEvent, SDL_zero, and SDL_AudioDriverImpl::UnlockDevice.

365 {
366  SDL_assert(get_audio_device(device->id) == device);
367 
368  if (!device->enabled) {
369  return;
370  }
371 
372  /* Ends the audio callback and mark the device as STOPPED, but the
373  app still needs to close the device to free resources. */
374  current_audio.impl.LockDevice(device);
375  device->enabled = 0;
377 
378  /* Post the event, if desired */
381  SDL_zero(event);
382  event.adevice.type = SDL_AUDIODEVICEREMOVED;
383  event.adevice.which = device->id;
384  event.adevice.iscapture = device->iscapture ? 1 : 0;
385  SDL_PushEvent(&event);
386  }
387 }
SDL_AudioDeviceID id
Definition: SDL_sysaudio.h:147
#define SDL_ENABLE
Definition: SDL_events.h:718
static SDL_AudioDriver current_audio
Definition: SDL_audio.c:33
void(* UnlockDevice)(_THIS)
Definition: SDL_sysaudio.h:81
#define SDL_GetEventState(type)
Definition: SDL_events.h:731
struct _cl_event * event
#define SDL_PushEvent
#define SDL_zero(x)
Definition: SDL_stdinc.h:355
void(* LockDevice)(_THIS)
Definition: SDL_sysaudio.h:80
#define SDL_assert(condition)
Definition: SDL_assert.h:167
SDL_AudioDriverImpl impl
Definition: SDL_sysaudio.h:120
General event structure.
Definition: SDL_events.h:521
static SDL_AudioDevice * get_audio_device(SDL_AudioDeviceID id)
Definition: SDL_audio.c:150
void SDL_RemoveAudioDevice ( const int  iscapture,
void handle 
)

Definition at line 405 of file SDL_audio.c.

References SDL_AudioDriver::captureDevicesRemoved, SDL_AudioDriver::detectionLock, SDL_AudioDriverImpl::FreeDeviceHandle, SDL_AudioDriver::impl, SDL_AudioDriver::inputDevices, mark_device_removed(), SDL_AudioDriver::outputDevices, SDL_AudioDriver::outputDevicesRemoved, SDL_LockMutex, and SDL_UnlockMutex.

406 {
408  if (iscapture) {
410  } else {
412  }
415 }
#define SDL_LockMutex
SDL_bool captureDevicesRemoved
Definition: SDL_sysaudio.h:124
static void mark_device_removed(void *handle, SDL_AudioDeviceItem *devices, SDL_bool *removedFlag)
Definition: SDL_audio.c:390
static SDL_AudioDriver current_audio
Definition: SDL_audio.c:33
SDL_mutex * detectionLock
Definition: SDL_sysaudio.h:123
SDL_AudioDeviceItem * outputDevices
Definition: SDL_sysaudio.h:128
SDL_bool outputDevicesRemoved
Definition: SDL_sysaudio.h:125
SDL_AudioDriverImpl impl
Definition: SDL_sysaudio.h:120
void(* FreeDeviceHandle)(void *handle)
Definition: SDL_sysaudio.h:82
#define SDL_UnlockMutex
SDL_AudioDeviceItem * inputDevices
Definition: SDL_sysaudio.h:129