PortAudio 2.0
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)
 
#define RATE_MAX_DEVIATE_RATIO   100
 
#define _PA_DEFINE_FUNC(x)
 
#define __alsa_snd_alloca(ptr, type)
 
#define alsa_snd_pcm_hw_params_alloca(ptr)
 
#define alsa_snd_pcm_sw_params_alloca(ptr)
 
#define alsa_snd_pcm_info_alloca(ptr)
 
#define alsa_snd_ctl_card_info_alloca(ptr)
 
#define alsa_snd_pcm_status_alloca(ptr)
 
#define alsa_snd_config_for_each(pos, next, node)
 
#define PA_ALSA_PATHNAME   "libasound.so.2"
 
#define _PA_LOAD_FUNC(x)
 
#define ENSURE_ON_ERROR_(expr, code, _on_error)
 
#define ENSURE_(expr, code)
 
#define ENSURE_NO_GOTO_(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)
 !!
 
 _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_htstamp)
 
 _PA_DEFINE_FUNC (snd_pcm_status_get_state)
 
 _PA_DEFINE_FUNC (snd_pcm_status_get_trigger_tstamp)
 
 _PA_DEFINE_FUNC (snd_pcm_status_get_trigger_htstamp)
 
 _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

◆ __alsa_snd_alloca

#define __alsa_snd_alloca ( ptr,
type )
Value:
do { size_t __alsa_alloca_size = alsa_##type##_sizeof(); (*ptr) = (type##_t *) alloca(__alsa_alloca_size); memset(*ptr, 0, __alsa_alloca_size); } while (0)

◆ _PA_DEFINE_FUNC

#define _PA_DEFINE_FUNC ( x)
Value:
typedef typeof(x) x##_ft; static x##_ft *alsa_##x = 0

◆ _PA_LOAD_FUNC

#define _PA_LOAD_FUNC ( x)
Value:
alsa_##x = &x

◆ ALSA_PCM_NEW_HW_PARAMS_API

#define ALSA_PCM_NEW_HW_PARAMS_API

◆ ALSA_PCM_NEW_SW_PARAMS_API

#define ALSA_PCM_NEW_SW_PARAMS_API

◆ alsa_snd_config_for_each

#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))

◆ alsa_snd_ctl_card_info_alloca

#define alsa_snd_ctl_card_info_alloca ( ptr)
Value:
__alsa_snd_alloca(ptr, snd_ctl_card_info)
#define __alsa_snd_alloca(ptr, type)
Definition pa_linux_alsa.c:97

◆ alsa_snd_pcm_hw_params_alloca

#define alsa_snd_pcm_hw_params_alloca ( ptr)
Value:
__alsa_snd_alloca(ptr, snd_pcm_hw_params)

◆ alsa_snd_pcm_info_alloca

#define alsa_snd_pcm_info_alloca ( ptr)
Value:
__alsa_snd_alloca(ptr, snd_pcm_info)

Referenced by PaAlsa_GetStreamInputCard(), and PaAlsa_GetStreamOutputCard().

◆ alsa_snd_pcm_status_alloca

#define alsa_snd_pcm_status_alloca ( ptr)
Value:
__alsa_snd_alloca(ptr, snd_pcm_status)

◆ alsa_snd_pcm_sw_params_alloca

#define alsa_snd_pcm_sw_params_alloca ( ptr)
Value:
__alsa_snd_alloca(ptr, snd_pcm_sw_params)

◆ ALSA_VERSION_INT

#define ALSA_VERSION_INT ( major,
minor,
subminor )
Value:
((major << 16) | (minor << 8) | subminor)

◆ ASSERT_CALL_

#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)

◆ ENSURE_

#define ENSURE_ ( expr,
code )
Value:
ENSURE_ON_ERROR_(expr, code, goto error)
#define ENSURE_ON_ERROR_(expr, code, _on_error)
Definition pa_linux_alsa.c:568

◆ ENSURE_NO_GOTO_

#define ENSURE_NO_GOTO_ ( expr,
code )
Value:
ENSURE_ON_ERROR_(expr, code, (void)0)

◆ ENSURE_ON_ERROR_

#define ENSURE_ON_ERROR_ ( expr,
code,
_on_error )
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: " PA_STRINGIZE( __LINE__ ) "\n" ); \
if( (code) == paUnanticipatedHostError ) \
PA_DEBUG(( "Host error description: %s\n", alsa_snd_strerror( __pa_unsure_error_id ) )); \
result = (code); \
_on_error; \
} \
} while (0)
pthread_t paUnixMainThread
Definition pa_unix_util.c:244
#define UNLIKELY(expr)
Definition pa_unix_util.h:66
#define PA_STRINGIZE(x)
Definition pa_util.h:58
@ paUnanticipatedHostError
Definition portaudio.h:128
@ paALSA
Definition portaudio.h:286

