PortAudio  2.0
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
pa_linux_alsa.c File Reference
#include <alsa/asoundlib.h>
#include <sys/poll.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <pthread.h>
#include <signal.h>
#include <time.h>
#include <sys/mman.h>
#include "portaudio.h"
#include "pa_util.h"
#include "pa_unix_util.h"
#include "pa_allocation.h"
#include "pa_hostapi.h"
#include "pa_stream.h"
#include "pa_cpuload.h"
#include "pa_process.h"
#include "pa_endianness.h"
#include "pa_debugprint.h"
#include "pa_linux_alsa.h"

Data Structures

struct  PaAlsaStreamComponent
 
struct  PaAlsaStream
 
struct  PaAlsaHostApiRepresentation
 
struct  PaAlsaDeviceInfo
 
struct  HwDevInfo
 

Macros

#define ALSA_PCM_NEW_HW_PARAMS_API
 
#define ALSA_PCM_NEW_SW_PARAMS_API
 
#define SND_PCM_TSTAMP_ENABLE   SND_PCM_TSTAMP_MMAP
 
#define ALSA_VERSION_INT(major, minor, subminor)   ((major << 16) | (minor << 8) | subminor)
 
#define RATE_MAX_DEVIATE_RATIO   100
 
#define _PA_DEFINE_FUNC(x)   typedef typeof(x) x##_ft; static x##_ft *alsa_##x = 0
 
#define __alsa_snd_alloca(ptr, type)   do { size_t __alsa_alloca_size = alsa_##type##_sizeof(); (*ptr) = (type##_t *) alloca(__alsa_alloca_size); memset(*ptr, 0, __alsa_alloca_size); } while (0)
 
#define alsa_snd_pcm_hw_params_alloca(ptr)   __alsa_snd_alloca(ptr, snd_pcm_hw_params)
 
#define alsa_snd_pcm_sw_params_alloca(ptr)   __alsa_snd_alloca(ptr, snd_pcm_sw_params)
 
#define alsa_snd_pcm_info_alloca(ptr)   __alsa_snd_alloca(ptr, snd_pcm_info)
 
#define alsa_snd_ctl_card_info_alloca(ptr)   __alsa_snd_alloca(ptr, snd_ctl_card_info)
 
#define alsa_snd_pcm_status_alloca(ptr)   __alsa_snd_alloca(ptr, snd_pcm_status)
 
#define alsa_snd_config_for_each(pos, next, node)
 
#define PA_ALSA_PATHNAME   "libasound.so"
 
#define _PA_LOAD_FUNC(x)   alsa_##x = &x
 
#define ENSURE_(expr, code)
 
#define ASSERT_CALL_(expr, success)
 

Typedefs

typedef struct PaAlsaStream PaAlsaStream
 
typedef struct
PaAlsaHostApiRepresentation 
PaAlsaHostApiRepresentation
 
typedef struct PaAlsaDeviceInfo PaAlsaDeviceInfo
 

Enumerations

enum  StreamDirection { StreamDirection_In, StreamDirection_Out }
 

