spAudio
Loading...
Searching...
No Matches
Audio I/O

Data Structures

class  spAudio
 A class to handle audio I/O. More...
 

Macros

#define SP_AUDIO_BLOCKING   0
 
#define SP_AUDIO_NONBLOCKING   1
 
#define SP_AUDIO_NO_CALLBACK   0
 
#define SP_AUDIO_OUTPUT_POSITION_CALLBACK   (1<<0)
 
#define SP_AUDIO_OUTPUT_BUFFER_CALLBACK   (1<<2)
 
#define spFreeAudioDriver(audio)   {_spFreeAudioDriver(audio); (audio) = NULL;}
 

Typedefs

typedef struct _spAudio * spAudio
 
typedef unsigned long spAudioCallbackType
 
typedef spBool(* spAudioCallbackFunc) (spAudio audio, spAudioCallbackType call_type, void *data1, void *data2, void *user_data)
 

Functions

int spGetNumAudioDriver (void)
 
char * xspGetAudioDriverName (int index)
 
int spGetNumAudioDriverDevice (const char *driver_name)
 
char * xspGetAudioDriverDeviceName (const char *driver_name, int index)
 

Detailed Description

Macro Definition Documentation

◆ SP_AUDIO_BLOCKING

#define SP_AUDIO_BLOCKING   0

Constant to enable blocking mode for spSetAudioBlockingMode() .

◆ SP_AUDIO_NONBLOCKING

#define SP_AUDIO_NONBLOCKING   1

Constant to disable blocking mode for spSetAudioBlockingMode() .

Examples
rec.c.

◆ SP_AUDIO_NO_CALLBACK

#define SP_AUDIO_NO_CALLBACK   0

No callback exists.

◆ SP_AUDIO_OUTPUT_POSITION_CALLBACK

#define SP_AUDIO_OUTPUT_POSITION_CALLBACK   (1<<0)

Called when the playback position changed.
data1: spLong *position, data2: NULL

Examples
playsin.c.

◆ SP_AUDIO_OUTPUT_BUFFER_CALLBACK

#define SP_AUDIO_OUTPUT_BUFFER_CALLBACK   (1<<2)

Called when the current buffer finished.
data1: void *buffer, data2: long *buffer_length

◆ spFreeAudioDriver

#define spFreeAudioDriver ( audio)    {_spFreeAudioDriver(audio); (audio) = NULL;}

Frees the audio driver's resources (destructor).

Parameters
[in]audiospAudio type variable obtained by spInitAudioDriver() .
Examples
driver.c, iotest.c, playsin.c, and rec.c.

Typedef Documentation

◆ spAudio

typedef struct _spAudio* spAudio

Definition of spAudio.

◆ spAudioCallbackType

typedef unsigned long spAudioCallbackType

Type used for spSetAudioCallbackFunc() . Must be a combination of SP_AUDIO_*_CALLBACK.

◆ spAudioCallbackFunc

typedef spBool(* spAudioCallbackFunc) (spAudio audio, spAudioCallbackType call_type, void *data1, void *data2, void *user_data)

Signature of the callback function for spSetAudioCallbackFunc() .

Function Documentation

◆ spGetNumAudioDriver()

int spGetNumAudioDriver ( void )
extern

Gets the number of audio drivers.

Examples
driver.c.

◆ xspGetAudioDriverName()

char * xspGetAudioDriverName ( int index)
extern

Gets the name of the audio driver identified by the index.

Parameters
[in]index0-based index. You can specify an index from 0 to ( spGetNumAudioDriver() - 1).
Returns
A null-terminated string indicating the name of the audio driver. You have to deallocate the memory by calling xspFree() .
Examples
driver.c.

◆ spGetNumAudioDriverDevice()

int spGetNumAudioDriverDevice ( const char * driver_name)
extern

Gets the number of devices for the audio driver. If driver_name == NULL, this function gets it for all drivers.

Parameters
[in]driver_nameA null-terminated string of the driver name.
Returns
The numer of the device; or -1 if failed.
Examples
driver.c.

◆ xspGetAudioDriverDeviceName()

char * xspGetAudioDriverDeviceName ( const char * driver_name,
int index )
extern

Gets the name of the audio device for the audio driver. If driver_name == NULL, this function gets it for all drivers.

Parameters
[in]driver_nameA null-terminated string of the driver name.
[in]index0-based index. You can specify an index from 0 to ( spGetNumAudioDriverDevice() - 1).
Returns
A null-terminated string indicating the name of the device. You have to deallocate the memory by calling xspFree() .
Examples
driver.c.