◆ PA_ALSA_PATHNAME

#define PA_ALSA_PATHNAME   "libasound.so.2"

◆ RATE_MAX_DEVIATE_RATIO

#define RATE_MAX_DEVIATE_RATIO   100

◆ SND_PCM_TSTAMP_ENABLE

#define SND_PCM_TSTAMP_ENABLE   SND_PCM_TSTAMP_MMAP

Typedef Documentation

◆ PaAlsaDeviceInfo

typedef struct PaAlsaDeviceInfo PaAlsaDeviceInfo

◆ PaAlsaHostApiRepresentation

typedef struct PaAlsaHostApiRepresentation PaAlsaHostApiRepresentation

◆ PaAlsaStream

typedef struct PaAlsaStream PaAlsaStream

Enumeration Type Documentation

◆ StreamDirection

Enumerator
StreamDirection_In 
StreamDirection_Out 

Function Documentation

◆ _PA_DEFINE_FUNC() [1/113]

_PA_DEFINE_FUNC ( snd_asoundlib_version )

◆ _PA_DEFINE_FUNC() [2/113]

_PA_DEFINE_FUNC ( snd_card_next )

◆ _PA_DEFINE_FUNC() [3/113]

_PA_DEFINE_FUNC ( snd_config )

◆ _PA_DEFINE_FUNC() [4/113]

_PA_DEFINE_FUNC ( snd_config_get_id )

◆ _PA_DEFINE_FUNC() [5/113]

_PA_DEFINE_FUNC ( snd_config_get_string )

◆ _PA_DEFINE_FUNC() [6/113]

_PA_DEFINE_FUNC ( snd_config_iterator_end )

◆ _PA_DEFINE_FUNC() [7/113]

_PA_DEFINE_FUNC ( snd_config_iterator_entry )

◆ _PA_DEFINE_FUNC() [8/113]

_PA_DEFINE_FUNC ( snd_config_iterator_first )

◆ _PA_DEFINE_FUNC() [9/113]

_PA_DEFINE_FUNC ( snd_config_iterator_next )

◆ _PA_DEFINE_FUNC() [10/113]

_PA_DEFINE_FUNC ( snd_config_search )

◆ _PA_DEFINE_FUNC() [11/113]

_PA_DEFINE_FUNC ( snd_config_update )

◆ _PA_DEFINE_FUNC() [12/113]

_PA_DEFINE_FUNC ( snd_config_update_free_global )

◆ _PA_DEFINE_FUNC() [13/113]

_PA_DEFINE_FUNC ( snd_ctl_card_info )

◆ _PA_DEFINE_FUNC() [14/113]

_PA_DEFINE_FUNC ( snd_ctl_card_info_free )

◆ _PA_DEFINE_FUNC() [15/113]

_PA_DEFINE_FUNC ( snd_ctl_card_info_get_name )

◆ _PA_DEFINE_FUNC() [16/113]

_PA_DEFINE_FUNC ( snd_ctl_card_info_malloc )

◆ _PA_DEFINE_FUNC() [17/113]

_PA_DEFINE_FUNC ( snd_ctl_card_info_sizeof )

◆ _PA_DEFINE_FUNC() [18/113]

_PA_DEFINE_FUNC ( snd_ctl_close )

◆ _PA_DEFINE_FUNC() [19/113]

_PA_DEFINE_FUNC ( snd_ctl_open )

◆ _PA_DEFINE_FUNC() [20/113]

_PA_DEFINE_FUNC ( snd_ctl_pcm_info )

◆ _PA_DEFINE_FUNC() [21/113]

_PA_DEFINE_FUNC ( snd_ctl_pcm_next_device )

◆ _PA_DEFINE_FUNC() [22/113]

_PA_DEFINE_FUNC ( snd_output_stdio_attach )

◆ _PA_DEFINE_FUNC() [23/113]

_PA_DEFINE_FUNC ( snd_pcm_area_copy )

◆ _PA_DEFINE_FUNC() [24/113]

_PA_DEFINE_FUNC ( snd_pcm_areas_silence )

◆ _PA_DEFINE_FUNC() [25/113]

_PA_DEFINE_FUNC ( snd_pcm_avail_update )

◆ _PA_DEFINE_FUNC() [26/113]

_PA_DEFINE_FUNC ( snd_pcm_close )

◆ _PA_DEFINE_FUNC() [27/113]

_PA_DEFINE_FUNC ( snd_pcm_delay )

◆ _PA_DEFINE_FUNC() [28/113]