Functions

 _PA_DEFINE_FUNC (snd_pcm_open)
 
 _PA_DEFINE_FUNC (snd_pcm_close)
 
 _PA_DEFINE_FUNC (snd_pcm_nonblock)
 
 _PA_DEFINE_FUNC (snd_pcm_frames_to_bytes)
 
 _PA_DEFINE_FUNC (snd_pcm_prepare)
 
 _PA_DEFINE_FUNC (snd_pcm_start)
 
 _PA_DEFINE_FUNC (snd_pcm_resume)
 
 _PA_DEFINE_FUNC (snd_pcm_wait)
 
 _PA_DEFINE_FUNC (snd_pcm_state)
 
 _PA_DEFINE_FUNC (snd_pcm_avail_update)
 
 _PA_DEFINE_FUNC (snd_pcm_areas_silence)
 
 _PA_DEFINE_FUNC (snd_pcm_mmap_begin)
 
 _PA_DEFINE_FUNC (snd_pcm_mmap_commit)
 
 _PA_DEFINE_FUNC (snd_pcm_readi)
 
 _PA_DEFINE_FUNC (snd_pcm_readn)
 
 _PA_DEFINE_FUNC (snd_pcm_writei)
 
 _PA_DEFINE_FUNC (snd_pcm_writen)
 
 _PA_DEFINE_FUNC (snd_pcm_drain)
 
 _PA_DEFINE_FUNC (snd_pcm_recover)
 
 _PA_DEFINE_FUNC (snd_pcm_drop)
 
 _PA_DEFINE_FUNC (snd_pcm_area_copy)
 
 _PA_DEFINE_FUNC (snd_pcm_poll_descriptors)
 
 _PA_DEFINE_FUNC (snd_pcm_poll_descriptors_count)
 
 _PA_DEFINE_FUNC (snd_pcm_poll_descriptors_revents)
 
 _PA_DEFINE_FUNC (snd_pcm_format_size)
 
 _PA_DEFINE_FUNC (snd_pcm_link)
 
 _PA_DEFINE_FUNC (snd_pcm_delay)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_sizeof)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_malloc)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_free)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_any)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_access)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_format)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_channels)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_rate_near)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_rate)
 !! More...
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_rate_resample)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_buffer_size)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_buffer_size_near)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_buffer_size_min)
 !! More...
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_period_size_near)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_periods_integer)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_periods_min)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_buffer_size)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_channels_min)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_channels_max)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_test_period_size)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_test_format)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_test_access)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_dump)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_periods_min)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_periods_max)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_set_period_size)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_period_size_min)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_period_size_max)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_buffer_size_max)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_rate_min)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_rate_max)
 
 _PA_DEFINE_FUNC (snd_pcm_hw_params_get_rate_numden)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_sizeof)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_malloc)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_current)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_set_avail_min)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_free)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_set_start_threshold)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_set_stop_threshold)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_get_boundary)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_set_silence_threshold)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_set_silence_size)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_set_xfer_align)
 
 _PA_DEFINE_FUNC (snd_pcm_sw_params_set_tstamp_mode)
 
 _PA_DEFINE_FUNC (snd_pcm_info)
 
 _PA_DEFINE_FUNC (snd_pcm_info_sizeof)
 
 _PA_DEFINE_FUNC (snd_pcm_info_malloc)
 
 _PA_DEFINE_FUNC (snd_pcm_info_free)
 
 _PA_DEFINE_FUNC (snd_pcm_info_set_device)
 
 _PA_DEFINE_FUNC (snd_pcm_info_set_subdevice)
 
 _PA_DEFINE_FUNC (snd_pcm_info_set_stream)
 
 _PA_DEFINE_FUNC (snd_pcm_info_get_name)
 
 _PA_DEFINE_FUNC (snd_pcm_info_get_card)
 
 _PA_DEFINE_FUNC (snd_ctl_pcm_next_device)
 
 _PA_DEFINE_FUNC (snd_ctl_pcm_info)
 
 _PA_DEFINE_FUNC (snd_ctl_open)
 
 _PA_DEFINE_FUNC (snd_ctl_close)
 
 _PA_DEFINE_FUNC (snd_ctl_card_info_malloc)
 
 _PA_DEFINE_FUNC (snd_ctl_card_info_free)
 
 _PA_DEFINE_FUNC (snd_ctl_card_info)
 
 _PA_DEFINE_FUNC (snd_ctl_card_info_sizeof)
 
 _PA_DEFINE_FUNC (snd_ctl_card_info_get_name)
 
 _PA_DEFINE_FUNC (snd_config)
 
 _PA_DEFINE_FUNC (snd_config_update)
 
 _PA_DEFINE_FUNC (snd_config_search)
 
 _PA_DEFINE_FUNC (snd_config_iterator_entry)
 
 _PA_DEFINE_FUNC (snd_config_iterator_first)
 
 _PA_DEFINE_FUNC (snd_config_iterator_end)
 
 _PA_DEFINE_FUNC (snd_config_iterator_next)
 
 _PA_DEFINE_FUNC (snd_config_get_string)
 
 _PA_DEFINE_FUNC (snd_config_get_id)
 
 _PA_DEFINE_FUNC (snd_config_update_free_global)
 
 _PA_DEFINE_FUNC (snd_pcm_status)
 
 _PA_DEFINE_FUNC (snd_pcm_status_sizeof)
 
 _PA_DEFINE_FUNC (snd_pcm_status_get_tstamp)
 
 _PA_DEFINE_FUNC (snd_pcm_status_get_state)
 
 _PA_DEFINE_FUNC (snd_pcm_status_get_trigger_tstamp)
 
 _PA_DEFINE_FUNC (snd_pcm_status_get_delay)
 
 _PA_DEFINE_FUNC (snd_card_next)
 
 _PA_DEFINE_FUNC (snd_asoundlib_version)
 
 _PA_DEFINE_FUNC (snd_strerror)
 
 _PA_DEFINE_FUNC (snd_output_stdio_attach)
 
void PaAlsa_SetLibraryPathName (const char *pathName)
 
int PaAlsa_SetNumPeriods (int numPeriods)
 
PaError PaAlsa_Initialize (PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex)
 
void PaAlsa_InitializeStreamInfo (PaAlsaStreamInfo *info)
 
void PaAlsa_EnableRealtimeScheduling (PaStream *s, int enable)
 
PaError PaAlsa_GetStreamInputCard (PaStream *s, int *card)
 
PaError PaAlsa_GetStreamOutputCard (PaStream *s, int *card)
 
PaError PaAlsa_SetRetriesBusy (int retries)
 

Variables

HwDevInfo predefinedNames []
 

Macro Definition Documentation

#define __alsa_snd_alloca (   ptr,
  type 
)    do { size_t __alsa_alloca_size = alsa_##type##_sizeof(); (*ptr) = (type##_t *) alloca(__alsa_alloca_size); memset(*ptr, 0, __alsa_alloca_size); } while (0)
#define _PA_DEFINE_FUNC (   x)    typedef typeof(x) x##_ft; static x##_ft *alsa_##x = 0
#define _PA_LOAD_FUNC (   x)    alsa_##x = &x
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
#define alsa_snd_config_for_each (   pos,
  next,
  node 
)
Value:
for (pos = alsa_snd_config_iterator_first(node),\
next = alsa_snd_config_iterator_next(pos);\
pos != alsa_snd_config_iterator_end(node); pos = next, next = alsa_snd_config_iterator_next(pos))
#define alsa_snd_ctl_card_info_alloca (   ptr)    __alsa_snd_alloca(ptr, snd_ctl_card_info)
#define alsa_snd_pcm_hw_params_alloca (   ptr)    __alsa_snd_alloca(ptr, snd_pcm_hw_params)
#define alsa_snd_pcm_info_alloca (   ptr)    __alsa_snd_alloca(ptr, snd_pcm_info)
#define alsa_snd_pcm_status_alloca (   ptr)    __alsa_snd_alloca(ptr, snd_pcm_status)
#define alsa_snd_pcm_sw_params_alloca (   ptr)    __alsa_snd_alloca(ptr, snd_pcm_sw_params)
#define ALSA_VERSION_INT (   major,
  minor,
  subminor 
)    ((major << 16) | (minor << 8) | subminor)
#define ASSERT_CALL_ (   expr,
  success 
)
Value:
do {\
int __pa_assert_error_id;\
__pa_assert_error_id = (expr);\
assert( success == __pa_assert_error_id );\
} while (0)
#define ENSURE_ (   expr,
  code 
)
Value:
do { \
int __pa_unsure_error_id;\
if( UNLIKELY( (__pa_unsure_error_id = (expr)) < 0 ) ) \
{ \
/* PaUtil_SetLastHostErrorInfo should only be used in the main thread */ \
if( (code) == paUnanticipatedHostError && pthread_equal( pthread_self(), paUnixMainThread) ) \
{ \
PaUtil_SetLastHostErrorInfo( paALSA, __pa_unsure_error_id, alsa_snd_strerror( __pa_unsure_error_id ) ); \
} \
PaUtil_DebugPrint( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" ); \
if( (code) == paUnanticipatedHostError ) \
PA_DEBUG(( "Host error description: %s\n", alsa_snd_strerror( __pa_unsure_error_id ) )); \
result = (code); \
goto error; \
} \
} while (0)
void PaUtil_SetLastHostErrorInfo(PaHostApiTypeId hostApiType, long errorCode, const char *errorText)
Definition: pa_front.c:145
#define UNLIKELY(expr)
Definition: pa_unix_util.h:64
Definition: portaudio.h:127
pthread_t paUnixMainThread
Definition: pa_unix_util.c:236
Definition: portaudio.h:284
#define STRINGIZE(expr)
Definition: pa_jack.c:79
void PaUtil_DebugPrint(const char *format,...)
Definition: pa_debugprint.c:88
#define PA_DEBUG(x)
Definition: pa_debugprint.h:99
#define PA_ALSA_PATHNAME   "libasound.so"
#define RATE_MAX_DEVIATE_RATIO   100
#define SND_PCM_TSTAMP_ENABLE   SND_PCM_TSTAMP_MMAP

Typedef Documentation

typedef struct PaAlsaStream PaAlsaStream

Enumeration Type Documentation

Enumerator
StreamDirection_In 
StreamDirection_Out 

Function Documentation

_PA_DEFINE_FUNC ( snd_pcm_open  )
_PA_DEFINE_FUNC ( snd_pcm_close  )
_PA_DEFINE_FUNC ( snd_pcm_nonblock  )
_PA_DEFINE_FUNC ( snd_pcm_frames_to_bytes  )
_PA_DEFINE_FUNC ( snd_pcm_prepare  )
_PA_DEFINE_FUNC ( snd_pcm_start  )
_PA_DEFINE_FUNC ( snd_pcm_resume  )
_PA_DEFINE_FUNC ( snd_pcm_wait  )
_PA_DEFINE_FUNC ( snd_pcm_state  )
_PA_DEFINE_FUNC ( snd_pcm_avail_update  )
_PA_DEFINE_FUNC ( snd_pcm_areas_silence  )
_PA_DEFINE_FUNC ( snd_pcm_mmap_begin  )
_PA_DEFINE_FUNC ( snd_pcm_mmap_commit  )
_PA_DEFINE_FUNC ( snd_pcm_readi  )
_PA_DEFINE_FUNC ( snd_pcm_readn  )
_PA_DEFINE_FUNC ( snd_pcm_writei  )
_PA_DEFINE_FUNC ( snd_pcm_writen  )
_PA_DEFINE_FUNC ( snd_pcm_drain  )
_PA_DEFINE_FUNC ( snd_pcm_recover  )
_PA_DEFINE_FUNC ( snd_pcm_drop  )
_PA_DEFINE_FUNC ( snd_pcm_area_copy  )
_PA_DEFINE_FUNC ( snd_pcm_poll_descriptors  )
_PA_DEFINE_FUNC ( snd_pcm_poll_descriptors_count  )
_PA_DEFINE_FUNC ( snd_pcm_poll_descriptors_revents  )
_PA_DEFINE_FUNC ( snd_pcm_format_size  )
_PA_DEFINE_FUNC ( snd_pcm_link  )
_PA_DEFINE_FUNC ( snd_pcm_delay  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_sizeof  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_malloc  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_free  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_any  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_access  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_format  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_channels  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_rate_near  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_rate  )

!!

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_rate_resample  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_buffer_size  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_buffer_size_near  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_buffer_size_min  )

!!

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_period_size_near  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_periods_integer  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_periods_min  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_buffer_size  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_channels_min  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_channels_max  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_test_period_size  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_test_format  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_test_access  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_dump  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_periods_min  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_periods_max  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_period_size  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_period_size_min  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_period_size_max  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_buffer_size_max  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_rate_min  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_rate_max  )
_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_rate_numden  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_sizeof  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_malloc  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_current  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_avail_min  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_free  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_start_threshold  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_stop_threshold  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_get_boundary  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_silence_threshold  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_silence_size  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_xfer_align  )
_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_tstamp_mode  )
_PA_DEFINE_FUNC ( snd_pcm_info  )
_PA_DEFINE_FUNC ( snd_pcm_info_sizeof  )
_PA_DEFINE_FUNC ( snd_pcm_info_malloc  )
_PA_DEFINE_FUNC ( snd_pcm_info_free  )
_PA_DEFINE_FUNC ( snd_pcm_info_set_device  )
_PA_DEFINE_FUNC ( snd_pcm_info_set_subdevice  )
_PA_DEFINE_FUNC ( snd_pcm_info_set_stream  )
_PA_DEFINE_FUNC ( snd_pcm_info_get_name  )
_PA_DEFINE_FUNC ( snd_pcm_info_get_card  )
_PA_DEFINE_FUNC ( snd_ctl_pcm_next_device  )
_PA_DEFINE_FUNC ( snd_ctl_pcm_info  )
_PA_DEFINE_FUNC ( snd_ctl_open  )
_PA_DEFINE_FUNC ( snd_ctl_close  )
_PA_DEFINE_FUNC ( snd_ctl_card_info_malloc  )
_PA_DEFINE_FUNC ( snd_ctl_card_info_free  )
_PA_DEFINE_FUNC ( snd_ctl_card_info  )
_PA_DEFINE_FUNC ( snd_ctl_card_info_sizeof  )
_PA_DEFINE_FUNC ( snd_ctl_card_info_get_name  )
_PA_DEFINE_FUNC ( snd_config  )
_PA_DEFINE_FUNC ( snd_config_update  )
_PA_DEFINE_FUNC ( snd_config_search  )
_PA_DEFINE_FUNC ( snd_config_iterator_entry  )
_PA_DEFINE_FUNC ( snd_config_iterator_first  )
_PA_DEFINE_FUNC ( snd_config_iterator_end  )
_PA_DEFINE_FUNC ( snd_config_iterator_next  )
_PA_DEFINE_FUNC ( snd_config_get_string  )
_PA_DEFINE_FUNC ( snd_config_get_id  )
_PA_DEFINE_FUNC ( snd_config_update_free_global  )
_PA_DEFINE_FUNC ( snd_pcm_status  )
_PA_DEFINE_FUNC ( snd_pcm_status_sizeof  )
_PA_DEFINE_FUNC ( snd_pcm_status_get_tstamp  )
_PA_DEFINE_FUNC ( snd_pcm_status_get_state  )
_PA_DEFINE_FUNC ( snd_pcm_status_get_trigger_tstamp  )
_PA_DEFINE_FUNC ( snd_pcm_status_get_delay  )
_PA_DEFINE_FUNC ( snd_card_next  )
_PA_DEFINE_FUNC ( snd_asoundlib_version  )
_PA_DEFINE_FUNC ( snd_strerror  )
_PA_DEFINE_FUNC ( snd_output_stdio_attach  )
void PaAlsa_EnableRealtimeScheduling ( PaStream s,
int  enable 
)