_PA_DEFINE_FUNC ( snd_pcm_drain )

◆ _PA_DEFINE_FUNC() [29/113]

_PA_DEFINE_FUNC ( snd_pcm_drop )

◆ _PA_DEFINE_FUNC() [30/113]

_PA_DEFINE_FUNC ( snd_pcm_format_size )

◆ _PA_DEFINE_FUNC() [31/113]

_PA_DEFINE_FUNC ( snd_pcm_frames_to_bytes )

◆ _PA_DEFINE_FUNC() [32/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params )

◆ _PA_DEFINE_FUNC() [33/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_any )

◆ _PA_DEFINE_FUNC() [34/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_dump )

◆ _PA_DEFINE_FUNC() [35/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_free )

◆ _PA_DEFINE_FUNC() [36/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_buffer_size )

◆ _PA_DEFINE_FUNC() [37/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_buffer_size_max )

◆ _PA_DEFINE_FUNC() [38/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_channels_max )

◆ _PA_DEFINE_FUNC() [39/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_channels_min )

◆ _PA_DEFINE_FUNC() [40/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_period_size_max )

◆ _PA_DEFINE_FUNC() [41/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_period_size_min )

◆ _PA_DEFINE_FUNC() [42/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_periods_max )

◆ _PA_DEFINE_FUNC() [43/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_periods_min )

◆ _PA_DEFINE_FUNC() [44/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_rate_max )

◆ _PA_DEFINE_FUNC() [45/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_rate_min )

◆ _PA_DEFINE_FUNC() [46/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_get_rate_numden )

◆ _PA_DEFINE_FUNC() [47/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_malloc )

◆ _PA_DEFINE_FUNC() [48/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_access )

◆ _PA_DEFINE_FUNC() [49/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_buffer_size )

◆ _PA_DEFINE_FUNC() [50/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_buffer_size_min )

!!

◆ _PA_DEFINE_FUNC() [51/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_buffer_size_near )

◆ _PA_DEFINE_FUNC() [52/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_channels )

◆ _PA_DEFINE_FUNC() [53/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_format )

◆ _PA_DEFINE_FUNC() [54/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_period_size )

◆ _PA_DEFINE_FUNC() [55/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_period_size_near )

◆ _PA_DEFINE_FUNC() [56/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_periods_integer )

◆ _PA_DEFINE_FUNC() [57/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_periods_min )

◆ _PA_DEFINE_FUNC() [58/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_rate )

!!

◆ _PA_DEFINE_FUNC() [59/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_rate_near )

◆ _PA_DEFINE_FUNC() [60/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_set_rate_resample )

◆ _PA_DEFINE_FUNC() [61/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_sizeof )

◆ _PA_DEFINE_FUNC() [62/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_test_access )

◆ _PA_DEFINE_FUNC() [63/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_test_format )

◆ _PA_DEFINE_FUNC() [64/113]

_PA_DEFINE_FUNC ( snd_pcm_hw_params_test_period_size )

◆ _PA_DEFINE_FUNC() [65/113]

_PA_DEFINE_FUNC ( snd_pcm_info )

◆ _PA_DEFINE_FUNC() [66/113]

_PA_DEFINE_FUNC ( snd_pcm_info_free )

◆ _PA_DEFINE_FUNC() [67/113]

_PA_DEFINE_FUNC ( snd_pcm_info_get_card )

◆ _PA_DEFINE_FUNC() [68/113]

_PA_DEFINE_FUNC ( snd_pcm_info_get_name )

◆ _PA_DEFINE_FUNC() [69/113]

_PA_DEFINE_FUNC ( snd_pcm_info_malloc )

◆ _PA_DEFINE_FUNC() [70/113]

_PA_DEFINE_FUNC ( snd_pcm_info_set_device )

◆ _PA_DEFINE_FUNC() [71/113]

_PA_DEFINE_FUNC ( snd_pcm_info_set_stream )

◆ _PA_DEFINE_FUNC() [72/113]

_PA_DEFINE_FUNC ( snd_pcm_info_set_subdevice )

◆ _PA_DEFINE_FUNC() [73/113]

_PA_DEFINE_FUNC ( snd_pcm_info_sizeof )

◆ _PA_DEFINE_FUNC() [74/113]

_PA_DEFINE_FUNC ( snd_pcm_link )

◆ _PA_DEFINE_FUNC() [75/113]

_PA_DEFINE_FUNC ( snd_pcm_mmap_begin )

◆ _PA_DEFINE_FUNC() [76/113]

_PA_DEFINE_FUNC ( snd_pcm_mmap_commit )

◆ _PA_DEFINE_FUNC() [77/113]

_PA_DEFINE_FUNC ( snd_pcm_nonblock )

◆ _PA_DEFINE_FUNC() [78/113]

_PA_DEFINE_FUNC ( snd_pcm_open )

◆ _PA_DEFINE_FUNC() [79/113]

_PA_DEFINE_FUNC ( snd_pcm_poll_descriptors )

◆ _PA_DEFINE_FUNC() [80/113]

_PA_DEFINE_FUNC ( snd_pcm_poll_descriptors_count )

◆ _PA_DEFINE_FUNC() [81/113]

_PA_DEFINE_FUNC ( snd_pcm_poll_descriptors_revents )

◆ _PA_DEFINE_FUNC() [82/113]

_PA_DEFINE_FUNC ( snd_pcm_prepare )

◆ _PA_DEFINE_FUNC() [83/113]

_PA_DEFINE_FUNC ( snd_pcm_readi )

◆ _PA_DEFINE_FUNC() [84/113]

_PA_DEFINE_FUNC ( snd_pcm_readn )

◆ _PA_DEFINE_FUNC() [85/113]

_PA_DEFINE_FUNC ( snd_pcm_recover )

◆ _PA_DEFINE_FUNC() [86/113]

_PA_DEFINE_FUNC ( snd_pcm_resume )

◆ _PA_DEFINE_FUNC() [87/113]

_PA_DEFINE_FUNC ( snd_pcm_start )

◆ _PA_DEFINE_FUNC() [88/113]

_PA_DEFINE_FUNC ( snd_pcm_state )

◆ _PA_DEFINE_FUNC() [89/113]

_PA_DEFINE_FUNC ( snd_pcm_status )

◆ _PA_DEFINE_FUNC() [90/113]

_PA_DEFINE_FUNC ( snd_pcm_status_get_delay )

◆ _PA_DEFINE_FUNC() [91/113]

_PA_DEFINE_FUNC ( snd_pcm_status_get_htstamp )

◆ _PA_DEFINE_FUNC() [92/113]

_PA_DEFINE_FUNC ( snd_pcm_status_get_state )

◆ _PA_DEFINE_FUNC() [93/113]

_PA_DEFINE_FUNC ( snd_pcm_status_get_trigger_htstamp )

◆ _PA_DEFINE_FUNC() [94/113]

_PA_DEFINE_FUNC ( snd_pcm_status_get_trigger_tstamp )

◆ _PA_DEFINE_FUNC() [95/113]

_PA_DEFINE_FUNC ( snd_pcm_status_get_tstamp )

◆ _PA_DEFINE_FUNC() [96/113]

_PA_DEFINE_FUNC ( snd_pcm_status_sizeof )

◆ _PA_DEFINE_FUNC() [97/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params )

◆ _PA_DEFINE_FUNC() [98/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_current )

◆ _PA_DEFINE_FUNC() [99/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_free )

◆ _PA_DEFINE_FUNC() [100/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_get_boundary )

◆ _PA_DEFINE_FUNC() [101/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_malloc )

◆ _PA_DEFINE_FUNC() [102/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_avail_min )

◆ _PA_DEFINE_FUNC() [103/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_silence_size )

◆ _PA_DEFINE_FUNC() [104/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_silence_threshold )

◆ _PA_DEFINE_FUNC() [105/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_start_threshold )

◆ _PA_DEFINE_FUNC() [106/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_stop_threshold )

◆ _PA_DEFINE_FUNC() [107/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_tstamp_mode )

◆ _PA_DEFINE_FUNC() [108/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_set_xfer_align )

◆ _PA_DEFINE_FUNC() [109/113]

_PA_DEFINE_FUNC ( snd_pcm_sw_params_sizeof )

◆ _PA_DEFINE_FUNC() [110/113]

_PA_DEFINE_FUNC ( snd_pcm_wait )

◆ _PA_DEFINE_FUNC() [111/113]

_PA_DEFINE_FUNC ( snd_pcm_writei )

◆ _PA_DEFINE_FUNC() [112/113]

_PA_DEFINE_FUNC ( snd_pcm_writen )

◆ _PA_DEFINE_FUNC() [113/113]

_PA_DEFINE_FUNC ( snd_strerror )

◆ PaAlsa_EnableRealtimeScheduling()

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.

◆ PaAlsa_GetStreamInputCard()

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.

◆ PaAlsa_GetStreamOutputCard()

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.

◆ PaAlsa_Initialize()

◆ PaAlsa_InitializeStreamInfo()

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.

◆ PaAlsa_SetLibraryPathName()

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.

◆ PaAlsa_SetNumPeriods()

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.

◆ PaAlsa_SetRetriesBusy()

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

◆ predefinedNames

HwDevInfo predefinedNames[]