Instruct whether to enable real-time priority when starting the audio thread.

If this is turned on by the stream is started, the audio callback thread will be created with the FIFO scheduling policy, which is suitable for realtime operation.

References PaAlsaStream::rtSched.

PaError PaAlsa_GetStreamInputCard ( PaStream s,
int *  card 
)

Get the ALSA-lib card index of this stream's input device.

References alsa_snd_pcm_info_alloca, PaAlsaStream::capture, PA_ENSURE, PA_UNLESS, paDeviceUnavailable, paNoError, and PaAlsaStreamComponent::pcm.

PaError PaAlsa_GetStreamOutputCard ( PaStream s,
int *  card 
)

Get the ALSA-lib card index of this stream's output device.

References alsa_snd_pcm_info_alloca, PA_ENSURE, PA_UNLESS, paDeviceUnavailable, paNoError, PaAlsaStreamComponent::pcm, and PaAlsaStream::playback.

PaError PaAlsa_Initialize ( PaUtilHostApiRepresentation **  hostApi,
PaHostApiIndex  hostApiIndex 
)
void PaAlsa_InitializeStreamInfo ( PaAlsaStreamInfo info)

Initialize host API specific structure, call this before setting relevant attributes.

References PaAlsaStreamInfo::deviceString, PaAlsaStreamInfo::hostApiType, paALSA, PaAlsaStreamInfo::size, and PaAlsaStreamInfo::version.

void PaAlsa_SetLibraryPathName ( const char *  pathName)

Set the path and name of ALSA library file if PortAudio is configured to load it dynamically (see PA_ALSA_DYNAMIC). This setting will overwrite the default name set by PA_ALSA_PATHNAME define.

Parameters
pathNameFull path with filename. Only filename can be used, but dlopen() will lookup default searchable directories (/usr/lib;/usr/local/lib) then.
int PaAlsa_SetNumPeriods ( int  numPeriods)

Set the number of periods (buffer fragments) to configure devices with.

By default the number of periods is 4, this is the lowest number of periods that works well on the author's soundcard.

Parameters
numPeriodsThe number of periods.

References paNoError.

PaError PaAlsa_SetRetriesBusy ( int  retries)

Set the maximum number of times to retry opening busy device (sleeping for a short interval inbetween).

References paNoError.

Variable Documentation

HwDevInfo predefinedNames[]