huge correction of tabulators and whitespaces

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-07 14:27:38 +01:00
parent b37ac0982b
commit 66a3d542ac
157 changed files with 2008 additions and 2008 deletions

View file

@ -50,7 +50,7 @@ char *command;
fprintf(stderr, ##args); \ fprintf(stderr, ##args); \
putc('\n', stderr); \ putc('\n', stderr); \
} while (0) } while (0)
#endif #endif
#define SYSERROR(string) ERROR(string ": %s", strerror(errno)) #define SYSERROR(string) ERROR(string ": %s", strerror(errno))
@ -67,7 +67,7 @@ static int make_local_socket(const char *filename)
SYSERROR("socket failed"); SYSERROR("socket failed");
return result; return result;
} }
unlink(filename); unlink(filename);
addr->sun_family = AF_LOCAL; addr->sun_family = AF_LOCAL;
@ -94,7 +94,7 @@ static int make_inet_socket(int port)
SYSERROR("socket failed"); SYSERROR("socket failed");
return result; return result;
} }
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = htons(port); addr.sin_port = htons(port);
@ -329,7 +329,7 @@ static int pcm_shm_close(client_t *client)
} }
err = snd_pcm_close(client->device.pcm.handle); err = snd_pcm_close(client->device.pcm.handle);
ctrl->result = err; ctrl->result = err;
if (err < 0) if (err < 0)
ERROR("snd_pcm_close"); ERROR("snd_pcm_close");
if (client->transport.shm.ctrl) { if (client->transport.shm.ctrl) {
err = shmdt((void *)client->transport.shm.ctrl); err = shmdt((void *)client->transport.shm.ctrl);
@ -592,7 +592,7 @@ static int ctl_shm_close(client_t *client)
} }
err = snd_ctl_close(client->device.ctl.handle); err = snd_ctl_close(client->device.ctl.handle);
ctrl->result = err; ctrl->result = err;
if (err < 0) if (err < 0)
ERROR("snd_ctl_close"); ERROR("snd_ctl_close");
if (client->transport.shm.ctrl) { if (client->transport.shm.ctrl) {
err = shmdt((void *)client->transport.shm.ctrl); err = shmdt((void *)client->transport.shm.ctrl);
@ -1005,7 +1005,7 @@ static int server(const char *sockname, int port)
free(waiters); free(waiters);
return result; return result;
} }
static void usage(void) static void usage(void)
{ {

View file

@ -56,8 +56,8 @@
#define use_symbol_version(real, name, version) /* nothing */ #define use_symbol_version(real, name, version) /* nothing */
#if defined(__alpha__) || defined(__mips__) #if defined(__alpha__) || defined(__mips__)
#define use_default_symbol_version(real, name, version) \ #define use_default_symbol_version(real, name, version) \
__asm__ (".weak " ASM_NAME(#name)); \ __asm__ (".weak " ASM_NAME(#name)); \
__asm__ (ASM_NAME(#name) " = " ASM_NAME(#real)) __asm__ (ASM_NAME(#name) " = " ASM_NAME(#real))
#else #else
#define use_default_symbol_version(real, name, version) \ #define use_default_symbol_version(real, name, version) \
__asm__ (".weak " ASM_NAME(#name)); \ __asm__ (".weak " ASM_NAME(#name)); \

View file

@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "../src/pcm/pcm_local.h" #include "../src/pcm/pcm_local.h"
#include "../src/control/control_local.h" #include "../src/control/control_local.h"
#include <netdb.h> #include <netdb.h>
@ -106,7 +106,7 @@ typedef struct {
} snd_pcm_shm_ctrl_t; } snd_pcm_shm_ctrl_t;
#define PCM_SHM_SIZE sizeof(snd_pcm_shm_ctrl_t) #define PCM_SHM_SIZE sizeof(snd_pcm_shm_ctrl_t)
#define SND_CTL_IOCTL_READ _IOR('U', 0xf1, snd_ctl_event_t) #define SND_CTL_IOCTL_READ _IOR('U', 0xf1, snd_ctl_event_t)
#define SND_CTL_IOCTL_CLOSE _IO ('U', 0xf2) #define SND_CTL_IOCTL_CLOSE _IO ('U', 0xf2)
#define SND_CTL_IOCTL_POLL_DESCRIPTOR _IO ('U', 0xf3) #define SND_CTL_IOCTL_POLL_DESCRIPTOR _IO ('U', 0xf3)

View file

@ -52,15 +52,15 @@ extern "C" {
/** \brief Configuration node type. */ /** \brief Configuration node type. */
typedef enum _snd_config_type { typedef enum _snd_config_type {
/** Integer number. */ /** Integer number. */
SND_CONFIG_TYPE_INTEGER, SND_CONFIG_TYPE_INTEGER,
/** 64-bit integer number. */ /** 64-bit integer number. */
SND_CONFIG_TYPE_INTEGER64, SND_CONFIG_TYPE_INTEGER64,
/** Real number. */ /** Real number. */
SND_CONFIG_TYPE_REAL, SND_CONFIG_TYPE_REAL,
/** Character string. */ /** Character string. */
SND_CONFIG_TYPE_STRING, SND_CONFIG_TYPE_STRING,
/** Pointer (runtime only, cannot be saved). */ /** Pointer (runtime only, cannot be saved). */
SND_CONFIG_TYPE_POINTER, SND_CONFIG_TYPE_POINTER,
/** Compound node. */ /** Compound node. */
SND_CONFIG_TYPE_COMPOUND = 1024 SND_CONFIG_TYPE_COMPOUND = 1024
} snd_config_type_t; } snd_config_type_t;
@ -108,7 +108,7 @@ void snd_config_unref(snd_config_t *top);
int snd_config_search(snd_config_t *config, const char *key, int snd_config_search(snd_config_t *config, const char *key,
snd_config_t **result); snd_config_t **result);
int snd_config_searchv(snd_config_t *config, int snd_config_searchv(snd_config_t *config,
snd_config_t **result, ...); snd_config_t **result, ...);
int snd_config_search_definition(snd_config_t *config, int snd_config_search_definition(snd_config_t *config,
const char *base, const char *key, const char *base, const char *key,
@ -122,7 +122,7 @@ int snd_config_search_definition(snd_config_t *config,
* \param[in] private_data Handle to the \c private_data node. * \param[in] private_data Handle to the \c private_data node.
* \return A non-negative value if successful, otherwise a negative error code. * \return A non-negative value if successful, otherwise a negative error code.
* *
* Use a function of this type to define a custom expansion * Use a function of this type to define a custom expansion
*/ */
typedef int (*snd_config_expand_fcn_t)(snd_config_t **dst, const char *s, void *private_data); typedef int (*snd_config_expand_fcn_t)(snd_config_t **dst, const char *s, void *private_data);

View file

@ -386,7 +386,7 @@ int snd_ctl_open_fallback(snd_ctl_t **ctl, snd_config_t *root, const char *name,
int snd_ctl_close(snd_ctl_t *ctl); int snd_ctl_close(snd_ctl_t *ctl);
int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock); int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock);
static __inline__ int snd_ctl_abort(snd_ctl_t *ctl) { return snd_ctl_nonblock(ctl, 2); } static __inline__ int snd_ctl_abort(snd_ctl_t *ctl) { return snd_ctl_nonblock(ctl, 2); }
int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl, int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
snd_async_callback_t callback, void *private_data); snd_async_callback_t callback, void *private_data);
snd_ctl_t *snd_async_handler_get_ctl(snd_async_handler_t *handler); snd_ctl_t *snd_async_handler_get_ctl(snd_async_handler_t *handler);
int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl); int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl);
@ -718,7 +718,7 @@ typedef int (*snd_hctl_compare_t)(const snd_hctl_elem_t *e1,
const snd_hctl_elem_t *e2); const snd_hctl_elem_t *e2);
int snd_hctl_compare_fast(const snd_hctl_elem_t *c1, int snd_hctl_compare_fast(const snd_hctl_elem_t *c1,
const snd_hctl_elem_t *c2); const snd_hctl_elem_t *c2);
/** /**
* \brief HCTL callback function * \brief HCTL callback function
* \param hctl HCTL handle * \param hctl HCTL handle
* \param mask event mask * \param mask event mask
@ -728,7 +728,7 @@ int snd_hctl_compare_fast(const snd_hctl_elem_t *c1,
typedef int (*snd_hctl_callback_t)(snd_hctl_t *hctl, typedef int (*snd_hctl_callback_t)(snd_hctl_t *hctl,
unsigned int mask, unsigned int mask,
snd_hctl_elem_t *elem); snd_hctl_elem_t *elem);
/** /**
* \brief HCTL element callback function * \brief HCTL element callback function
* \param elem HCTL element * \param elem HCTL element
* \param mask event mask * \param mask event mask

View file

@ -124,7 +124,7 @@ typedef struct _snd_async_handler snd_async_handler_t;
*/ */
typedef void (*snd_async_callback_t)(snd_async_handler_t *handler); typedef void (*snd_async_callback_t)(snd_async_handler_t *handler);
int snd_async_add_handler(snd_async_handler_t **handler, int fd, int snd_async_add_handler(snd_async_handler_t **handler, int fd,
snd_async_callback_t callback, void *private_data); snd_async_callback_t callback, void *private_data);
int snd_async_del_handler(snd_async_handler_t *handler); int snd_async_del_handler(snd_async_handler_t *handler);
int snd_async_handler_get_fd(snd_async_handler_t *handler); int snd_async_handler_get_fd(snd_async_handler_t *handler);

View file

@ -385,7 +385,7 @@ int snd_config_check_hop(snd_config_t *conf);
#define SND_CONF_MAX_HOPS 64 #define SND_CONF_MAX_HOPS 64
int snd_config_search_alias_hooks(snd_config_t *config, int snd_config_search_alias_hooks(snd_config_t *config,
const char *base, const char *key, const char *base, const char *key,
snd_config_t **result); snd_config_t **result);
int _snd_conf_generic_id(const char *id); int _snd_conf_generic_id(const char *id);

View file

@ -51,7 +51,7 @@ typedef struct _snd_mixer_class snd_mixer_class_t;
/** Mixer element handle */ /** Mixer element handle */
typedef struct _snd_mixer_elem snd_mixer_elem_t; typedef struct _snd_mixer_elem snd_mixer_elem_t;
/** /**
* \brief Mixer callback function * \brief Mixer callback function
* \param ctl Mixer handle * \param ctl Mixer handle
* \param mask event mask * \param mask event mask
@ -62,7 +62,7 @@ typedef int (*snd_mixer_callback_t)(snd_mixer_t *ctl,
unsigned int mask, unsigned int mask,
snd_mixer_elem_t *elem); snd_mixer_elem_t *elem);
/** /**
* \brief Mixer element callback function * \brief Mixer element callback function
* \param elem Mixer element * \param elem Mixer element
* \param mask event mask * \param mask event mask
@ -276,17 +276,17 @@ int snd_mixer_selem_set_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_
int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value); int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
int snd_mixer_selem_set_playback_switch_all(snd_mixer_elem_t *elem, int value); int snd_mixer_selem_set_playback_switch_all(snd_mixer_elem_t *elem, int value);
int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int value); int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int value);
int snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem, int snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem,
long *min, long *max); long *min, long *max);
int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem, int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem,
long *min, long *max); long *min, long *max);
int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem, int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
long min, long max); long min, long max);
int snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem, int snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem,
long *min, long *max); long *min, long *max);
int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem, int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem,
long *min, long *max); long *min, long *max);
int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem, int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
long min, long max); long min, long max);
int snd_mixer_selem_is_enumerated(snd_mixer_elem_t *elem); int snd_mixer_selem_is_enumerated(snd_mixer_elem_t *elem);

View file

@ -43,11 +43,11 @@ extern "C" {
#define SM_CAP_GSWITCH (1<<2) #define SM_CAP_GSWITCH (1<<2)
#define SM_CAP_PVOLUME (1<<3) #define SM_CAP_PVOLUME (1<<3)
#define SM_CAP_PVOLUME_JOIN (1<<4) #define SM_CAP_PVOLUME_JOIN (1<<4)
#define SM_CAP_PSWITCH (1<<5) #define SM_CAP_PSWITCH (1<<5)
#define SM_CAP_PSWITCH_JOIN (1<<6) #define SM_CAP_PSWITCH_JOIN (1<<6)
#define SM_CAP_CVOLUME (1<<7) #define SM_CAP_CVOLUME (1<<7)
#define SM_CAP_CVOLUME_JOIN (1<<8) #define SM_CAP_CVOLUME_JOIN (1<<8)
#define SM_CAP_CSWITCH (1<<9) #define SM_CAP_CSWITCH (1<<9)
#define SM_CAP_CSWITCH_JOIN (1<<10) #define SM_CAP_CSWITCH_JOIN (1<<10)
#define SM_CAP_CSWITCH_EXCL (1<<11) #define SM_CAP_CSWITCH_EXCL (1<<11)
#define SM_CAP_PENUM (1<<12) #define SM_CAP_PENUM (1<<12)
@ -77,7 +77,7 @@ typedef struct _sm_class_basic {
snd_ctl_card_info_t *info; snd_ctl_card_info_t *info;
} sm_class_basic_t; } sm_class_basic_t;
struct sm_elem_ops { struct sm_elem_ops {
int (*is)(snd_mixer_elem_t *elem, int dir, int cmd, int val); int (*is)(snd_mixer_elem_t *elem, int dir, int cmd, int val);
int (*get_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max); int (*get_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
int (*set_range)(snd_mixer_elem_t *elem, int dir, long min, long max); int (*set_range)(snd_mixer_elem_t *elem, int dir, long min, long max);

View file

@ -303,7 +303,7 @@ typedef enum _snd_pcm_subformat {
typedef enum _snd_pcm_state { typedef enum _snd_pcm_state {
/** Open */ /** Open */
SND_PCM_STATE_OPEN = 0, SND_PCM_STATE_OPEN = 0,
/** Setup installed */ /** Setup installed */
SND_PCM_STATE_SETUP, SND_PCM_STATE_SETUP,
/** Ready to start */ /** Ready to start */
SND_PCM_STATE_PREPARED, SND_PCM_STATE_PREPARED,
@ -525,9 +525,9 @@ typedef union _snd_pcm_sync_id {
/** #SND_PCM_TYPE_METER scope handle */ /** #SND_PCM_TYPE_METER scope handle */
typedef struct _snd_pcm_scope snd_pcm_scope_t; typedef struct _snd_pcm_scope snd_pcm_scope_t;
int snd_pcm_open(snd_pcm_t **pcm, const char *name, int snd_pcm_open(snd_pcm_t **pcm, const char *name,
snd_pcm_stream_t stream, int mode); snd_pcm_stream_t stream, int mode);
int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name, int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name,
snd_pcm_stream_t stream, int mode, snd_pcm_stream_t stream, int mode,
snd_config_t *lconf); snd_config_t *lconf);
int snd_pcm_open_fallback(snd_pcm_t **pcm, snd_config_t *root, int snd_pcm_open_fallback(snd_pcm_t **pcm, snd_config_t *root,
@ -543,7 +543,7 @@ int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int s
int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock); int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock);
static __inline__ int snd_pcm_abort(snd_pcm_t *pcm) { return snd_pcm_nonblock(pcm, 2); } static __inline__ int snd_pcm_abort(snd_pcm_t *pcm) { return snd_pcm_nonblock(pcm, 2); }
int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
snd_async_callback_t callback, void *private_data); snd_async_callback_t callback, void *private_data);
snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler); snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler);
int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info); int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info);
@ -679,15 +679,15 @@ snd_pcm_chmap_t *snd_pcm_chmap_parse_string(const char *str);
int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent); int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent);
int snd_pcm_set_params(snd_pcm_t *pcm, int snd_pcm_set_params(snd_pcm_t *pcm,
snd_pcm_format_t format, snd_pcm_format_t format,
snd_pcm_access_t access, snd_pcm_access_t access,
unsigned int channels, unsigned int channels,
unsigned int rate, unsigned int rate,
int soft_resample, int soft_resample,
unsigned int latency); unsigned int latency);
int snd_pcm_get_params(snd_pcm_t *pcm, int snd_pcm_get_params(snd_pcm_t *pcm,
snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t *period_size); snd_pcm_uframes_t *period_size);
/** \} */ /** \} */
@ -1149,7 +1149,7 @@ snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
/** \} */ /** \} */
@ -1326,7 +1326,7 @@ int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope,
/** Simple PCM latency type */ /** Simple PCM latency type */
typedef enum _snd_spcm_latency { typedef enum _snd_spcm_latency {
/** standard latency - for standard playback or capture /** standard latency - for standard playback or capture
(estimated latency in one direction 350ms) */ (estimated latency in one direction 350ms) */
SND_SPCM_LATENCY_STANDARD = 0, SND_SPCM_LATENCY_STANDARD = 0,
/** medium latency - software phones etc. /** medium latency - software phones etc.
(estimated latency in one direction maximally 25ms */ (estimated latency in one direction maximally 25ms */

View file

@ -49,7 +49,7 @@ enum {
SND_PCM_EXTPLUG_HW_CHANNELS, /**< channels */ SND_PCM_EXTPLUG_HW_CHANNELS, /**< channels */
SND_PCM_EXTPLUG_HW_PARAMS /**< max number of hw constraints */ SND_PCM_EXTPLUG_HW_PARAMS /**< max number of hw constraints */
}; };
/** Handle of external filter plugin */ /** Handle of external filter plugin */
typedef struct snd_pcm_extplug snd_pcm_extplug_t; typedef struct snd_pcm_extplug snd_pcm_extplug_t;
/** Callback table of extplug */ /** Callback table of extplug */

View file

@ -54,7 +54,7 @@ enum {
SND_PCM_IOPLUG_HW_PERIODS, /**< number of periods */ SND_PCM_IOPLUG_HW_PERIODS, /**< number of periods */
SND_PCM_IOPLUG_HW_PARAMS /**< max number of hw constraints */ SND_PCM_IOPLUG_HW_PARAMS /**< max number of hw constraints */
}; };
/** I/O plugin handle */ /** I/O plugin handle */
typedef struct snd_pcm_ioplug snd_pcm_ioplug_t; typedef struct snd_pcm_ioplug snd_pcm_ioplug_t;
/** Callback table of ioplug */ /** Callback table of ioplug */
@ -114,7 +114,7 @@ struct snd_pcm_ioplug {
*/ */
snd_pcm_t *pcm; snd_pcm_t *pcm;
snd_pcm_stream_t stream; /**< stream direcion; read-only */ snd_pcm_stream_t stream; /**< stream direcion; read-only */
snd_pcm_state_t state; /**< current PCM state; read-only */ snd_pcm_state_t state; /**< current PCM state; read-only */
volatile snd_pcm_uframes_t appl_ptr; /**< application pointer; read-only */ volatile snd_pcm_uframes_t appl_ptr; /**< application pointer; read-only */
volatile snd_pcm_uframes_t hw_ptr; /**< hw pointer; read-only */ volatile snd_pcm_uframes_t hw_ptr; /**< hw pointer; read-only */

View file

@ -38,7 +38,7 @@
* See the \ref pcm_plugins page for more details. * See the \ref pcm_plugins page for more details.
* \{ * \{
*/ */
#define SND_PCM_PLUGIN_RATE_MIN 4000 /**< minimal rate for the rate plugin */ #define SND_PCM_PLUGIN_RATE_MIN 4000 /**< minimal rate for the rate plugin */
#define SND_PCM_PLUGIN_RATE_MAX 768000 /**< maximal rate for the rate plugin */ #define SND_PCM_PLUGIN_RATE_MAX 768000 /**< maximal rate for the rate plugin */
@ -81,8 +81,8 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_t *slave, int close_slave); snd_pcm_t *slave, int close_slave);
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode); snd_pcm_stream_t stream, int mode);
/* /*
* Linear conversion plugin * Linear conversion plugin
*/ */
@ -111,7 +111,7 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
int close_slave); int close_slave);
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode); snd_pcm_stream_t stream, int mode);
/* /*
* Linear<->a-Law conversion plugin * Linear<->a-Law conversion plugin
@ -207,8 +207,8 @@ int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *capture_conf, snd_config_t *capture_conf,
snd_pcm_stream_t stream, int mode); snd_pcm_stream_t stream, int mode);
int _snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode); snd_pcm_stream_t stream, int mode);
/** \} */ /** \} */

View file

@ -135,7 +135,7 @@ typedef enum snd_seq_client_type {
SND_SEQ_USER_CLIENT = 1, /**< user client */ SND_SEQ_USER_CLIENT = 1, /**< user client */
SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */ SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */
} snd_seq_client_type_t; } snd_seq_client_type_t;
/** client MIDI version */ /** client MIDI version */
enum { enum {
SND_SEQ_CLIENT_LEGACY_MIDI = 0, /**< Legacy client */ SND_SEQ_CLIENT_LEGACY_MIDI = 0, /**< Legacy client */

View file

@ -61,7 +61,7 @@ enum snd_seq_event_type {
SND_SEQ_EVENT_NOTEOFF, SND_SEQ_EVENT_NOTEOFF,
/** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */ /** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */
SND_SEQ_EVENT_KEYPRESS, SND_SEQ_EVENT_KEYPRESS,
/** controller; event data type = #snd_seq_ev_ctrl_t */ /** controller; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_CONTROLLER = 10, SND_SEQ_EVENT_CONTROLLER = 10,
/** program change; event data type = #snd_seq_ev_ctrl_t */ /** program change; event data type = #snd_seq_ev_ctrl_t */
@ -87,7 +87,7 @@ enum snd_seq_event_type {
SND_SEQ_EVENT_TIMESIGN, SND_SEQ_EVENT_TIMESIGN,
/** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */ /** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_KEYSIGN, SND_SEQ_EVENT_KEYSIGN,
/** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */ /** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_START = 30, SND_SEQ_EVENT_START = 30,
/** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */ /** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */
@ -329,7 +329,7 @@ typedef struct snd_seq_event {
snd_seq_event_type_t type; /**< event type */ snd_seq_event_type_t type; /**< event type */
unsigned char flags; /**< event flags */ unsigned char flags; /**< event flags */
unsigned char tag; /**< tag */ unsigned char tag; /**< tag */
unsigned char queue; /**< schedule queue */ unsigned char queue; /**< schedule queue */
snd_seq_timestamp_t time; /**< schedule time */ snd_seq_timestamp_t time; /**< schedule time */

View file

@ -48,7 +48,7 @@ extern "C" {
/** /**
* \brief initialize event record * \brief initialize event record
* \param ev event record pointer * \param ev event record pointer
* *
* This macro clears the given event record pointer to the default status. * This macro clears the given event record pointer to the default status.
*/ */
static inline void snd_seq_ev_clear(snd_seq_event_t *ev) static inline void snd_seq_ev_clear(snd_seq_event_t *ev)
@ -130,7 +130,7 @@ static inline void snd_seq_ump_ev_clear(snd_seq_ump_event_t *ev)
* *
* This macro sets the event to the direct passing mode * This macro sets the event to the direct passing mode
* to be delivered immediately without queueing. * to be delivered immediately without queueing.
* *
* \sa snd_seq_ev_schedule_tick(), snd_seq_ev_schedule_real() * \sa snd_seq_ev_schedule_tick(), snd_seq_ev_schedule_real()
*/ */
#define snd_seq_ev_set_direct(ev) \ #define snd_seq_ev_set_direct(ev) \

View file

@ -29,7 +29,7 @@
#define SNDRV_SEQ_EVENT_NOTEON 6 #define SNDRV_SEQ_EVENT_NOTEON 6
#define SNDRV_SEQ_EVENT_NOTEOFF 7 #define SNDRV_SEQ_EVENT_NOTEOFF 7
#define SNDRV_SEQ_EVENT_KEYPRESS 8 #define SNDRV_SEQ_EVENT_KEYPRESS 8
/** control messages (channel specific) /** control messages (channel specific)
* event data type = #snd_seq_ev_ctrl * event data type = #snd_seq_ev_ctrl
*/ */
@ -49,13 +49,13 @@
#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ #define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ #define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ #define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
/** timer messages /** timer messages
* event data type = snd_seq_ev_queue_control * event data type = snd_seq_ev_queue_control
*/ */
#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ #define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ #define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ #define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ #define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ #define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ #define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
@ -282,7 +282,7 @@ struct snd_seq_event {
snd_seq_event_type_t type; /* event type */ snd_seq_event_type_t type; /* event type */
unsigned char flags; /* event flags */ unsigned char flags; /* event flags */
char tag; char tag;
unsigned char queue; /* schedule queue */ unsigned char queue; /* schedule queue */
union snd_seq_timestamp time; /* schedule time */ union snd_seq_timestamp time; /* schedule time */
@ -352,7 +352,7 @@ typedef int __bitwise snd_seq_client_type_t;
#define NO_CLIENT ((snd_seq_client_type_t) 0) #define NO_CLIENT ((snd_seq_client_type_t) 0)
#define USER_CLIENT ((snd_seq_client_type_t) 1) #define USER_CLIENT ((snd_seq_client_type_t) 1)
#define KERNEL_CLIENT ((snd_seq_client_type_t) 2) #define KERNEL_CLIENT ((snd_seq_client_type_t) 2)
/* event filter flags */ /* event filter flags */
#define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */ #define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */
#define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */ #define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */

View file

@ -409,7 +409,7 @@ struct snd_pcm_hw_params {
SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
struct snd_mask mres[5]; /* reserved masks */ struct snd_mask mres[5]; /* reserved masks */
struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
struct snd_interval ires[9]; /* reserved intervals */ struct snd_interval ires[9]; /* reserved intervals */
unsigned int rmask; /* W: requested masks */ unsigned int rmask; /* W: requested masks */
unsigned int cmask; /* R: changed masks */ unsigned int cmask; /* R: changed masks */

View file

@ -188,7 +188,7 @@
#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */ #define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */
#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */ #define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */
#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */ #define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */
#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */ #define A_EXTIN_OPT_SPDIF_R 0x05 /* right */
#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */ #define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */
#define A_EXTIN_LINE2_R 0x09 /* right */ #define A_EXTIN_LINE2_R 0x09 /* right */
#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */ #define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */

View file

@ -4,7 +4,7 @@
/* /*
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org) * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@ -65,7 +65,7 @@ struct hdsp_config_info {
unsigned char clock_source; unsigned char clock_source;
unsigned char autosync_ref; unsigned char autosync_ref;
unsigned char line_out; unsigned char line_out;
unsigned char passthru; unsigned char passthru;
unsigned char da_gain; unsigned char da_gain;
unsigned char ad_gain; unsigned char ad_gain;
unsigned char phone_gain; unsigned char phone_gain;

View file

@ -5,7 +5,7 @@
* *
* SB16ASP/AWE32 CSP control * SB16ASP/AWE32 CSP control
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.

View file

@ -99,13 +99,13 @@ typedef enum _snd_timer_event {
SND_TIMER_EVENT_MCONTINUE = SND_TIMER_EVENT_CONTINUE + 10, SND_TIMER_EVENT_MCONTINUE = SND_TIMER_EVENT_CONTINUE + 10,
SND_TIMER_EVENT_MPAUSE = SND_TIMER_EVENT_PAUSE + 10, SND_TIMER_EVENT_MPAUSE = SND_TIMER_EVENT_PAUSE + 10,
SND_TIMER_EVENT_MSUSPEND = SND_TIMER_EVENT_SUSPEND + 10, SND_TIMER_EVENT_MSUSPEND = SND_TIMER_EVENT_SUSPEND + 10,
SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10 SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10
} snd_timer_event_t; } snd_timer_event_t;
/** timer read structure */ /** timer read structure */
typedef struct _snd_timer_read { typedef struct _snd_timer_read {
unsigned int resolution; /**< tick resolution in nanoseconds */ unsigned int resolution; /**< tick resolution in nanoseconds */
unsigned int ticks; /**< count of happened ticks */ unsigned int ticks; /**< count of happened ticks */
} snd_timer_read_t; } snd_timer_read_t;
/** timer tstamp + event read structure */ /** timer tstamp + event read structure */

View file

@ -239,14 +239,14 @@ int snd_use_case_free_list(const char *list[], int items);
* *
*/ */
int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
const char *identifier, const char *identifier,
const char **list[]); const char **list[]);
/** /**
* \brief Get current - string * \brief Get current - string
* \param uc_mgr Use case manager * \param uc_mgr Use case manager
* \param identifier * \param identifier
* \param value Value pointer * \param value Value pointer
* \return Zero if success, otherwise a negative error code * \return Zero if success, otherwise a negative error code
* *
@ -410,14 +410,14 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
* increase latency. * increase latency.
*/ */
int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
const char *identifier, const char *identifier,
const char **value); const char **value);
/** /**
* \brief Get current - integer * \brief Get current - integer
* \param uc_mgr Use case manager * \param uc_mgr Use case manager
* \param identifier * \param identifier
* \param value result * \param value result
* \return Zero if success, otherwise a negative error code * \return Zero if success, otherwise a negative error code
* *
* Known identifiers: * Known identifiers:
@ -456,8 +456,8 @@ int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
* - check transmit sequence firstly * - check transmit sequence firstly
*/ */
int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
const char *identifier, const char *identifier,
const char *value); const char *value);
/** /**
* \brief Open and initialise use case core for sound card * \brief Open and initialise use case core for sound card
@ -482,7 +482,7 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
* only one ALSA sound card in this case. * only one ALSA sound card in this case.
*/ */
int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr,
const char *card_name); const char *card_name);
/** /**

View file

@ -75,7 +75,7 @@ int alsa_mixer_simple_init(snd_mixer_class_t *class)
{ {
struct bclass_base_ops *ops; struct bclass_base_ops *ops;
int err; int err;
err = mixer_simple_basic_dlopen(class, &ops); err = mixer_simple_basic_dlopen(class, &ops);
if (err < 0) if (err < 0)
return 0; return 0;

View file

@ -76,7 +76,7 @@ int alsa_mixer_simple_init(snd_mixer_class_t *class)
{ {
struct bclass_base_ops *ops; struct bclass_base_ops *ops;
int err; int err;
err = mixer_simple_basic_dlopen(class, &ops); err = mixer_simple_basic_dlopen(class, &ops);
if (err < 0) if (err < 0)
return 0; return 0;

View file

@ -68,24 +68,24 @@ static PyInterpreterState *main_interpreter;
static inline int get_long(PyObject *o, long *val) static inline int get_long(PyObject *o, long *val)
{ {
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
if (PyInt_Check(o)) { if (PyInt_Check(o)) {
*val = PyInt_AsLong(o); *val = PyInt_AsLong(o);
return 0; return 0;
} }
#endif #endif
if (PyLong_Check(o)) { if (PyLong_Check(o)) {
*val = PyLong_AsLong(o); *val = PyLong_AsLong(o);
return 0; return 0;
} }
return 1; return 1;
} }
static inline PyObject *InternFromString(const char *name) static inline PyObject *InternFromString(const char *name)
{ {
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
return PyString_InternFromString(name); return PyString_InternFromString(name);
#else #else
return PyUnicode_InternFromString(name); return PyUnicode_InternFromString(name);
#endif #endif
} }
@ -191,12 +191,12 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
} }
static int get_x_range_ops(snd_mixer_elem_t *elem, int dir, static int get_x_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max, const char *attr) long *min, long *max, const char *attr)
{ {
PyObject *obj1, *t1, *t2, *res; PyObject *obj1, *t1, *t2, *res;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
int err; int err;
obj1 = PyTuple_New(1); obj1 = PyTuple_New(1);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir)); PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
err = pcall(pymelem, attr, obj1, &res); err = pcall(pymelem, attr, obj1, &res);
@ -225,13 +225,13 @@ static int get_x_range_ops(snd_mixer_elem_t *elem, int dir,
} }
static int get_range_ops(snd_mixer_elem_t *elem, int dir, static int get_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max) long *min, long *max)
{ {
return get_x_range_ops(elem, dir, min, max, "opsGetRange"); return get_x_range_ops(elem, dir, min, max, "opsGetRange");
} }
static int set_range_ops(snd_mixer_elem_t *elem, int dir, static int set_range_ops(snd_mixer_elem_t *elem, int dir,
long min, long max) long min, long max)
{ {
PyObject *obj1; PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -244,13 +244,13 @@ static int set_range_ops(snd_mixer_elem_t *elem, int dir,
} }
static int get_x_ops(snd_mixer_elem_t *elem, int dir, static int get_x_ops(snd_mixer_elem_t *elem, int dir,
long channel, long *value, long channel, long *value,
const char *attr) const char *attr)
{ {
PyObject *obj1, *t1, *res; PyObject *obj1, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
int err; int err;
obj1 = PyTuple_New(2); obj1 = PyTuple_New(2);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir)); PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(channel)); PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(channel));
@ -283,7 +283,7 @@ static int get_volume_ops(snd_mixer_elem_t *elem, int dir,
} }
static int get_switch_ops(snd_mixer_elem_t *elem, int dir, static int get_switch_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, int *value) snd_mixer_selem_channel_id_t channel, int *value)
{ {
long value1; long value1;
int res; int res;
@ -309,7 +309,7 @@ static int ask_dB_vol_ops(snd_mixer_elem_t *elem,
PyObject *obj1, *t1, *res; PyObject *obj1, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
int err; int err;
obj1 = PyTuple_New(3); obj1 = PyTuple_New(3);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir)); PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(value)); PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(value));
@ -337,21 +337,21 @@ static int ask_dB_vol_ops(snd_mixer_elem_t *elem,
} }
static int get_dB_ops(snd_mixer_elem_t *elem, static int get_dB_ops(snd_mixer_elem_t *elem,
int dir, int dir,
snd_mixer_selem_channel_id_t channel, snd_mixer_selem_channel_id_t channel,
long *value) long *value)
{ {
return get_x_ops(elem, dir, channel, value, "opsGetDB"); return get_x_ops(elem, dir, channel, value, "opsGetDB");
} }
static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir, static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max) long *min, long *max)
{ {
return get_x_range_ops(elem, dir, min, max, "opsGetDBRange"); return get_x_range_ops(elem, dir, min, max, "opsGetDBRange");
} }
static int set_volume_ops(snd_mixer_elem_t *elem, int dir, static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, long value) snd_mixer_selem_channel_id_t channel, long value)
{ {
PyObject *obj1; PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -364,7 +364,7 @@ static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
} }
static int set_switch_ops(snd_mixer_elem_t *elem, int dir, static int set_switch_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, int value) snd_mixer_selem_channel_id_t channel, int value)
{ {
PyObject *obj1; PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -377,8 +377,8 @@ static int set_switch_ops(snd_mixer_elem_t *elem, int dir,
} }
static int set_dB_ops(snd_mixer_elem_t *elem, int dir, static int set_dB_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, snd_mixer_selem_channel_id_t channel,
long db_gain, int xdir) long db_gain, int xdir)
{ {
PyObject *obj1; PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -392,15 +392,15 @@ static int set_dB_ops(snd_mixer_elem_t *elem, int dir,
} }
static int enum_item_name_ops(snd_mixer_elem_t *elem, static int enum_item_name_ops(snd_mixer_elem_t *elem,
unsigned int item, unsigned int item,
size_t maxlen, char *buf) size_t maxlen, char *buf)
{ {
PyObject *obj1, *obj2, *t1, *res; PyObject *obj1, *obj2, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
int err; int err;
unsigned int len; unsigned int len;
char *s; char *s;
obj1 = PyTuple_New(1); obj1 = PyTuple_New(1);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(item)); PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(item));
err = pcall(pymelem, "opsGetEnumItemName", obj1, &res); err = pcall(pymelem, "opsGetEnumItemName", obj1, &res);
@ -441,13 +441,13 @@ errlbl:
} }
static int get_enum_item_ops(snd_mixer_elem_t *elem, static int get_enum_item_ops(snd_mixer_elem_t *elem,
snd_mixer_selem_channel_id_t channel, snd_mixer_selem_channel_id_t channel,
unsigned int *itemp) unsigned int *itemp)
{ {
PyObject *obj1, *t1, *res; PyObject *obj1, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
int err; int err;
obj1 = PyTuple_New(1); obj1 = PyTuple_New(1);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(channel)); PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(channel));
err = pcall(pymelem, "opsGetEnumItem", obj1, &res); err = pcall(pymelem, "opsGetEnumItem", obj1, &res);
@ -473,8 +473,8 @@ static int get_enum_item_ops(snd_mixer_elem_t *elem,
} }
static int set_enum_item_ops(snd_mixer_elem_t *elem, static int set_enum_item_ops(snd_mixer_elem_t *elem,
snd_mixer_selem_channel_id_t channel, snd_mixer_selem_channel_id_t channel,
unsigned int item) unsigned int item)
{ {
PyObject *obj1; PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -486,21 +486,21 @@ static int set_enum_item_ops(snd_mixer_elem_t *elem,
} }
static struct sm_elem_ops simple_python_ops = { static struct sm_elem_ops simple_python_ops = {
.is = is_ops, .is = is_ops,
.get_range = get_range_ops, .get_range = get_range_ops,
.get_dB_range = get_dB_range_ops, .get_dB_range = get_dB_range_ops,
.set_range = set_range_ops, .set_range = set_range_ops,
.ask_vol_dB = ask_vol_dB_ops, .ask_vol_dB = ask_vol_dB_ops,
.ask_dB_vol = ask_dB_vol_ops, .ask_dB_vol = ask_dB_vol_ops,
.get_volume = get_volume_ops, .get_volume = get_volume_ops,
.get_dB = get_dB_ops, .get_dB = get_dB_ops,
.set_volume = set_volume_ops, .set_volume = set_volume_ops,
.set_dB = set_dB_ops, .set_dB = set_dB_ops,
.get_switch = get_switch_ops, .get_switch = get_switch_ops,
.set_switch = set_switch_ops, .set_switch = set_switch_ops,
.enum_item_name = enum_item_name_ops, .enum_item_name = enum_item_name_ops,
.get_enum_item = get_enum_item_ops, .get_enum_item = get_enum_item_ops,
.set_enum_item = set_enum_item_ops .set_enum_item = set_enum_item_ops
}; };
static void selem_free(snd_mixer_elem_t *elem) static void selem_free(snd_mixer_elem_t *elem)
@ -578,7 +578,7 @@ pymelem_attach(struct pymelem *pymelem, PyObject *args)
PyObject *obj; PyObject *obj;
snd_hctl_elem_t *helem; snd_hctl_elem_t *helem;
int err; int err;
if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "O", &obj))
return NULL; return NULL;
helem = (snd_hctl_elem_t *)get_C_ptr(obj, "get_C_helem"); helem = (snd_hctl_elem_t *)get_C_ptr(obj, "get_C_helem");
@ -587,7 +587,7 @@ pymelem_attach(struct pymelem *pymelem, PyObject *args)
err = snd_mixer_elem_attach(pymelem->melem, helem); err = snd_mixer_elem_attach(pymelem->melem, helem);
if (err < 0) { if (err < 0) {
PyErr_Format(PyExc_RuntimeError, "Cannot attach hcontrol element to mixer element: %s", snd_strerror(err)); PyErr_Format(PyExc_RuntimeError, "Cannot attach hcontrol element to mixer element: %s", snd_strerror(err));
return NULL; return NULL;
} }
Py_RETURN_NONE; Py_RETURN_NONE;
} }
@ -598,7 +598,7 @@ pymelem_detach(struct pymelem *pymelem, PyObject *args)
PyObject *obj; PyObject *obj;
snd_hctl_elem_t *helem; snd_hctl_elem_t *helem;
int err; int err;
if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "O", &obj))
return NULL; return NULL;
helem = (snd_hctl_elem_t *)get_C_ptr(obj, "get_C_helem"); helem = (snd_hctl_elem_t *)get_C_ptr(obj, "get_C_helem");
@ -607,7 +607,7 @@ pymelem_detach(struct pymelem *pymelem, PyObject *args)
err = snd_mixer_elem_detach(pymelem->melem, helem); err = snd_mixer_elem_detach(pymelem->melem, helem);
if (err < 0) { if (err < 0) {
PyErr_Format(PyExc_RuntimeError, "Cannot detach hcontrol element to mixer element: %s", snd_strerror(err)); PyErr_Format(PyExc_RuntimeError, "Cannot detach hcontrol element to mixer element: %s", snd_strerror(err));
return NULL; return NULL;
} }
Py_RETURN_NONE; Py_RETURN_NONE;
} }
@ -679,14 +679,14 @@ static PyGetSetDef pymelem_getseters[] = {
{"name", (getter)pymelem_get_name, NULL, NULL, NULL}, {"name", (getter)pymelem_get_name, NULL, NULL, NULL},
{"index", (getter)pymelem_get_index, NULL, NULL, NULL}, {"index", (getter)pymelem_get_index, NULL, NULL, NULL},
{NULL,NULL,NULL,NULL,NULL} {NULL,NULL,NULL,NULL,NULL}
}; };
static PyMethodDef pymelem_methods[] = { static PyMethodDef pymelem_methods[] = {
{"attach", (PyCFunction)pymelem_attach, METH_VARARGS, NULL}, {"attach", (PyCFunction)pymelem_attach, METH_VARARGS, NULL},
{"detach", (PyCFunction)pymelem_detach, METH_VARARGS, NULL}, {"detach", (PyCFunction)pymelem_detach, METH_VARARGS, NULL},
/* "default" functions - no functionality */ /* "default" functions - no functionality */
{"opsIsActive", (PyCFunction)pymelem_ignore1, METH_VARARGS, NULL}, {"opsIsActive", (PyCFunction)pymelem_ignore1, METH_VARARGS, NULL},
{"opsIsMono", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL}, {"opsIsMono", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL},
@ -695,7 +695,7 @@ static PyMethodDef pymelem_methods[] = {
{"opsIsEnumCnt", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL}, {"opsIsEnumCnt", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL},
{"opsGetDB", (PyCFunction)pymelem_error, METH_VARARGS, NULL}, {"opsGetDB", (PyCFunction)pymelem_error, METH_VARARGS, NULL},
{"eventInfo", (PyCFunction)pymelem_event_info, METH_VARARGS, NULL}, {"eventInfo", (PyCFunction)pymelem_event_info, METH_VARARGS, NULL},
{"eventValue", (PyCFunction)pymelem_event_value, METH_VARARGS, NULL}, {"eventValue", (PyCFunction)pymelem_event_value, METH_VARARGS, NULL},
@ -703,18 +703,18 @@ static PyMethodDef pymelem_methods[] = {
}; };
static PyTypeObject pymelem_type = { static PyTypeObject pymelem_type = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
tp_name: "smixer_python.InternalMElement", tp_name: "smixer_python.InternalMElement",
tp_basicsize: sizeof(struct pymelem), tp_basicsize: sizeof(struct pymelem),
tp_dealloc: (destructor)pymelem_dealloc, tp_dealloc: (destructor)pymelem_dealloc,
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
tp_doc: NULL /* mixerinit__doc__ */, tp_doc: NULL /* mixerinit__doc__ */,
tp_getset: pymelem_getseters, tp_getset: pymelem_getseters,
tp_init: (initproc)pymelem_init, tp_init: (initproc)pymelem_init,
tp_alloc: PyType_GenericAlloc, tp_alloc: PyType_GenericAlloc,
tp_new: PyType_GenericNew, tp_new: PyType_GenericNew,
tp_free: PyObject_Del, tp_free: PyObject_Del,
tp_methods: pymelem_methods, tp_methods: pymelem_methods,
}; };
static PyObject * static PyObject *
@ -724,7 +724,7 @@ pymixer_attach_hctl(struct pymixer *pymixer, PyObject *args)
snd_hctl_t *hctl; snd_hctl_t *hctl;
void **hctls; void **hctls;
int err; int err;
if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "O", &obj))
return NULL; return NULL;
hctl = (snd_hctl_t *)get_C_ptr(obj, "get_C_hctl"); hctl = (snd_hctl_t *)get_C_ptr(obj, "get_C_hctl");
@ -752,7 +752,7 @@ static PyObject *
pymixer_register(struct pymixer *pymixer, PyObject *args) pymixer_register(struct pymixer *pymixer, PyObject *args)
{ {
int err; int err;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ""))
return NULL; return NULL;
err = snd_mixer_class_register(pymixer->class, pymixer->mixer); err = snd_mixer_class_register(pymixer->class, pymixer->mixer);
@ -769,7 +769,7 @@ pymixer_melement_new(struct pymixer *pymixer, PyObject *args)
PyObject *obj, *obj1, *obj2; PyObject *obj, *obj1, *obj2;
char *class, *name; char *class, *name;
long index, weight; long index, weight;
if (!PyArg_ParseTuple(args, "ssii", &class, &name, &index, &weight)) if (!PyArg_ParseTuple(args, "ssii", &class, &name, &index, &weight))
return NULL; return NULL;
obj = PyDict_GetItemString(pymixer->mdict, class); obj = PyDict_GetItemString(pymixer->mdict, class);
@ -808,14 +808,14 @@ pymixer_melement_add(struct pymixer *pymixer, PyObject *args)
PyObject *obj; PyObject *obj;
struct pymelem *pymelem; struct pymelem *pymelem;
int err; int err;
if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "O", &obj))
return NULL; return NULL;
pymelem = (struct pymelem *)obj; pymelem = (struct pymelem *)obj;
err = snd_mixer_elem_add(pymelem->melem, pymixer->class); err = snd_mixer_elem_add(pymelem->melem, pymixer->class);
if (err < 0) { if (err < 0) {
PyErr_Format(PyExc_RuntimeError, "Cannot add mixer element: %s", snd_strerror(err)); PyErr_Format(PyExc_RuntimeError, "Cannot add mixer element: %s", snd_strerror(err));
return NULL; return NULL;
} }
Py_RETURN_NONE; Py_RETURN_NONE;
} }
@ -842,7 +842,7 @@ static void
pymixer_free(struct pymixer *self) pymixer_free(struct pymixer *self)
{ {
int idx; int idx;
for (idx = 0; idx < self->hctl_count; idx++) { for (idx = 0; idx < self->hctl_count; idx++) {
snd_mixer_detach_hctl(self->mixer, self->hctl[idx*2]); snd_mixer_detach_hctl(self->mixer, self->hctl[idx*2]);
Py_DECREF((PyObject *)self->hctl[idx*2+1]); Py_DECREF((PyObject *)self->hctl[idx*2+1]);
@ -884,18 +884,18 @@ static PyMethodDef pymixer_methods[] = {
}; };
static PyTypeObject pymixer_type = { static PyTypeObject pymixer_type = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
tp_name: "smixer_python.InternalMixer", tp_name: "smixer_python.InternalMixer",
tp_basicsize: sizeof(struct pymixer), tp_basicsize: sizeof(struct pymixer),
tp_dealloc: (destructor)pymixer_dealloc, tp_dealloc: (destructor)pymixer_dealloc,
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
tp_doc: NULL /* mixerinit__doc__ */, tp_doc: NULL /* mixerinit__doc__ */,
tp_getset: pymixer_getseters, tp_getset: pymixer_getseters,
tp_init: (initproc)pymixer_init, tp_init: (initproc)pymixer_init,
tp_alloc: PyType_GenericAlloc, tp_alloc: PyType_GenericAlloc,
tp_new: PyType_GenericNew, tp_new: PyType_GenericNew,
tp_free: PyObject_Del, tp_free: PyObject_Del,
tp_methods: pymixer_methods, tp_methods: pymixer_methods,
}; };
static PyMethodDef python_methods[] = { static PyMethodDef python_methods[] = {
@ -984,20 +984,20 @@ int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
tstate = PyThreadState_New(main_interpreter); tstate = PyThreadState_New(main_interpreter);
PyThreadState_Swap(tstate); PyThreadState_Swap(tstate);
t = PyTuple_New(3); t = PyTuple_New(3);
if (t) { if (t) {
PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask)); PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask));
o = find_helem(priv, helem); o = find_helem(priv, helem);
if (mask & SND_CTL_EVENT_MASK_ADD) { if (mask & SND_CTL_EVENT_MASK_ADD) {
if (o == NULL) if (o == NULL)
o = new_helem(priv, helem); o = new_helem(priv, helem);
} }
if (o == NULL) if (o == NULL)
return 0; return 0;
PyTuple_SET_ITEM(t, 1, o); PyTuple_SET_ITEM(t, 1, o);
Py_INCREF(o); Py_INCREF(o);
o = melem ? find_melem(priv, melem) : Py_None; o = melem ? find_melem(priv, melem) : Py_None;
PyTuple_SET_ITEM(t, 2, o); PyTuple_SET_ITEM(t, 2, o);
Py_INCREF(o); Py_INCREF(o);
r = PyObject_CallObject(priv->py_event_func, t); r = PyObject_CallObject(priv->py_event_func, t);
@ -1019,7 +1019,7 @@ int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
res = -EIO; res = -EIO;
} }
} }
return res; return res;
} }
@ -1039,8 +1039,8 @@ static void alsa_mixer_simple_free(snd_mixer_class_t *class)
} }
static int alsa_mixer_simple_pyinit(struct python_priv *priv, static int alsa_mixer_simple_pyinit(struct python_priv *priv,
PyObject *py_mod, PyObject *py_mod,
FILE *fp, FILE *fp,
const char *file, const char *file,
snd_mixer_class_t *class, snd_mixer_class_t *class,
snd_mixer_t *mixer, snd_mixer_t *mixer,
@ -1091,15 +1091,15 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv,
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
static struct PyModuleDef smixer_python_module = { static struct PyModuleDef smixer_python_module = {
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"smixer_python", "smixer_python",
NULL, NULL,
0, 0,
python_methods, python_methods,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL NULL
}; };
#endif #endif
@ -1131,7 +1131,7 @@ int alsa_mixer_simple_finit(snd_mixer_class_t *class,
snd_error(MIXER, "Unable to find python module '%s'", file); snd_error(MIXER, "Unable to find python module '%s'", file);
return -ENODEV; return -ENODEV;
} }
Py_Initialize(); Py_Initialize();
if (PyType_Ready(&pymelem_type) < 0 || if (PyType_Ready(&pymelem_type) < 0 ||
PyType_Ready(&pymixer_type) < 0) { PyType_Ready(&pymixer_type) < 0) {

View file

@ -43,7 +43,7 @@ static int selem_read(snd_mixer_elem_t *elem);
static unsigned int chanmap_to_channels(unsigned int chanmap) static unsigned int chanmap_to_channels(unsigned int chanmap)
{ {
unsigned int i, res; unsigned int i, res;
for (i = 0, res = 0; i < MAX_CHANNEL; i++) for (i = 0, res = 0; i < MAX_CHANNEL; i++)
if (chanmap & (1 << i)) if (chanmap & (1 << i))
res++; res++;
@ -61,11 +61,11 @@ static long to_user(struct selem_base *s, int dir, struct helem_base *c, long va
} }
static long from_user(struct selem_base *s, int dir, struct helem_base *c, long value) static long from_user(struct selem_base *s, int dir, struct helem_base *c, long value)
{ {
int64_t n; int64_t n;
if (s->dir[dir].max == s->dir[dir].min) if (s->dir[dir].max == s->dir[dir].min)
return c->min; return c->min;
n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min); n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min);
return c->min + (n + (s->dir[dir].max - s->dir[dir].min) / 2) / (s->dir[dir].max - s->dir[dir].min); return c->min + (n + (s->dir[dir].max - s->dir[dir].min) / 2) / (s->dir[dir].max - s->dir[dir].min);
} }
#endif #endif
@ -77,7 +77,7 @@ static void update_ranges(struct selem_base *s)
unsigned int dir, ok_flag; unsigned int dir, ok_flag;
struct list_head *pos; struct list_head *pos;
struct helem_base *helem; struct helem_base *helem;
for (dir = 0; dir < 2; dir++) { for (dir = 0; dir < 2; dir++) {
s->dir[dir].min = 0; s->dir[dir].min = 0;
s->dir[dir].max = 0; s->dir[dir].max = 0;
@ -139,7 +139,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
helem = list_entry(s->helems.next, struct helem_base, list); helem = list_entry(s->helems.next, struct helem_base, list);
return !!(helem->purpose == PURPOSE_ENUMLIST); return !!(helem->purpose == PURPOSE_ENUMLIST);
} }
case SM_OPS_IS_ENUMCNT: { case SM_OPS_IS_ENUMCNT: {
struct helem_base *helem; struct helem_base *helem;
helem = list_entry(s->helems.next, struct helem_base, list); helem = list_entry(s->helems.next, struct helem_base, list);
@ -147,7 +147,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
} }
} }
return 1; return 1;
} }
@ -155,7 +155,7 @@ static int get_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max) long *min, long *max)
{ {
struct selem_base *s = snd_mixer_elem_get_private(elem); struct selem_base *s = snd_mixer_elem_get_private(elem);
*min = s->dir[dir].min; *min = s->dir[dir].min;
*max = s->dir[dir].max; *max = s->dir[dir].max;
@ -179,7 +179,7 @@ static int set_range_ops(snd_mixer_elem_t *elem, int dir,
s->dir[dir].forced_range = 1; s->dir[dir].forced_range = 1;
s->dir[dir].min = min; s->dir[dir].min = min;
s->dir[dir].max = max; s->dir[dir].max = max;
if ((err = selem_read(elem)) < 0) if ((err = selem_read(elem)) < 0)
return err; return err;
return 0; return 0;
@ -189,7 +189,7 @@ static int get_volume_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, long *value) snd_mixer_selem_channel_id_t channel, long *value)
{ {
struct selem_base *s = snd_mixer_elem_get_private(elem); struct selem_base *s = snd_mixer_elem_get_private(elem);
*value = s->dir[dir].vol[channel]; *value = s->dir[dir].vol[channel];
return 0; return 0;
} }
@ -330,7 +330,7 @@ static int simple_event_add1(snd_mixer_class_t *class,
struct bclass_sid *bsid; struct bclass_sid *bsid;
struct melem_sids *sid; struct melem_sids *sid;
unsigned int ui; unsigned int ui;
list_for_each(pos, &priv->sids) { list_for_each(pos, &priv->sids) {
bsid = list_entry(pos, struct bclass_sid, list); bsid = list_entry(pos, struct bclass_sid, list);
for (ui = 0; ui < bsid->count; ui++) { for (ui = 0; ui < bsid->count; ui++) {
@ -361,7 +361,7 @@ static int simple_event_add1(snd_mixer_class_t *class,
min = max = 0; min = max = 0;
break; break;
} }
printf("event add: %p, %p (%s)\n", helem, sel, snd_hctl_elem_get_name(helem)); printf("event add: %p, %p (%s)\n", helem, sel, snd_hctl_elem_get_name(helem));
if (snd_mixer_selem_id_malloc(&id)) if (snd_mixer_selem_id_malloc(&id))
return -ENOMEM; return -ENOMEM;
@ -374,7 +374,7 @@ static int simple_event_add1(snd_mixer_class_t *class,
case PURPOSE_SWITCH: case PURPOSE_SWITCH:
if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) { if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) {
__invalid_type: __invalid_type:
snd_mixer_selem_id_free(id); snd_mixer_selem_id_free(id);
free(hsimple); free(hsimple);
return -EINVAL; return -EINVAL;
} }
@ -446,9 +446,9 @@ static int simple_event_add1(snd_mixer_class_t *class,
err = snd_mixer_elem_value(melem); err = snd_mixer_elem_value(melem);
return err; return err;
__error: __error:
if (new) if (new)
snd_mixer_elem_free(melem); snd_mixer_elem_free(melem);
return -EINVAL; return -EINVAL;
} }
static int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem) static int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem)

View file

@ -97,8 +97,8 @@ int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
return 1; return 1;
__error: __error:
if (initflag) if (initflag)
free(priv); free(priv);
if (h) if (h)
snd_dlclose(h); snd_dlclose(h);
free(xlib); free(xlib);

View file

@ -109,7 +109,7 @@ static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, vo
* *
* \see snd_async_add_pcm_handler, snd_async_add_ctl_handler * \see snd_async_add_pcm_handler, snd_async_add_ctl_handler
*/ */
int snd_async_add_handler(snd_async_handler_t **handler, int fd, int snd_async_add_handler(snd_async_handler_t **handler, int fd,
snd_async_callback_t callback, void *private_data) snd_async_callback_t callback, void *private_data)
{ {
snd_async_handler_t *h; snd_async_handler_t *h;

View file

@ -51,7 +51,7 @@ any surplus whitespace is discarded. For example, the two sequences
and and
\code \code
a 1 a 1
b 2 b 2
\endcode \endcode
@ -255,8 +255,8 @@ name [=] value [,|;]
# Compound assignment (first style) # Compound assignment (first style)
name [=] { name [=] {
name1 [=] value [,|;] name1 [=] value [,|;]
... ...
} }
# Compound assignment (second style) # Compound assignment (second style)
@ -264,9 +264,9 @@ name.name1 [=] value [,|;]
# Array assignment (first style) # Array assignment (first style)
name [ name [
value0 [,|;] value0 [,|;]
value1 [,|;] value1 [,|;]
... ...
] ]
# Array assignment (second style) # Array assignment (second style)
@ -377,7 +377,7 @@ values in the current compound are used as configuration for the function.
If the compound func.\<function_name\> is defined in the root node, then the If the compound func.\<function_name\> is defined in the root node, then the
library and function from this compound configuration are used, otherwise library and function from this compound configuration are used, otherwise
'snd_func_' is prefixed to the string and code from the ALSA library is used. 'snd_func_' is prefixed to the string and code from the ALSA library is used.
The definition of a function looks like:</P> The definition of a function looks like:</P>
\code \code
func.remove_first_char { func.remove_first_char {
@ -868,10 +868,10 @@ static int get_char_skip_comments(input_t *input)
break; break;
} }
} }
return c; return c;
} }
static int get_nonwhite(input_t *input) static int get_nonwhite(input_t *input)
{ {
@ -1057,7 +1057,7 @@ static int get_freestring(char **string, int id, input_t *input)
free_local_string(&str); free_local_string(&str);
return c; return c;
} }
static int get_delimstring(char **string, int delim, input_t *input) static int get_delimstring(char **string, int delim, input_t *input)
{ {
struct local_string str; struct local_string str;
@ -1145,7 +1145,7 @@ static int _snd_config_make(snd_config_t **config, char **id, snd_config_type_t
*config = n; *config = n;
return 0; return 0;
} }
static int _snd_config_make_add(snd_config_t **config, char **id, static int _snd_config_make_add(snd_config_t **config, char **id,
snd_config_type_t type, snd_config_t *parent) snd_config_type_t type, snd_config_t *parent)
@ -1162,7 +1162,7 @@ static int _snd_config_make_add(snd_config_t **config, char **id,
return 0; return 0;
} }
static int _snd_config_search(snd_config_t *config, static int _snd_config_search(snd_config_t *config,
const char *id, int len, snd_config_t **result) const char *id, int len, snd_config_t **result)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
@ -1225,16 +1225,16 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input,
return -EINVAL; return -EINVAL;
} }
} else { } else {
if (i <= INT_MAX) if (i <= INT_MAX)
err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER, parent); err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER, parent);
else else
err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER64, parent); err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER64, parent);
if (err < 0) if (err < 0)
return err; return err;
} }
if (n->type == SND_CONFIG_TYPE_INTEGER) if (n->type == SND_CONFIG_TYPE_INTEGER)
n->u.integer = (long) i; n->u.integer = (long) i;
else else
n->u.integer64 = i; n->u.integer64 = i;
*_n = n; *_n = n;
return 0; return 0;
@ -1341,7 +1341,7 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
err = 0; err = 0;
__end: __end:
free(id); free(id);
return err; return err;
} }
static int parse_array_defs(snd_config_t *parent, input_t *input, int skip, int override) static int parse_array_defs(snd_config_t *parent, input_t *input, int skip, int override)
@ -1505,7 +1505,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid
free(id); free(id);
return err; return err;
} }
static int parse_defs(snd_config_t *parent, input_t *input, int skip, int override) static int parse_defs(snd_config_t *parent, input_t *input, int skip, int override)
{ {
int c, err; int c, err;
@ -2774,7 +2774,7 @@ __make:
int snd_config_imake_integer(snd_config_t **config, const char *id, const long value) int snd_config_imake_integer(snd_config_t **config, const char *id, const long value)
{ {
int err; int err;
err = snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER); err = snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER);
if (err < 0) if (err < 0)
return err; return err;
@ -2804,7 +2804,7 @@ int snd_config_imake_integer(snd_config_t **config, const char *id, const long v
int snd_config_imake_integer64(snd_config_t **config, const char *id, const long long value) int snd_config_imake_integer64(snd_config_t **config, const char *id, const long long value)
{ {
int err; int err;
err = snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER64); err = snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER64);
if (err < 0) if (err < 0)
return err; return err;
@ -2831,7 +2831,7 @@ int snd_config_imake_integer64(snd_config_t **config, const char *id, const long
int snd_config_imake_real(snd_config_t **config, const char *id, const double value) int snd_config_imake_real(snd_config_t **config, const char *id, const double value)
{ {
int err; int err;
err = snd_config_make(config, id, SND_CONFIG_TYPE_REAL); err = snd_config_make(config, id, SND_CONFIG_TYPE_REAL);
if (err < 0) if (err < 0)
return err; return err;
@ -2862,7 +2862,7 @@ int snd_config_imake_string(snd_config_t **config, const char *id, const char *v
{ {
int err; int err;
snd_config_t *tmp; snd_config_t *tmp;
err = snd_config_make(&tmp, id, SND_CONFIG_TYPE_STRING); err = snd_config_make(&tmp, id, SND_CONFIG_TYPE_STRING);
if (err < 0) if (err < 0)
return err; return err;
@ -2950,7 +2950,7 @@ int snd_config_imake_safe_string(snd_config_t **config, const char *id, const ch
int snd_config_imake_pointer(snd_config_t **config, const char *id, const void *value) int snd_config_imake_pointer(snd_config_t **config, const char *id, const void *value)
{ {
int err; int err;
err = snd_config_make(config, id, SND_CONFIG_TYPE_POINTER); err = snd_config_make(config, id, SND_CONFIG_TYPE_POINTER);
if (err < 0) if (err < 0)
return err; return err;
@ -4422,7 +4422,7 @@ static int _snd_config_hook_table(snd_config_t *root, snd_config_t *config, snd_
int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data ATTRIBUTE_UNUSED) int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data ATTRIBUTE_UNUSED)
{ {
int card = -1, err; int card = -1, err;
do { do {
err = snd_card_next(&card); err = snd_card_next(&card);
if (err < 0) if (err < 0)
@ -4478,7 +4478,7 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config,
SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK); SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK);
#endif #endif
/** /**
* \brief Updates a configuration tree by rereading the configuration files (if needed). * \brief Updates a configuration tree by rereading the configuration files (if needed).
* \param[in,out] _top Address of the handle to the top-level node. * \param[in,out] _top Address of the handle to the top-level node.
* \param[in,out] _update Address of a pointer to private update information. * \param[in,out] _update Address of a pointer to private update information.
@ -4514,7 +4514,7 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
snd_config_update_t *local; snd_config_update_t *local;
snd_config_update_t *update; snd_config_update_t *update;
snd_config_t *top; snd_config_t *top;
assert(_top && _update); assert(_top && _update);
top = *_top; top = *_top;
update = *_update; update = *_update;
@ -4608,12 +4608,12 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
return err; return err;
_reread: _reread:
*_top = NULL; *_top = NULL;
*_update = NULL; *_update = NULL;
if (update) { if (update) {
snd_config_update_free(update); snd_config_update_free(update);
update = NULL; update = NULL;
} }
if (top) { if (top) {
snd_config_delete(top); snd_config_delete(top);
top = NULL; top = NULL;
@ -4648,7 +4648,7 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
return 1; return 1;
} }
/** /**
* \brief Updates #snd_config by rereading the global configuration files (if needed). * \brief Updates #snd_config by rereading the global configuration files (if needed).
* \return 0 if #snd_config was up to date, 1 if #snd_config was * \return 0 if #snd_config was up to date, 1 if #snd_config was
* updated, otherwise a negative error code. * updated, otherwise a negative error code.
@ -4744,7 +4744,7 @@ void snd_config_unref(snd_config_t *cfg)
snd_config_unlock(); snd_config_unlock();
} }
/** /**
* \brief Frees a private update structure. * \brief Frees a private update structure.
* \param[in] update The private update structure to free. * \param[in] update The private update structure to free.
* \return Zero if successful, otherwise a negative error code. * \return Zero if successful, otherwise a negative error code.
@ -4761,7 +4761,7 @@ int snd_config_update_free(snd_config_update_t *update)
return 0; return 0;
} }
/** /**
* \brief Frees the global configuration tree in #snd_config. * \brief Frees the global configuration tree in #snd_config.
* \return Zero if successful, otherwise a negative error code. * \return Zero if successful, otherwise a negative error code.
* *
@ -4881,7 +4881,7 @@ typedef int (*snd_config_walk_callback_t)(snd_config_t *src,
static int snd_config_walk(snd_config_t *src, static int snd_config_walk(snd_config_t *src,
snd_config_t *root, snd_config_t *root,
snd_config_t **dst, snd_config_t **dst,
snd_config_walk_callback_t callback, snd_config_walk_callback_t callback,
snd_config_expand_fcn_t fcn, snd_config_expand_fcn_t fcn,
void *private_data) void *private_data)
@ -5221,7 +5221,7 @@ static int _snd_config_evaluate(snd_config_t *src,
* replaces those nodes with the respective function results. * replaces those nodes with the respective function results.
*/ */
int snd_config_evaluate(snd_config_t *config, snd_config_t *root, int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
snd_config_t *private_data, snd_config_t **result) snd_config_t *private_data, snd_config_t **result)
{ {
/* FIXME: Only in place evaluation is currently implemented */ /* FIXME: Only in place evaluation is currently implemented */
assert(result == NULL); assert(result == NULL);
@ -5408,7 +5408,7 @@ static int parse_string(const char **ptr, char **val)
buf[idx++] = c; buf[idx++] = c;
} }
} }
/* Parse var=val or val */ /* Parse var=val or val */
static int parse_arg(const char **ptr, unsigned int *varlen, char **val) static int parse_arg(const char **ptr, unsigned int *varlen, char **val)
@ -5508,7 +5508,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
} }
return 0; return 0;
} }
while (1) { while (1) {
char buf[256]; char buf[256];
const char *var = buf; const char *var = buf;
@ -5725,7 +5725,7 @@ int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args
*result = res; *result = res;
err = 1; err = 1;
_end: _end:
if (subs) if (subs)
snd_config_delete(subs); snd_config_delete(subs);
return err; return err;
} }

View file

@ -5,7 +5,7 @@
* \author Abramo Bagnara <abramo@alsa-project.org> * \author Abramo Bagnara <abramo@alsa-project.org>
* \author Jaroslav Kysela <perex@perex.cz> * \author Jaroslav Kysela <perex@perex.cz>
* \date 2000-2001 * \date 2000-2001
* *
* Configuration helper functions. * Configuration helper functions.
* *
* See the \ref conffunc page for more details. * See the \ref conffunc page for more details.
@ -176,7 +176,7 @@ int snd_config_get_card(const snd_config_t *conf)
* \brief Gets the control interface index from the given ASCII string. * \brief Gets the control interface index from the given ASCII string.
* \param ascii The string to be parsed. * \param ascii The string to be parsed.
* \return The control interface index if successful, otherwise a negative error code. * \return The control interface index if successful, otherwise a negative error code.
*/ */
int snd_config_get_ctl_iface_ascii(const char *ascii) int snd_config_get_ctl_iface_ascii(const char *ascii)
{ {
long v; long v;
@ -199,7 +199,7 @@ int snd_config_get_ctl_iface_ascii(const char *ascii)
* \brief Gets the control interface index from a configuration node. * \brief Gets the control interface index from a configuration node.
* \param conf Handle to the configuration node to be parsed. * \param conf Handle to the configuration node to be parsed.
* \return The control interface index if successful, otherwise a negative error code. * \return The control interface index if successful, otherwise a negative error code.
*/ */
int snd_config_get_ctl_iface(const snd_config_t *conf) int snd_config_get_ctl_iface(const snd_config_t *conf)
{ {
long v; long v;
@ -251,7 +251,7 @@ int snd_config_get_ctl_iface(const snd_config_t *conf)
default 0 default 0
} }
\endcode \endcode
*/ */
int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data) snd_config_t *private_data)
{ {
@ -260,7 +260,7 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
const char *res, *id; const char *res, *id;
char *def = NULL; char *def = NULL;
int idx = 0, err, hit; int idx = 0, err, hit;
err = snd_config_search(src, "vars", &n); err = snd_config_search(src, "vars", &n);
if (err < 0) { if (err < 0) {
snd_error(CORE, "field vars not found"); snd_error(CORE, "field vars not found");
@ -351,7 +351,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_getenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
default 0 default 0
} }
\endcode \endcode
*/ */
int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data) snd_config_t *private_data)
{ {
@ -385,7 +385,7 @@ int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN
SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE); SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
#endif #endif
/** /**
* \brief Merges the given strings. * \brief Merges the given strings.
* \param dst The function puts the handle to the result configuration node * \param dst The function puts the handle to the result configuration node
@ -402,7 +402,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
strings [ "a1" "b2" "c3" ] strings [ "a1" "b2" "c3" ]
} }
\endcode \endcode
*/ */
int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src, int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data) snd_config_t *private_data)
{ {
@ -411,7 +411,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
const char *id; const char *id;
char *res = NULL, *tmp; char *res = NULL, *tmp;
int idx = 0, len = 0, len1, err, hit; int idx = 0, len = 0, len1, err, hit;
err = snd_config_search(src, "strings", &n); err = snd_config_search(src, "strings", &n);
if (err < 0) { if (err < 0) {
snd_error(CORE, "field strings not found"); snd_error(CORE, "field strings not found");
@ -490,7 +490,7 @@ static int snd_func_iops(snd_config_t **dst,
char *res = NULL; char *res = NULL;
long result = 0, val; long result = 0, val;
int idx = 0, err, hit; int idx = 0, err, hit;
err = snd_config_search(src, "integers", &n); err = snd_config_search(src, "integers", &n);
if (err < 0) { if (err < 0) {
snd_error(CORE, "field integers not found"); snd_error(CORE, "field integers not found");
@ -556,9 +556,9 @@ static int snd_func_iops(snd_config_t **dst,
integers [ 2 3 5 ] integers [ 2 3 5 ]
} }
\endcode \endcode
*/ */
int snd_func_iadd(snd_config_t **dst, snd_config_t *root, int snd_func_iadd(snd_config_t **dst, snd_config_t *root,
snd_config_t *src, snd_config_t *private_data) snd_config_t *src, snd_config_t *private_data)
{ {
return snd_func_iops(dst, root, src, private_data, 0); return snd_func_iops(dst, root, src, private_data, 0);
} }
@ -582,7 +582,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_iadd, SND_CONFIG_DLSYM_VERSION_EVALUATE);
integers [ 2 3 2 ] integers [ 2 3 2 ]
} }
\endcode \endcode
*/ */
int snd_func_imul(snd_config_t **dst, snd_config_t *root, int snd_func_imul(snd_config_t **dst, snd_config_t *root,
snd_config_t *src, snd_config_t *private_data) snd_config_t *src, snd_config_t *private_data)
{ {
@ -607,13 +607,13 @@ SND_DLSYM_BUILD_VERSION(snd_func_imul, SND_CONFIG_DLSYM_VERSION_EVALUATE);
@func datadir @func datadir
} }
\endcode \endcode
*/ */
int snd_func_datadir(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, int snd_func_datadir(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *src, snd_config_t *private_data ATTRIBUTE_UNUSED) snd_config_t *src, snd_config_t *private_data ATTRIBUTE_UNUSED)
{ {
int err; int err;
const char *id; const char *id;
err = snd_config_get_id(src, &id); err = snd_config_get_id(src, &id);
if (err < 0) if (err < 0)
return err; return err;
@ -683,7 +683,7 @@ notfound:
@func private_string @func private_string
} }
\endcode \endcode
*/ */
int snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, int snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *src, snd_config_t *private_data) snd_config_t *src, snd_config_t *private_data)
{ {
@ -797,7 +797,7 @@ int snd_determine_driver(int card, char **driver)
@func private_card_driver @func private_card_driver
} }
\endcode \endcode
*/ */
int snd_func_private_card_driver(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, int snd_func_private_card_driver(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src,
snd_config_t *private_data) snd_config_t *private_data)
{ {
@ -834,7 +834,7 @@ static int parse_card(snd_config_t *root, snd_config_t *src,
snd_config_t *n; snd_config_t *n;
char *str; char *str;
int card, err; int card, err;
err = snd_config_search(src, "card", &n); err = snd_config_search(src, "card", &n);
if (err < 0) { if (err < 0) {
snd_error(CORE, "field card not found"); snd_error(CORE, "field card not found");
@ -873,13 +873,13 @@ static int parse_card(snd_config_t *root, snd_config_t *src,
card '0' card '0'
} }
\endcode \endcode
*/ */
int snd_func_card_inum(snd_config_t **dst, snd_config_t *root, snd_config_t *src, int snd_func_card_inum(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data) snd_config_t *private_data)
{ {
const char *id; const char *id;
int card, err; int card, err;
card = parse_card(root, src, private_data); card = parse_card(root, src, private_data);
if (card < 0) if (card < 0)
return card; return card;
@ -908,13 +908,13 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_inum, SND_CONFIG_DLSYM_VERSION_EVALUATE);
card 0 card 0
} }
\endcode \endcode
*/ */
int snd_func_card_driver(snd_config_t **dst, snd_config_t *root, snd_config_t *src, int snd_func_card_driver(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data) snd_config_t *private_data)
{ {
snd_config_t *val; snd_config_t *val;
int card, err; int card, err;
card = parse_card(root, src, private_data); card = parse_card(root, src, private_data);
if (card < 0) if (card < 0)
return card; return card;
@ -945,7 +945,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_driver, SND_CONFIG_DLSYM_VERSION_EVALUATE)
card 0 card 0
} }
\endcode \endcode
*/ */
int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data) snd_config_t *private_data)
{ {
@ -953,7 +953,7 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_ctl_card_info_t info = {0}; snd_ctl_card_info_t info = {0};
const char *id; const char *id;
int card, err; int card, err;
card = parse_card(root, src, private_data); card = parse_card(root, src, private_data);
if (card < 0) if (card < 0)
return card; return card;
@ -972,8 +972,8 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
err = snd_config_imake_string(dst, id, err = snd_config_imake_string(dst, id,
snd_ctl_card_info_get_id(&info)); snd_ctl_card_info_get_id(&info));
__error: __error:
if (ctl) if (ctl)
snd_ctl_close(ctl); snd_ctl_close(ctl);
return err; return err;
} }
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN
@ -996,7 +996,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
card 0 card 0
} }
\endcode \endcode
*/ */
int snd_func_card_name(snd_config_t **dst, snd_config_t *root, int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
snd_config_t *src, snd_config_t *private_data) snd_config_t *src, snd_config_t *private_data)
{ {
@ -1004,7 +1004,7 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
snd_ctl_card_info_t info = {0}; snd_ctl_card_info_t info = {0};
const char *id; const char *id;
int card, err; int card, err;
card = parse_card(root, src, private_data); card = parse_card(root, src, private_data);
if (card < 0) if (card < 0)
return card; return card;
@ -1023,8 +1023,8 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
err = snd_config_imake_safe_string(dst, id, err = snd_config_imake_safe_string(dst, id,
snd_ctl_card_info_get_name(&info)); snd_ctl_card_info_get_name(&info));
__error: __error:
if (ctl) if (ctl)
snd_ctl_close(ctl); snd_ctl_close(ctl);
return err; return err;
} }
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN
@ -1033,7 +1033,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_name, SND_CONFIG_DLSYM_VERSION_EVALUATE);
#ifdef DOXYGEN #ifdef DOXYGEN
/* For consistency with the PCM Interface module, include documentation even /* For consistency with the PCM Interface module, include documentation even
* when PCM module is not included in the build. */ * when PCM module is not included in the build. */
#ifndef BUILD_PCM #ifndef BUILD_PCM
#define BUILD_PCM #define BUILD_PCM
#endif #endif
@ -1060,7 +1060,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_name, SND_CONFIG_DLSYM_VERSION_EVALUATE);
subdevice 0 # optional subdevice 0 # optional
} }
\endcode \endcode
*/ */
int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{ {
snd_config_t *n; snd_config_t *n;
@ -1069,7 +1069,7 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v
const char *id; const char *id;
long card, device, subdevice = 0; long card, device, subdevice = 0;
int err; int err;
card = parse_card(root, src, private_data); card = parse_card(root, src, private_data);
if (card < 0) if (card < 0)
return card; return card;
@ -1117,8 +1117,8 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v
err = snd_config_imake_string(dst, id, err = snd_config_imake_string(dst, id,
snd_pcm_info_get_id(&info)); snd_pcm_info_get_id(&info));
__error: __error:
if (ctl) if (ctl)
snd_ctl_close(ctl); snd_ctl_close(ctl);
return err; return err;
} }
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN
@ -1144,7 +1144,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_pcm_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
index 0 index 0
} }
\endcode \endcode
*/ */
int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{ {
snd_config_t *n; snd_config_t *n;
@ -1217,14 +1217,14 @@ int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_confi
index == idx++) index == idx++)
goto __out; goto __out;
} }
snd_ctl_close(ctl); snd_ctl_close(ctl);
ctl = NULL; ctl = NULL;
} }
err = -ENODEV; err = -ENODEV;
__out: __out:
if (ctl) if (ctl)
snd_ctl_close(ctl); snd_ctl_close(ctl);
if (err < 0) if (err < 0)
return err; return err;
if((err = snd_config_get_id(src, &id)) >= 0) { if((err = snd_config_get_id(src, &id)) >= 0) {
@ -1254,7 +1254,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_pcm_args_by_class, SND_CONFIG_DLSYM_VERSION_EVA
@func private_pcm_subdevice @func private_pcm_subdevice
} }
\endcode \endcode
*/ */
int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *src, snd_config_t *private_data) snd_config_t *src, snd_config_t *private_data)
{ {
@ -1314,14 +1314,14 @@ SND_DLSYM_BUILD_VERSION(snd_func_private_pcm_subdevice, SND_CONFIG_DLSYM_VERSION
name "id1.id2.id3" name "id1.id2.id3"
} }
\endcode \endcode
*/ */
int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src, int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data) snd_config_t *private_data)
{ {
snd_config_t *n; snd_config_t *n;
const char *file = NULL, *name = NULL; const char *file = NULL, *name = NULL;
int err; int err;
err = snd_config_search(src, "file", &n); err = snd_config_search(src, "file", &n);
if (err >= 0) { if (err >= 0) {
err = snd_config_evaluate(n, root, private_data, NULL); err = snd_config_evaluate(n, root, private_data, NULL);

View file

@ -108,7 +108,7 @@ int snd_card_load(int card)
int snd_card_next(int *rcard) int snd_card_next(int *rcard)
{ {
int card; int card;
if (rcard == NULL) if (rcard == NULL)
return -EINVAL; return -EINVAL;
card = *rcard; card = *rcard;
@ -194,7 +194,7 @@ int snd_card_get_name(int card, char **name)
snd_ctl_t *handle; snd_ctl_t *handle;
snd_ctl_card_info_t info; snd_ctl_card_info_t info;
int err; int err;
if (name == NULL) if (name == NULL)
return -EINVAL; return -EINVAL;
if ((err = snd_ctl_hw_open(&handle, NULL, card, 0)) < 0) if ((err = snd_ctl_hw_open(&handle, NULL, card, 0)) < 0)
@ -224,7 +224,7 @@ int snd_card_get_longname(int card, char **name)
snd_ctl_t *handle; snd_ctl_t *handle;
snd_ctl_card_info_t info; snd_ctl_card_info_t info;
int err; int err;
if (name == NULL) if (name == NULL)
return -EINVAL; return -EINVAL;
if ((err = snd_ctl_hw_open(&handle, NULL, card, 0)) < 0) if ((err = snd_ctl_hw_open(&handle, NULL, card, 0)) < 0)

View file

@ -52,7 +52,7 @@ file. The format is:
\verbatim \verbatim
index [ID ] Driver - name index [ID ] Driver - name
longname longname
\endverbatim \endverbatim
Note that the mixername and components are not listed. Note that the mixername and components are not listed.
@ -279,7 +279,7 @@ int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name, int mod
*ctlp = ctl; *ctlp = ctl;
return 0; return 0;
} }
/** /**
* \brief set async mode * \brief set async mode
@ -353,7 +353,7 @@ int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsign
return ctl->ops->poll_revents(ctl, pfds, nfds, revents); return ctl->ops->poll_revents(ctl, pfds, nfds, revents);
if (nfds == 1) { if (nfds == 1) {
*revents = pfds->revents; *revents = pfds->revents;
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
} }
@ -1039,7 +1039,7 @@ int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *data)
static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag, static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag,
const snd_ctl_elem_id_t *id, const snd_ctl_elem_id_t *id,
unsigned int *tlv, unsigned int tlv_size) unsigned int *tlv, unsigned int tlv_size)
{ {
snd_ctl_elem_info_t *info = NULL; snd_ctl_elem_info_t *info = NULL;
int err; int err;
@ -1060,8 +1060,8 @@ static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag,
} }
err = ctl->ops->element_tlv(ctl, op_flag, id->numid, tlv, tlv_size); err = ctl->ops->element_tlv(ctl, op_flag, id->numid, tlv, tlv_size);
__err: __err:
if (info) if (info)
free(info); free(info);
return err; return err;
} }
@ -1402,7 +1402,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
* \param private_data Callback private data * \param private_data Callback private data
* \return 0 otherwise a negative error code on failure * \return 0 otherwise a negative error code on failure
*/ */
int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl, int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
snd_async_callback_t callback, void *private_data) snd_async_callback_t callback, void *private_data)
{ {
int err; int err;
@ -1752,7 +1752,7 @@ int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries
} }
obj->space = entries; obj->space = entries;
return 0; return 0;
} }
/** /**
* \brief free previously allocated space for CTL element identifiers list * \brief free previously allocated space for CTL element identifiers list

View file

@ -42,7 +42,7 @@ const char *_snd_module_control_ext = "";
static int snd_ctl_ext_close(snd_ctl_t *handle) static int snd_ctl_ext_close(snd_ctl_t *handle)
{ {
snd_ctl_ext_t *ext = handle->private_data; snd_ctl_ext_t *ext = handle->private_data;
if (ext->callback->close) if (ext->callback->close)
ext->callback->close(ext); ext->callback->close(ext);
return 0; return 0;
@ -458,7 +458,7 @@ static int snd_ctl_ext_poll_revents(snd_ctl_t *handle, struct pollfd *pfds, unsi
return ext->callback->poll_revents(ext, pfds, nfds, revents); return ext->callback->poll_revents(ext, pfds, nfds, revents);
if (nfds == 1) { if (nfds == 1) {
*revents = pfds->revents; *revents = pfds->revents;
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
} }
@ -529,7 +529,7 @@ usually you will call the external plugin API function
#snd_ctl_ext_create(). #snd_ctl_ext_create().
The control handle must be filled *phandle in return. The control handle must be filled *phandle in return.
Then this function must return either a value 0 when succeeded, or a Then this function must return either a value 0 when succeeded, or a
negative value as the error code. negative value as the error code.
Finally, add #SND_CTL_PLUGIN_SYMBOL() with the name of your Finally, add #SND_CTL_PLUGIN_SYMBOL() with the name of your
plugin as the argument at the end. This defines the proper versioned plugin as the argument at the end. This defines the proper versioned
@ -625,7 +625,7 @@ PCM.
\section ctl_ext_impl_cb Callback Functions of External Control Plugins \section ctl_ext_impl_cb Callback Functions of External Control Plugins
The callback functions in #snd_ctl_ext_callback_t define the real The callback functions in #snd_ctl_ext_callback_t define the real
behavior of the driver. There are many callbacks but many of them are optional. behavior of the driver. There are many callbacks but many of them are optional.
The close callback is called when the PCM is closed. If the plugin The close callback is called when the PCM is closed. If the plugin
allocates private resources, this is the place to release them allocates private resources, this is the place to release them
@ -650,7 +650,7 @@ if you use get, read and write callbacks as follows.
If you need to create a record dynamically (e.g. via malloc) at each find_elem call, If you need to create a record dynamically (e.g. via malloc) at each find_elem call,
the allocated record can be released with the optional free_key callback. the allocated record can be released with the optional free_key callback.
The get_attribute is a mandatory callback, which returns the attribute of the The get_attribute is a mandatory callback, which returns the attribute of the
control element given via a key value (converted with find_elem callback). control element given via a key value (converted with find_elem callback).
It must fill the control element type (#snd_ctl_elem_type_t), the access type It must fill the control element type (#snd_ctl_elem_type_t), the access type
(#snd_ctl_ext_access_t), and the count (element array size). The callback returns (#snd_ctl_ext_access_t), and the count (element array size). The callback returns

View file

@ -225,20 +225,20 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag,
unsigned int inum; unsigned int inum;
snd_ctl_hw_t *hw = handle->private_data; snd_ctl_hw_t *hw = handle->private_data;
struct snd_ctl_tlv *xtlv; struct snd_ctl_tlv *xtlv;
/* we don't support TLV on protocol ver 2.0.3 or earlier */ /* we don't support TLV on protocol ver 2.0.3 or earlier */
if (hw->protocol < SNDRV_PROTOCOL_VERSION(2, 0, 4)) if (hw->protocol < SNDRV_PROTOCOL_VERSION(2, 0, 4))
return -ENXIO; return -ENXIO;
switch (op_flag) { switch (op_flag) {
case -1: inum = SNDRV_CTL_IOCTL_TLV_COMMAND; break; case -1: inum = SNDRV_CTL_IOCTL_TLV_COMMAND; break;
case 0: inum = SNDRV_CTL_IOCTL_TLV_READ; break; case 0: inum = SNDRV_CTL_IOCTL_TLV_READ; break;
case 1: inum = SNDRV_CTL_IOCTL_TLV_WRITE; break; case 1: inum = SNDRV_CTL_IOCTL_TLV_WRITE; break;
default: return -EINVAL; default: return -EINVAL;
} }
xtlv = malloc(sizeof(struct snd_ctl_tlv) + tlv_size); xtlv = malloc(sizeof(struct snd_ctl_tlv) + tlv_size);
if (xtlv == NULL) if (xtlv == NULL)
return -ENOMEM; return -ENOMEM;
xtlv->numid = numid; xtlv->numid = numid;
xtlv->length = tlv_size; xtlv->length = tlv_size;
memcpy(xtlv->tlv, tlv, tlv_size); memcpy(xtlv->tlv, tlv, tlv_size);
@ -435,7 +435,7 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
snd_ctl_hw_t *hw; snd_ctl_hw_t *hw;
int err; int err;
*handle = NULL; *handle = NULL;
if (CHECK_SANITY(card < 0 || card >= SND_MAX_CARDS)) { if (CHECK_SANITY(card < 0 || card >= SND_MAX_CARDS)) {
snd_check(CONTROL, "Invalid card index %d", card); snd_check(CONTROL, "Invalid card index %d", card);

View file

@ -85,7 +85,7 @@ struct _snd_hctl_elem {
struct _snd_hctl { struct _snd_hctl {
snd_ctl_t *ctl; snd_ctl_t *ctl;
struct list_head elems; /* list of all controls */ struct list_head elems; /* list of all controls */
unsigned int alloc; unsigned int alloc;
unsigned int count; unsigned int count;
snd_hctl_elem_t **pelems; snd_hctl_elem_t **pelems;
snd_hctl_compare_t compare; snd_hctl_compare_t compare;

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> #include <stddef.h>
@ -420,7 +420,7 @@ static int make_local_socket(const char *filename)
sock = socket(PF_LOCAL, SOCK_STREAM, 0); sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0) if (sock < 0)
return -errno; return -errno;
addr->sun_family = AF_LOCAL; addr->sun_family = AF_LOCAL;
memcpy(addr->sun_path, filename, l); memcpy(addr->sun_path, filename, l);
@ -492,7 +492,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
result = -errno; result = -errno;
goto _err; goto _err;
} }
shm = calloc(1, sizeof(snd_ctl_shm_t)); shm = calloc(1, sizeof(snd_ctl_shm_t));
if (!shm) { if (!shm) {
result = -ENOMEM; result = -ENOMEM;

View file

@ -31,7 +31,7 @@ static const char **snd_control_open_objects[] = {
&_snd_module_control_empty, &_snd_module_control_empty,
#include "ctl_symbols_list.c" #include "ctl_symbols_list.c"
}; };
void *snd_control_open_symbols(void) void *snd_control_open_symbols(void)
{ {
return snd_control_open_objects; return snd_control_open_objects;

View file

@ -253,7 +253,7 @@ int __snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str,
if (*str) if (*str)
goto out; goto out;
} }
} }
err = 0; err = 0;
out: out:
@ -277,12 +277,12 @@ int snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str)
static int get_ctl_enum_item_index(snd_ctl_t *handle, static int get_ctl_enum_item_index(snd_ctl_t *handle,
snd_ctl_elem_info_t *info, snd_ctl_elem_info_t *info,
const char **ptrp) const char **ptrp)
{ {
char *ptr = (char *)*ptrp; char *ptr = (char *)*ptrp;
int items, i, len; int items, i, len;
const char *name; const char *name;
char end; char end;
items = snd_ctl_elem_info_get_items(info); items = snd_ctl_elem_info_get_items(info);
if (items <= 0) if (items <= 0)
return -1; return -1;
@ -362,7 +362,7 @@ int snd_ctl_ascii_value_parse(snd_ctl_t *handle,
if (count > get_ctl_type_max_elements(type)) if (count > get_ctl_type_max_elements(type))
count = get_ctl_type_max_elements(type); count = get_ctl_type_max_elements(type);
for (idx = 0; idx < count && ptr && *ptr; idx++) { for (idx = 0; idx < count && ptr && *ptr; idx++) {
if (*ptr == ',') if (*ptr == ',')
goto skip; goto skip;

View file

@ -71,7 +71,7 @@ int snd_hctl_open(snd_hctl_t **hctlp, const char *name, int mode)
{ {
snd_ctl_t *ctl; snd_ctl_t *ctl;
int err; int err;
if ((err = snd_ctl_open(&ctl, name, mode)) < 0) if ((err = snd_ctl_open(&ctl, name, mode)) < 0)
return err; return err;
err = snd_hctl_open_ctl(hctlp, ctl); err = snd_hctl_open_ctl(hctlp, ctl);
@ -294,7 +294,7 @@ static int get_compare_weight(const snd_ctl_elem_id_t *id)
}; };
const char *name = (char *)id->name, *name1; const char *name = (char *)id->name, *name1;
int res, res1; int res, res1;
if ((res = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names, 1000000)) == NOT_FOUND) if ((res = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names, 1000000)) == NOT_FOUND)
return NOT_FOUND; return NOT_FOUND;
if (*name == '\0') if (*name == '\0')
@ -346,7 +346,7 @@ static int _snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id, in
static int snd_hctl_elem_add(snd_hctl_t *hctl, snd_hctl_elem_t *elem) static int snd_hctl_elem_add(snd_hctl_t *hctl, snd_hctl_elem_t *elem)
{ {
int dir; int dir;
int idx; int idx;
elem->compare_weight = get_compare_weight(&elem->id); elem->compare_weight = get_compare_weight(&elem->id);
if (hctl->count == hctl->alloc) { if (hctl->count == hctl->alloc) {
snd_hctl_elem_t **h; snd_hctl_elem_t **h;
@ -677,7 +677,7 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
struct pollfd *pfd; struct pollfd *pfd;
unsigned short *revents; unsigned short *revents;
int i, npfds, pollio, err, err_poll; int i, npfds, pollio, err, err_poll;
npfds = snd_hctl_poll_descriptors_count(hctl); npfds = snd_hctl_poll_descriptors_count(hctl);
if (npfds <= 0 || npfds >= 16) { if (npfds <= 0 || npfds >= 16) {
snd_error(CONTROL, "Invalid poll_fds %d", npfds); snd_error(CONTROL, "Invalid poll_fds %d", npfds);
@ -781,7 +781,7 @@ int snd_hctl_handle_events(snd_hctl_t *hctl)
snd_ctl_event_t event; snd_ctl_event_t event;
int res; int res;
unsigned int count = 0; unsigned int count = 0;
assert(hctl); assert(hctl);
assert(hctl->ctl); assert(hctl->ctl);
while ((res = snd_ctl_read(hctl->ctl, &event)) != 0 && while ((res = snd_ctl_read(hctl->ctl, &event)) != 0 &&

View file

@ -37,7 +37,7 @@ struct hint_list {
const char *siface; const char *siface;
snd_ctl_elem_iface_t iface; snd_ctl_elem_iface_t iface;
snd_ctl_t *ctl; snd_ctl_t *ctl;
snd_ctl_card_info_t *info; snd_ctl_card_info_t *info;
int card; int card;
int device; int device;
long device_input; long device_input;
@ -173,7 +173,7 @@ static char *get_dev_name(struct hint_list *list)
{ {
char *str1, *str2, *res; char *str1, *str2, *res;
int device; int device;
device = list->device_input >= 0 ? list->device_input : list->device; device = list->device_input >= 0 ? list->device_input : list->device;
if (get_dev_name1(list, &str1, device, 1) < 0) if (get_dev_name1(list, &str1, device, 1) < 0)
return NULL; return NULL;
@ -261,7 +261,7 @@ static int try_config(snd_config_t *config,
snd_config_get_string(cfg, &str) >= 0 && snd_config_get_string(cfg, &str) >= 0 &&
((strncmp(base, str, strlen(base)) == 0 && ((strncmp(base, str, strlen(base)) == 0 &&
str[strlen(base)] == '.') || strchr(str, '.') == NULL)) str[strlen(base)] == '.') || strchr(str, '.') == NULL))
goto __skip_add; goto __skip_add;
if (list->card >= 0 && list->device >= 0) if (list->card >= 0 && list->device >= 0)
sprintf(buf, "%s:CARD=%s,DEV=%i", name, snd_ctl_card_info_get_id(list->info), list->device); sprintf(buf, "%s:CARD=%s,DEV=%i", name, snd_ctl_card_info_get_id(list->info), list->device);
else if (list->card >= 0) else if (list->card >= 0)
@ -294,7 +294,7 @@ static int try_config(snd_config_t *config,
cfg1 = res; cfg1 = res;
level = 0; level = 0;
__hint: __hint:
level++; level++;
if (snd_config_search(cfg1, "type", &cfg) >= 0 && if (snd_config_search(cfg1, "type", &cfg) >= 0 &&
snd_config_get_string(cfg, &str) >= 0 && snd_config_get_string(cfg, &str) >= 0 &&
strcmp(str, "hw") == 0) { strcmp(str, "hw") == 0) {
@ -306,7 +306,7 @@ static int try_config(snd_config_t *config,
} }
} }
} }
if (snd_config_search(cfg1, "hint", &cfg) >= 0) { if (snd_config_search(cfg1, "hint", &cfg) >= 0) {
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
snd_error(CONTROL, "hint (%s) must be a compound", buf); snd_error(CONTROL, "hint (%s) must be a compound", buf);
@ -363,7 +363,7 @@ static int try_config(snd_config_t *config,
goto __skip_add; goto __skip_add;
if (snd_config_search(cfg1, "slave", &cfg) >= 0 && if (snd_config_search(cfg1, "slave", &cfg) >= 0 &&
snd_config_search(cfg, base, &cfg1) >= 0) snd_config_search(cfg, base, &cfg1) >= 0)
goto __hint; goto __hint;
snd_config_delete(res); snd_config_delete(res);
res = NULL; res = NULL;
cleanup_res = 0; cleanup_res = 0;
@ -395,38 +395,38 @@ static int try_config(snd_config_t *config,
__ok: __ok:
err = 0; err = 0;
__cleanup: __cleanup:
if (err >= 0) { if (err >= 0) {
list->device = dev; list->device = dev;
str = list->card >= 0 ? get_dev_name(list) : NULL; str = list->card >= 0 ? get_dev_name(list) : NULL;
if (str != NULL) { if (str != NULL) {
level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str); level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str);
buf2 = realloc((char *)str, level + 1); buf2 = realloc((char *)str, level + 1);
if (buf2 != NULL) { if (buf2 != NULL) {
if (buf1 != NULL) { if (buf1 != NULL) {
str = strchr(buf2, '|'); str = strchr(buf2, '|');
if (str != NULL) if (str != NULL)
memmove(buf2 + (level - strlen(str)), str, strlen(str)); memmove(buf2 + (level - strlen(str)), str, strlen(str));
else else
str = buf2 + strlen(buf2); str = buf2 + strlen(buf2);
*(char *)str++ = '\n'; *(char *)str++ = '\n';
memcpy((char *)str, buf1, strlen(buf1)); memcpy((char *)str, buf1, strlen(buf1));
buf2[level] = '\0'; buf2[level] = '\0';
free(buf1); free(buf1);
} }
buf1 = buf2; buf1 = buf2;
} else { } else {
free((char *)str); free((char *)str);
} }
} else if (list->device >= 0) } else if (list->device >= 0)
goto __skip_add; goto __skip_add;
err = hint_list_add(list, buf, buf1); err = hint_list_add(list, buf, buf1);
} }
__skip_add: __skip_add:
if (res && cleanup_res) if (res && cleanup_res)
snd_config_delete(res); snd_config_delete(res);
if (buf1) if (buf1)
free(buf1); free(buf1);
free(buf); free(buf);
return err; return err;
} }
@ -455,7 +455,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l
char ctl_name[16]; char ctl_name[16];
snd_ctl_card_info_t info = {0}; snd_ctl_card_info_t info = {0};
int device, max_device = 0; int device, max_device = 0;
list->info = &info; list->info = &info;
err = snd_config_search(config, list->siface, &conf); err = snd_config_search(config, list->siface, &conf);
if (err < 0) if (err < 0)
@ -471,7 +471,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l
n = snd_config_iterator_entry(i); n = snd_config_iterator_entry(i);
if (snd_config_get_id(n, &str) < 0) if (snd_config_get_id(n, &str) < 0)
continue; continue;
if (next_devices[list->iface] != NULL) { if (next_devices[list->iface] != NULL) {
list->card = card; list->card = card;
device = max_device = -1; device = max_device = -1;
@ -510,7 +510,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l
} }
err = 0; err = 0;
__error: __error:
snd_ctl_close(list->ctl); snd_ctl_close(list->ctl);
return err; return err;
} }
@ -665,9 +665,9 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
if (!err && !list.list) if (!err && !list.list)
err = hint_list_add(&list, NULL, NULL); err = hint_list_add(&list, NULL, NULL);
if (err < 0) if (err < 0)
snd_device_name_free_hint((void **)list.list); snd_device_name_free_hint((void **)list.list);
else else
*hints = (void **)list.list; *hints = (void **)list.list;
free(list.cardname); free(list.cardname);
if (local_config_rw) if (local_config_rw)
snd_config_delete(local_config_rw); snd_config_delete(local_config_rw);
@ -726,7 +726,7 @@ char *snd_device_name_get_hint(const void *hint, const char *id)
return NULL; return NULL;
hint1 = delim + 1; hint1 = delim + 1;
continue; continue;
} }
if (delim == NULL) if (delim == NULL)
return strdup(hint1 + 4); return strdup(hint1 + 4);
size = delim - hint1 - 4; size = delim - hint1 - 4;

View file

@ -564,14 +564,14 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
if (err < 0) if (err < 0)
goto _err; goto _err;
} }
err = snd_config_get_ctl_elem_value(value, h->ctl, elem->val, elem->mask, elem->info); err = snd_config_get_ctl_elem_value(value, h->ctl, elem->val, elem->mask, elem->info);
if (err < 0) if (err < 0)
goto _err; goto _err;
list_add_tail(&elem->list, &h->elems); list_add_tail(&elem->list, &h->elems);
_err: _err:
if (err < 0 && elem) { if (err < 0 && elem) {
if (elem->id) if (elem->id)
snd_ctl_elem_id_free(elem->id); snd_ctl_elem_id_free(elem->id);
if (elem->info) if (elem->info)

View file

@ -211,7 +211,7 @@ static int snd_dlsym_verify(void *handle, const char *name, const char *version)
#ifdef HAVE_LIBDL #ifdef HAVE_LIBDL
int res; int res;
char *vname; char *vname;
if (handle == NULL) if (handle == NULL)
return -EINVAL; return -EINVAL;
vname = alloca(1 + strlen(name) + strlen(version) + 1); vname = alloca(1 + strlen(name) + strlen(version) + 1);
@ -332,8 +332,8 @@ snd_dlobj_cache_get0(const char *lib, const char *name,
errbuf[0] = '\0'; errbuf[0] = '\0';
dlobj = INTERNAL(snd_dlopen)(lib, RTLD_NOW, dlobj = INTERNAL(snd_dlopen)(lib, RTLD_NOW,
verbose ? errbuf : 0, verbose ? errbuf : 0,
verbose ? sizeof(errbuf) : 0); verbose ? sizeof(errbuf) : 0);
if (dlobj == NULL) { if (dlobj == NULL) {
if (verbose) if (verbose)
snd_error(CORE, "Cannot open shared library %s (%s)", snd_error(CORE, "Cannot open shared library %s (%s)",

View file

@ -209,7 +209,7 @@ int snd_hwdep_open_lconf(snd_hwdep_t **hwdep, const char *name,
int snd_hwdep_close(snd_hwdep_t *hwdep) int snd_hwdep_close(snd_hwdep_t *hwdep)
{ {
int err; int err;
assert(hwdep); assert(hwdep);
err = hwdep->ops->close(hwdep); err = hwdep->ops->close(hwdep);
if (hwdep->dl_handle) if (hwdep->dl_handle)
snd_dlclose(hwdep->dl_handle); snd_dlclose(hwdep->dl_handle);
@ -296,14 +296,14 @@ int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned
*/ */
int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents) int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
{ {
assert(hwdep && pfds && revents); assert(hwdep && pfds && revents);
if (nfds == 1) { if (nfds == 1) {
*revents = pfds->revents; *revents = pfds->revents;
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
} }
/** /**
* \brief set nonblock mode * \brief set nonblock mode
* \param hwdep HwDep handle * \param hwdep HwDep handle

View file

@ -111,7 +111,7 @@ int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int devi
assert(handle); assert(handle);
*handle = NULL; *handle = NULL;
if (card < 0 || card >= SND_MAX_CARDS) if (card < 0 || card >= SND_MAX_CARDS)
return -EINVAL; return -EINVAL;
sprintf(filename, SNDRV_FILE_HWDEP, card, device); sprintf(filename, SNDRV_FILE_HWDEP, card, device);

View file

@ -25,7 +25,7 @@ extern const char *_snd_module_hwdep_hw;
static const char **snd_hwdep_open_objects[] = { static const char **snd_hwdep_open_objects[] = {
&_snd_module_hwdep_hw &_snd_module_hwdep_hw
}; };
void *snd_hwdep_open_symbols(void) void *snd_hwdep_open_symbols(void)
{ {
return snd_hwdep_open_objects; return snd_hwdep_open_objects;

View file

@ -95,7 +95,7 @@ char *snd_input_gets(snd_input_t *input, char *str, size_t size)
{ {
return (input->ops->gets)(input, str, size); return (input->ops->gets)(input, str, size);
} }
/** /**
* \brief Reads a character from an input handle (like \c fgetc(3)). * \brief Reads a character from an input handle (like \c fgetc(3)).
* \param input The input handle. * \param input The input handle.
@ -144,7 +144,7 @@ static char *snd_input_stdio_gets(snd_input_t *input, char *str, size_t size)
snd_input_stdio_t *stdio = input->private_data; snd_input_stdio_t *stdio = input->private_data;
return fgets(str, (int) size, stdio->fp); return fgets(str, (int) size, stdio->fp);
} }
static int snd_input_stdio_getc(snd_input_t *input) static int snd_input_stdio_getc(snd_input_t *input)
{ {
snd_input_stdio_t *stdio = input->private_data; snd_input_stdio_t *stdio = input->private_data;
@ -197,7 +197,7 @@ int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int _close)
*inputp = input; *inputp = input;
return 0; return 0;
} }
/** /**
* \brief Creates a new input object reading from a file. * \brief Creates a new input object reading from a file.
* \param inputp The functions puts the pointer to the new input object * \param inputp The functions puts the pointer to the new input object
@ -262,7 +262,7 @@ static char *snd_input_buffer_gets(snd_input_t *input, char *str, size_t size)
*str = '\0'; *str = '\0';
return str; return str;
} }
static int snd_input_buffer_getc(snd_input_t *input) static int snd_input_buffer_getc(snd_input_t *input)
{ {
snd_input_buffer_t *buffer = input->private_data; snd_input_buffer_t *buffer = input->private_data;
@ -334,4 +334,4 @@ int snd_input_buffer_open(snd_input_t **inputp, const char *buf, ssize_t size)
*inputp = input; *inputp = input;
return 0; return 0;
} }

View file

@ -752,7 +752,7 @@ int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds,
{ {
unsigned int idx; unsigned int idx;
unsigned short res; unsigned short res;
assert(mixer && pfds && revents); assert(mixer && pfds && revents);
if (nfds == 0) if (nfds == 0)
return -EINVAL; return -EINVAL;
res = 0; res = 0;
@ -781,7 +781,7 @@ int snd_mixer_wait(snd_mixer_t *mixer, int timeout)
pfds = alloca(count * sizeof(*pfds)); pfds = alloca(count * sizeof(*pfds));
if (!pfds) if (!pfds)
return -ENOMEM; return -ENOMEM;
err = snd_mixer_poll_descriptors(mixer, pfds, err = snd_mixer_poll_descriptors(mixer, pfds,
(unsigned int) count); (unsigned int) count);
assert(err == count); assert(err == count);
} }

View file

@ -46,7 +46,7 @@ struct _snd_mixer_class {
struct list_head list; struct list_head list;
snd_mixer_t *mixer; snd_mixer_t *mixer;
snd_mixer_event_t event; snd_mixer_event_t event;
void *private_data; void *private_data;
void (*private_free)(snd_mixer_class_t *class); void (*private_free)(snd_mixer_class_t *class);
snd_mixer_compare_t compare; snd_mixer_compare_t compare;
}; };

View file

@ -122,7 +122,7 @@ int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *
return s1->id->index - s2->id->index; return s1->id->index - s2->id->index;
} }
#endif #endif
/** /**
* \brief Find a mixer simple element * \brief Find a mixer simple element
* \param mixer Mixer handle * \param mixer Mixer handle
@ -304,7 +304,7 @@ int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem,
* \param min minimum volume value * \param min minimum volume value
* \param max maximum volume value * \param max maximum volume value
*/ */
int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem, int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
long min, long max) long min, long max)
{ {
CHECK_BASIC(elem); CHECK_BASIC(elem);
@ -610,7 +610,7 @@ int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem,
* \param min minimum volume value * \param min minimum volume value
* \param max maximum volume value * \param max maximum volume value
*/ */
int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem, int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
long min, long max) long min, long max)
{ {
CHECK_BASIC(elem); CHECK_BASIC(elem);

View file

@ -243,7 +243,7 @@ static int find_module(snd_mixer_class_t *class, snd_config_t *top)
static void private_free(snd_mixer_class_t *class) static void private_free(snd_mixer_class_t *class)
{ {
class_priv_t *priv = snd_mixer_class_get_private(class); class_priv_t *priv = snd_mixer_class_get_private(class);
if (priv->private_free) if (priv->private_free)
priv->private_free(class); priv->private_free(class);
if (priv->dlhandle) if (priv->dlhandle)
@ -350,7 +350,7 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
__error: __error:
if (top) if (top)
snd_config_delete(top); snd_config_delete(top);
if (class) if (class)
snd_mixer_class_free(class); snd_mixer_class_free(class);
return err; return err;
} }

View file

@ -649,7 +649,7 @@ static int selem_write_main(snd_mixer_elem_t *elem)
static int selem_write(snd_mixer_elem_t *elem) static int selem_write(snd_mixer_elem_t *elem)
{ {
int err; int err;
err = selem_write_main(elem); err = selem_write_main(elem);
if (err < 0) if (err < 0)
selem_read(elem); selem_read(elem);
@ -883,7 +883,7 @@ static int simple_update(snd_mixer_elem_t *melem)
simple->str[SM_CAPT].max = cmax != LONG_MIN ? cmax : 0; simple->str[SM_CAPT].max = cmax != LONG_MIN ? cmax : 0;
} }
return 0; return 0;
} }
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN
static const struct suf { static const struct suf {
@ -961,7 +961,7 @@ static int base_len(const char *name, selem_ctl_type_t *type)
/* /*
* Simple Mixer Operations * Simple Mixer Operations
*/ */
static int _snd_mixer_selem_set_volume(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value) static int _snd_mixer_selem_set_volume(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value)
{ {
selem_none_t *s = snd_mixer_elem_get_private(elem); selem_none_t *s = snd_mixer_elem_get_private(elem);
@ -971,7 +971,7 @@ static int _snd_mixer_selem_set_volume(snd_mixer_elem_t *elem, int dir, snd_mixe
return 0; return 0;
if (value < s->str[dir].min || value > s->str[dir].max) if (value < s->str[dir].min || value > s->str[dir].max)
return 0; return 0;
if (s->selem.caps & if (s->selem.caps &
(dir == SM_PLAY ? SM_CAP_PVOLUME_JOIN : SM_CAP_CVOLUME_JOIN)) (dir == SM_PLAY ? SM_CAP_PVOLUME_JOIN : SM_CAP_CVOLUME_JOIN))
channel = 0; channel = 0;
if (value != s->str[dir].vol[channel]) { if (value != s->str[dir].vol[channel]) {
@ -986,7 +986,7 @@ static int _snd_mixer_selem_set_switch(snd_mixer_elem_t *elem, int dir, snd_mixe
selem_none_t *s = snd_mixer_elem_get_private(elem); selem_none_t *s = snd_mixer_elem_get_private(elem);
if ((unsigned int) channel >= s->str[dir].channels) if ((unsigned int) channel >= s->str[dir].channels)
return 0; return 0;
if (s->selem.caps & if (s->selem.caps &
(dir == SM_PLAY ? SM_CAP_PSWITCH_JOIN : SM_CAP_CSWITCH_JOIN)) (dir == SM_PLAY ? SM_CAP_PSWITCH_JOIN : SM_CAP_CSWITCH_JOIN))
channel = 0; channel = 0;
if (value) { if (value) {
@ -1006,7 +1006,7 @@ static int _snd_mixer_selem_set_switch(snd_mixer_elem_t *elem, int dir, snd_mixe
static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val) static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
{ {
selem_none_t *s = snd_mixer_elem_get_private(elem); selem_none_t *s = snd_mixer_elem_get_private(elem);
switch (cmd) { switch (cmd) {
case SM_OPS_IS_ACTIVE: { case SM_OPS_IS_ACTIVE: {
@ -1034,7 +1034,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
if (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM) ) if (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM) )
return 1; return 1;
return 0; return 0;
case SM_OPS_IS_ENUMCNT: case SM_OPS_IS_ENUMCNT:
/* Both */ /* Both */
if ( (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM)) == (SM_CAP_CENUM | SM_CAP_PENUM) ) { if ( (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM)) == (SM_CAP_CENUM | SM_CAP_PENUM) ) {
@ -1054,7 +1054,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
} }
} }
return 1; return 1;
} }
@ -1174,7 +1174,7 @@ static int get_dB_range(snd_hctl_elem_t *ctl, struct selem_str *rec,
return snd_tlv_get_dB_range(rec->db_info, rec->min, rec->max, min, max); return snd_tlv_get_dB_range(rec->db_info, rec->min, rec->max, min, max);
} }
static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir, static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max) long *min, long *max)
{ {
@ -1215,9 +1215,9 @@ static int ask_vol_dB_ops(snd_mixer_elem_t *elem,
} }
static int get_dB_ops(snd_mixer_elem_t *elem, static int get_dB_ops(snd_mixer_elem_t *elem,
int dir, int dir,
snd_mixer_selem_channel_id_t channel, snd_mixer_selem_channel_id_t channel,
long *value) long *value)
{ {
selem_none_t *s = snd_mixer_elem_get_private(elem); selem_none_t *s = snd_mixer_elem_get_private(elem);
selem_ctl_t *c; selem_ctl_t *c;
@ -1264,7 +1264,7 @@ static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
} }
static int ask_dB_vol_ops(snd_mixer_elem_t *elem, int dir, static int ask_dB_vol_ops(snd_mixer_elem_t *elem, int dir,
long dbValue, long *value, int xdir) long dbValue, long *value, int xdir)
{ {
selem_none_t *s = snd_mixer_elem_get_private(elem); selem_none_t *s = snd_mixer_elem_get_private(elem);
selem_ctl_t *c; selem_ctl_t *c;
@ -1446,7 +1446,7 @@ static int simple_add1(snd_mixer_class_t *class, const char *name,
if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED)
type = CTL_GLOBAL_ENUM; type = CTL_GLOBAL_ENUM;
else if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN && else if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN &&
ctype != SND_CTL_ELEM_TYPE_INTEGER) ctype != SND_CTL_ELEM_TYPE_INTEGER)
return 0; return 0;
break; break;
case CTL_GLOBAL_ROUTE: case CTL_GLOBAL_ROUTE:

View file

@ -35,7 +35,7 @@
#include <limits.h> #include <limits.h>
#include <sys/stat.h> #include <sys/stat.h>
/** /**
* \brief This function is unimplemented. * \brief This function is unimplemented.
* \deprecated Since 1.0.14 * \deprecated Since 1.0.14
*/ */

View file

@ -100,7 +100,7 @@ int snd_output_puts(snd_output_t *output, const char *str)
{ {
return output->ops->puts(output, str); return output->ops->puts(output, str);
} }
/** /**
* \brief Writes a character to an output handle (like \c putc(3)). * \brief Writes a character to an output handle (like \c putc(3)).
* \param output The output handle. * \param output The output handle.
@ -152,7 +152,7 @@ static int snd_output_stdio_puts(snd_output_t *output, const char *str)
snd_output_stdio_t *stdio = output->private_data; snd_output_stdio_t *stdio = output->private_data;
return fputs(str, stdio->fp); return fputs(str, stdio->fp);
} }
static int snd_output_stdio_putc(snd_output_t *output, int c) static int snd_output_stdio_putc(snd_output_t *output, int c)
{ {
snd_output_stdio_t *stdio = output->private_data; snd_output_stdio_t *stdio = output->private_data;
@ -206,7 +206,7 @@ int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int _close)
*outputp = output; *outputp = output;
return 0; return 0;
} }
/** /**
* \brief Creates a new output object writing to a file. * \brief Creates a new output object writing to a file.
* \param outputp The function puts the pointer to the new output object * \param outputp The function puts the pointer to the new output object
@ -307,7 +307,7 @@ static int snd_output_buffer_puts(snd_output_t *output, const char *str)
buffer->size += size; buffer->size += size;
return size; return size;
} }
static int snd_output_buffer_putc(snd_output_t *output, int c) static int snd_output_buffer_putc(snd_output_t *output, int c)
{ {
snd_output_buffer_t *buffer = output->private_data; snd_output_buffer_t *buffer = output->private_data;

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#define SND_INTERVAL_C #define SND_INTERVAL_C
#define SND_INTERVAL_INLINE #define SND_INTERVAL_INLINE
@ -32,7 +32,7 @@ static inline void div64_32(uint64_t *n, uint32_t d, uint32_t *rem)
*n /= d; *n /= d;
} }
static inline unsigned int div32(unsigned int a, unsigned int b, static inline unsigned int div32(unsigned int a, unsigned int b,
unsigned int *r) unsigned int *r)
{ {
if (b == 0) { if (b == 0) {
@ -378,7 +378,7 @@ void snd_interval_print(const snd_interval_t *i, snd_output_t *out)
{ {
if (snd_interval_empty(i)) if (snd_interval_empty(i))
snd_output_printf(out, "NONE"); snd_output_printf(out, "NONE");
else if (i->min == 0 && i->openmin == 0 && else if (i->min == 0 && i->openmin == 0 &&
i->max == UINT_MAX && i->openmax == 0) i->max == UINT_MAX && i->openmax == 0)
snd_output_printf(out, "ALL"); snd_output_printf(out, "ALL");
else if (snd_interval_single(i) && i->integer) else if (snd_interval_single(i) && i->integer)

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
typedef struct _snd_interval snd_interval_t; typedef struct _snd_interval snd_interval_t;
#ifdef SND_INTERVAL_INLINE #ifdef SND_INTERVAL_INLINE
@ -62,9 +62,9 @@ void snd_interval_add(const snd_interval_t *a, const snd_interval_t *b, snd_inte
void snd_interval_sub(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); void snd_interval_sub(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
void snd_interval_muldiv(const snd_interval_t *a, const snd_interval_t *b, void snd_interval_muldiv(const snd_interval_t *a, const snd_interval_t *b,
const snd_interval_t *c, snd_interval_t *d); const snd_interval_t *c, snd_interval_t *d);
void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b,
unsigned int k, snd_interval_t *c); unsigned int k, snd_interval_t *c);
void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k,
const snd_interval_t *b, snd_interval_t *c); const snd_interval_t *b, snd_interval_t *c);

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#define INTERVAL_INLINE static inline #define INTERVAL_INLINE static inline
INTERVAL_INLINE void snd_interval_any(snd_interval_t *i) INTERVAL_INLINE void snd_interval_any(snd_interval_t *i)
@ -50,7 +50,7 @@ INTERVAL_INLINE int snd_interval_empty(const snd_interval_t *i)
INTERVAL_INLINE int snd_interval_single(const snd_interval_t *i) INTERVAL_INLINE int snd_interval_single(const snd_interval_t *i)
{ {
assert(!snd_interval_empty(i)); assert(!snd_interval_empty(i));
return (i->min == i->max || return (i->min == i->max ||
(i->min + 1 == i->max && (i->openmin || i->openmax))); (i->min + 1 == i->max && (i->openmin || i->openmax)));
} }
@ -146,8 +146,8 @@ INTERVAL_INLINE int snd_interval_always_eq(const snd_interval_t *i1, const snd_i
INTERVAL_INLINE int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2) INTERVAL_INLINE int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2)
{ {
return (i1->max < i2->min || return (i1->max < i2->min ||
(i1->max == i2->min && (i1->max == i2->min &&
(i1->openmax || i1->openmin)) || (i1->openmax || i1->openmin)) ||
i1->min > i2->max || i1->min > i2->max ||

View file

@ -3,17 +3,17 @@
Linux Audio Developer's Simple Plugin API Version 1.1[LGPL]. Linux Audio Developer's Simple Plugin API Version 1.1[LGPL].
Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis, Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis,
Stefan Westerfeld. Stefan Westerfeld.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version. the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -32,7 +32,7 @@ extern "C" {
/*****************************************************************************/ /*****************************************************************************/
/* Overview: /* Overview:
There is a large number of synthesis packages in use or development There is a large number of synthesis packages in use or development
on the Linux platform at this time. This API (`The Linux Audio on the Linux platform at this time. This API (`The Linux Audio
@ -76,7 +76,7 @@ extern "C" {
/* Fundamental data type passed in and out of plugin. This data type /* Fundamental data type passed in and out of plugin. This data type
is used to communicate audio samples and control values. It is is used to communicate audio samples and control values. It is
assumed that the plugin will work sensibly given any numeric input assumed that the plugin will work sensibly given any numeric input
value although it may have a preferred range (see hints below). value although it may have a preferred range (see hints below).
For audio it is generally assumed that 1.0f is the `0dB' reference For audio it is generally assumed that 1.0f is the `0dB' reference
amplitude and is a `normal' signal level. */ amplitude and is a `normal' signal level. */
@ -85,8 +85,8 @@ typedef float LADSPA_Data;
/*****************************************************************************/ /*****************************************************************************/
/* Special Plugin Properties: /* Special Plugin Properties:
Optional features of the plugin type are encapsulated in the Optional features of the plugin type are encapsulated in the
LADSPA_Properties type. This is assembled by ORing individual LADSPA_Properties type. This is assembled by ORing individual
properties together. */ properties together. */
@ -122,7 +122,7 @@ typedef int LADSPA_Properties;
(3) The plugin will not access files, devices, pipes, sockets, IPC (3) The plugin will not access files, devices, pipes, sockets, IPC
or any other mechanism that might result in process or thread or any other mechanism that might result in process or thread
blocking. blocking.
(4) The plugin will take an amount of time to execute a run() or (4) The plugin will take an amount of time to execute a run() or
run_adding() call approximately of form (A+B*SampleCount) where A run_adding() call approximately of form (A+B*SampleCount) where A
and B depend on the machine and host in use. This amount of time and B depend on the machine and host in use. This amount of time
@ -137,7 +137,7 @@ typedef int LADSPA_Properties;
/*****************************************************************************/ /*****************************************************************************/
/* Plugin Ports: /* Plugin Ports:
Plugins have `ports' that are inputs or outputs for audio or Plugins have `ports' that are inputs or outputs for audio or
data. Ports can communicate arrays of LADSPA_Data (for audio data. Ports can communicate arrays of LADSPA_Data (for audio
@ -172,23 +172,23 @@ typedef int LADSPA_PortDescriptor;
/*****************************************************************************/ /*****************************************************************************/
/* Plugin Port Range Hints: /* Plugin Port Range Hints:
The host may wish to provide a representation of data entering or The host may wish to provide a representation of data entering or
leaving a plugin (e.g. to generate a GUI automatically). To make leaving a plugin (e.g. to generate a GUI automatically). To make
this more meaningful, the plugin should provide `hints' to the host this more meaningful, the plugin should provide `hints' to the host
describing the usual values taken by the data. describing the usual values taken by the data.
Note that these are only hints. The host may ignore them and the Note that these are only hints. The host may ignore them and the
plugin must not assume that data supplied to it is meaningful. If plugin must not assume that data supplied to it is meaningful. If
the plugin receives invalid input data it is expected to continue the plugin receives invalid input data it is expected to continue
to run without failure and, where possible, produce a sensible to run without failure and, where possible, produce a sensible
output (e.g. a high-pass filter given a negative cutoff frequency output (e.g. a high-pass filter given a negative cutoff frequency
might switch to an all-pass mode). might switch to an all-pass mode).
Hints are meaningful for all input and output ports but hints for Hints are meaningful for all input and output ports but hints for
input control ports are expected to be particularly useful. input control ports are expected to be particularly useful.
More hint information is encapsulated in the More hint information is encapsulated in the
LADSPA_PortRangeHintDescriptor type which is assembled by ORing LADSPA_PortRangeHintDescriptor type which is assembled by ORing
individual hint types together. Hints may require further individual hint types together. Hints may require further
@ -316,23 +316,23 @@ typedef int LADSPA_PortRangeHintDescriptor;
#define LADSPA_IS_HINT_HAS_DEFAULT(x) ((x) & LADSPA_HINT_DEFAULT_MASK) #define LADSPA_IS_HINT_HAS_DEFAULT(x) ((x) & LADSPA_HINT_DEFAULT_MASK)
#define LADSPA_IS_HINT_DEFAULT_MINIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ #define LADSPA_IS_HINT_DEFAULT_MINIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_MINIMUM) == LADSPA_HINT_DEFAULT_MINIMUM)
#define LADSPA_IS_HINT_DEFAULT_LOW(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ #define LADSPA_IS_HINT_DEFAULT_LOW(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_LOW) == LADSPA_HINT_DEFAULT_LOW)
#define LADSPA_IS_HINT_DEFAULT_MIDDLE(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ #define LADSPA_IS_HINT_DEFAULT_MIDDLE(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_MIDDLE) == LADSPA_HINT_DEFAULT_MIDDLE)
#define LADSPA_IS_HINT_DEFAULT_HIGH(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ #define LADSPA_IS_HINT_DEFAULT_HIGH(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_HIGH) == LADSPA_HINT_DEFAULT_HIGH)
#define LADSPA_IS_HINT_DEFAULT_MAXIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ #define LADSPA_IS_HINT_DEFAULT_MAXIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_MAXIMUM) == LADSPA_HINT_DEFAULT_MAXIMUM)
#define LADSPA_IS_HINT_DEFAULT_0(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ #define LADSPA_IS_HINT_DEFAULT_0(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_0) == LADSPA_HINT_DEFAULT_0)
#define LADSPA_IS_HINT_DEFAULT_1(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ #define LADSPA_IS_HINT_DEFAULT_1(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_1) == LADSPA_HINT_DEFAULT_1)
#define LADSPA_IS_HINT_DEFAULT_100(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ #define LADSPA_IS_HINT_DEFAULT_100(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_100) == LADSPA_HINT_DEFAULT_100)
#define LADSPA_IS_HINT_DEFAULT_440(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ #define LADSPA_IS_HINT_DEFAULT_440(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_440) == LADSPA_HINT_DEFAULT_440)
typedef struct _LADSPA_PortRangeHint { typedef struct _LADSPA_PortRangeHint {
@ -353,7 +353,7 @@ typedef struct _LADSPA_PortRangeHint {
/*****************************************************************************/ /*****************************************************************************/
/* Plugin Handles: /* Plugin Handles:
This plugin handle indicates a particular instance of the plugin This plugin handle indicates a particular instance of the plugin
concerned. It is valid to compare this to NULL (0 for C++) but concerned. It is valid to compare this to NULL (0 for C++) but
@ -364,13 +364,13 @@ typedef void * LADSPA_Handle;
/*****************************************************************************/ /*****************************************************************************/
/* Descriptor for a Type of Plugin: /* Descriptor for a Type of Plugin:
This structure is used to describe a plugin type. It provides a This structure is used to describe a plugin type. It provides a
number of functions to examine the type, instantiate it, link it to number of functions to examine the type, instantiate it, link it to
buffers and workspaces and to run it. */ buffers and workspaces and to run it. */
typedef struct _LADSPA_Descriptor { typedef struct _LADSPA_Descriptor {
/* This numeric identifier indicates the plugin type /* This numeric identifier indicates the plugin type
uniquely. Plugin programmers may reserve ranges of IDs from a uniquely. Plugin programmers may reserve ranges of IDs from a
@ -430,12 +430,12 @@ typedef struct _LADSPA_Descriptor {
instantiation function accepts a sample rate as a parameter. The instantiation function accepts a sample rate as a parameter. The
plugin descriptor from which this instantiate function was found plugin descriptor from which this instantiate function was found
must also be passed. This function must return NULL if must also be passed. This function must return NULL if
instantiation fails. instantiation fails.
Note that instance initialisation should generally occur in Note that instance initialisation should generally occur in
activate() rather than here. */ activate() rather than here. */
LADSPA_Handle (*instantiate)(const struct _LADSPA_Descriptor * Descriptor, LADSPA_Handle (*instantiate)(const struct _LADSPA_Descriptor * Descriptor,
unsigned long SampleRate); unsigned long SampleRate);
/* This member is a function pointer that connects a port on an /* This member is a function pointer that connects a port on an
instantiated plugin to a memory location at which a block of data instantiated plugin to a memory location at which a block of data
@ -464,8 +464,8 @@ typedef struct _LADSPA_Descriptor {
However, overlapped buffers or use of a single buffer for both However, overlapped buffers or use of a single buffer for both
audio and control data may result in unexpected behaviour. */ audio and control data may result in unexpected behaviour. */
void (*connect_port)(LADSPA_Handle Instance, void (*connect_port)(LADSPA_Handle Instance,
unsigned long Port, unsigned long Port,
LADSPA_Data * DataLocation); LADSPA_Data * DataLocation);
/* This member is a function pointer that initialises a plugin /* This member is a function pointer that initialises a plugin
instance and activates it for use. This is separated from instance and activates it for use. This is separated from
@ -503,7 +503,7 @@ typedef struct _LADSPA_Descriptor {
then there are various things that the plugin should not do then there are various things that the plugin should not do
within the run() or run_adding() functions (see above). */ within the run() or run_adding() functions (see above). */
void (*run)(LADSPA_Handle Instance, void (*run)(LADSPA_Handle Instance,
unsigned long SampleCount); unsigned long SampleCount);
/* This method is a function pointer that runs an instance of a /* This method is a function pointer that runs an instance of a
plugin for a block. This has identical behaviour to run() except plugin for a block. This has identical behaviour to run() except
@ -519,7 +519,7 @@ typedef struct _LADSPA_Descriptor {
this function pointer must be set to NULL. When it is provided, this function pointer must be set to NULL. When it is provided,
the function set_run_adding_gain() must be provided also. */ the function set_run_adding_gain() must be provided also. */
void (*run_adding)(LADSPA_Handle Instance, void (*run_adding)(LADSPA_Handle Instance,
unsigned long SampleCount); unsigned long SampleCount);
/* This method is a function pointer that sets the output gain for /* This method is a function pointer that sets the output gain for
use when run_adding() is called (see above). If this function is use when run_adding() is called (see above). If this function is
@ -531,7 +531,7 @@ typedef struct _LADSPA_Descriptor {
run_adding() function is provided. When it is absent this run_adding() function is provided. When it is absent this
function pointer must be set to NULL. */ function pointer must be set to NULL. */
void (*set_run_adding_gain)(LADSPA_Handle Instance, void (*set_run_adding_gain)(LADSPA_Handle Instance,
LADSPA_Data Gain); LADSPA_Data Gain);
/* This is the counterpart to activate() (see above). If there is /* This is the counterpart to activate() (see above). If there is
nothing for deactivate() to do then the plugin writer may provide nothing for deactivate() to do then the plugin writer may provide
@ -551,7 +551,7 @@ typedef struct _LADSPA_Descriptor {
/* Once an instance of a plugin has been finished with it can be /* Once an instance of a plugin has been finished with it can be
deleted using the following function. The instance handle passed deleted using the following function. The instance handle passed
ceases to be valid after this call. ceases to be valid after this call.
If activate() was called for a plugin instance then a If activate() was called for a plugin instance then a
corresponding call to deactivate() must be made before cleanup() corresponding call to deactivate() must be made before cleanup()
is called. */ is called. */
@ -589,7 +589,7 @@ typedef struct _LADSPA_Descriptor {
const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index); const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index);
/* Datatype corresponding to the ladspa_descriptor() function. */ /* Datatype corresponding to the ladspa_descriptor() function. */
typedef const LADSPA_Descriptor * typedef const LADSPA_Descriptor *
(*LADSPA_Descriptor_Function)(unsigned long Index); (*LADSPA_Descriptor_Function)(unsigned long Index);
/**********************************************************************/ /**********************************************************************/

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#define SND_MASK_C #define SND_MASK_C
#define SND_MASK_INLINE #define SND_MASK_INLINE

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
typedef struct _snd_mask snd_mask_t; typedef struct _snd_mask snd_mask_t;
#define SND_MASK_MAX 64 #define SND_MASK_MAX 64

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include <strings.h> #include <strings.h>
#include <sys/types.h> #include <sys/types.h>
@ -32,36 +32,36 @@
MASK_INLINE unsigned int ld2(uint32_t v) MASK_INLINE unsigned int ld2(uint32_t v)
{ {
unsigned r = 0; unsigned r = 0;
if (v >= 0x10000) { if (v >= 0x10000) {
v >>= 16; v >>= 16;
r += 16; r += 16;
} }
if (v >= 0x100) { if (v >= 0x100) {
v >>= 8; v >>= 8;
r += 8; r += 8;
} }
if (v >= 0x10) { if (v >= 0x10) {
v >>= 4; v >>= 4;
r += 4; r += 4;
} }
if (v >= 4) { if (v >= 4) {
v >>= 2; v >>= 2;
r += 2; r += 2;
} }
if (v >= 2) if (v >= 2)
r++; r++;
return r; return r;
} }
MASK_INLINE unsigned int hweight32(uint32_t v) MASK_INLINE unsigned int hweight32(uint32_t v)
{ {
v = (v & 0x55555555) + ((v >> 1) & 0x55555555); v = (v & 0x55555555) + ((v >> 1) & 0x55555555);
v = (v & 0x33333333) + ((v >> 2) & 0x33333333); v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F); v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F);
v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF); v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF);
return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF); return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF);
} }
MASK_INLINE size_t snd_mask_sizeof(void) MASK_INLINE size_t snd_mask_sizeof(void)

View file

@ -153,7 +153,7 @@ using #snd_pcm_state() call. There are these states:
\par SND_PCM_STATE_OPEN \par SND_PCM_STATE_OPEN
The PCM device is in the open state. After the #snd_pcm_open() open call, The PCM device is in the open state. After the #snd_pcm_open() open call,
the device is in this state. Also, when #snd_pcm_hw_params() call fails, the device is in this state. Also, when #snd_pcm_hw_params() call fails,
then this state is entered to force application calling then this state is entered to force application calling
#snd_pcm_hw_params() function to set right communication #snd_pcm_hw_params() function to set right communication
parameters. parameters.
@ -799,7 +799,7 @@ int snd_pcm_close(snd_pcm_t *pcm)
if (err < 0) if (err < 0)
res = err; res = err;
return res; return res;
} }
/** /**
* \brief set nonblock mode * \brief set nonblock mode
@ -925,7 +925,7 @@ int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
params->rate_den = pcm->rate_den; params->rate_den = pcm->rate_den;
params->fifo_size = pcm->fifo_size; params->fifo_size = pcm->fifo_size;
return 0; return 0;
} }
/** \brief Install one PCM hardware configuration chosen from a configuration space and #snd_pcm_prepare it /** \brief Install one PCM hardware configuration chosen from a configuration space and #snd_pcm_prepare it
* \param pcm PCM handle * \param pcm PCM handle
@ -933,7 +933,7 @@ int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
* \return 0 on success otherwise a negative error code * \return 0 on success otherwise a negative error code
* *
* The configuration is chosen fixing single parameters in this order: * The configuration is chosen fixing single parameters in this order:
* first access, first format, first subformat, min channels, min rate, * first access, first format, first subformat, min channels, min rate,
* min period time, max buffer size, min tick time. If no mutually * min period time, max buffer size, min tick time. If no mutually
* compatible set of parameters can be chosen, a negative error code * compatible set of parameters can be chosen, a negative error code
* will be returned. * will be returned.
@ -1565,7 +1565,7 @@ use_default_symbol_version(__snd_pcm_forward, snd_pcm_forward, ALSA_0.9.0rc8);
* If the non-blocking behaviour is selected, then routine doesn't wait at all. * If the non-blocking behaviour is selected, then routine doesn't wait at all.
* *
* The function is thread-safe when built with the proper option. * The function is thread-safe when built with the proper option.
*/ */
snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size) snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
{ {
int err; int err;
@ -1604,7 +1604,7 @@ snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_ufr
* If the non-blocking behaviour is selected, then routine doesn't wait at all. * If the non-blocking behaviour is selected, then routine doesn't wait at all.
* *
* The function is thread-safe when built with the proper option. * The function is thread-safe when built with the proper option.
*/ */
snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size) snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
{ {
int err; int err;
@ -1643,7 +1643,7 @@ snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t
* If the non-blocking behaviour is selected, then routine doesn't wait at all. * If the non-blocking behaviour is selected, then routine doesn't wait at all.
* *
* The function is thread-safe when built with the proper option. * The function is thread-safe when built with the proper option.
*/ */
snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size) snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
{ {
int err; int err;
@ -1682,7 +1682,7 @@ snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t
* If the non-blocking behaviour is selected, then routine doesn't wait at all. * If the non-blocking behaviour is selected, then routine doesn't wait at all.
* *
* The function is thread-safe when built with the proper option. * The function is thread-safe when built with the proper option.
*/ */
snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size) snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
{ {
int err; int err;
@ -1710,7 +1710,7 @@ snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t s
* \return 0 on success otherwise a negative error code * \return 0 on success otherwise a negative error code
* *
* The two PCMs will start/stop/prepare in sync. * The two PCMs will start/stop/prepare in sync.
*/ */
int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2) int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
{ {
int err = 0; int err = 0;
@ -1899,10 +1899,10 @@ static int __snd_pcm_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds,
#define HW_PARAM(v) [SND_PCM_HW_PARAM_##v] = #v #define HW_PARAM(v) [SND_PCM_HW_PARAM_##v] = #v
#define SW_PARAM(v) [SND_PCM_SW_PARAM_##v] = #v #define SW_PARAM(v) [SND_PCM_SW_PARAM_##v] = #v
#define FORMAT(v) [SND_PCM_FORMAT_##v] = #v #define FORMAT(v) [SND_PCM_FORMAT_##v] = #v
#define SUBFORMAT(v) [SND_PCM_SUBFORMAT_##v] = #v #define SUBFORMAT(v) [SND_PCM_SUBFORMAT_##v] = #v
#define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d #define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d
#define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d #define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d
static const char *const snd_pcm_stream_names[] = { static const char *const snd_pcm_stream_names[] = {
@ -1923,7 +1923,7 @@ static const char *const snd_pcm_state_names[] = {
}; };
static const char *const snd_pcm_access_names[] = { static const char *const snd_pcm_access_names[] = {
ACCESS(MMAP_INTERLEAVED), ACCESS(MMAP_INTERLEAVED),
ACCESS(MMAP_NONINTERLEAVED), ACCESS(MMAP_NONINTERLEAVED),
ACCESS(MMAP_COMPLEX), ACCESS(MMAP_COMPLEX),
ACCESS(RW_INTERLEAVED), ACCESS(RW_INTERLEAVED),
@ -1999,7 +1999,7 @@ static const char *const snd_pcm_format_aliases[SND_PCM_FORMAT_LAST+1] = {
}; };
static const char *const snd_pcm_format_descriptions[] = { static const char *const snd_pcm_format_descriptions[] = {
FORMATD(S8, "Signed 8 bit"), FORMATD(S8, "Signed 8 bit"),
FORMATD(U8, "Unsigned 8 bit"), FORMATD(U8, "Unsigned 8 bit"),
FORMATD(S16_LE, "Signed 16 bit Little Endian"), FORMATD(S16_LE, "Signed 16 bit Little Endian"),
FORMATD(S16_BE, "Signed 16 bit Big Endian"), FORMATD(S16_BE, "Signed 16 bit Big Endian"),
@ -2053,29 +2053,29 @@ static const char *const snd_pcm_format_descriptions[] = {
}; };
static const char *const snd_pcm_type_names[] = { static const char *const snd_pcm_type_names[] = {
PCMTYPE(HW), PCMTYPE(HW),
PCMTYPE(HOOKS), PCMTYPE(HOOKS),
PCMTYPE(MULTI), PCMTYPE(MULTI),
PCMTYPE(FILE), PCMTYPE(FILE),
PCMTYPE(NULL), PCMTYPE(NULL),
PCMTYPE(SHM), PCMTYPE(SHM),
PCMTYPE(INET), PCMTYPE(INET),
PCMTYPE(COPY), PCMTYPE(COPY),
PCMTYPE(LINEAR), PCMTYPE(LINEAR),
PCMTYPE(ALAW), PCMTYPE(ALAW),
PCMTYPE(MULAW), PCMTYPE(MULAW),
PCMTYPE(ADPCM), PCMTYPE(ADPCM),
PCMTYPE(RATE), PCMTYPE(RATE),
PCMTYPE(ROUTE), PCMTYPE(ROUTE),
PCMTYPE(PLUG), PCMTYPE(PLUG),
PCMTYPE(SHARE), PCMTYPE(SHARE),
PCMTYPE(METER), PCMTYPE(METER),
PCMTYPE(MIX), PCMTYPE(MIX),
PCMTYPE(DROUTE), PCMTYPE(DROUTE),
PCMTYPE(LBSERVER), PCMTYPE(LBSERVER),
PCMTYPE(LINEAR_FLOAT), PCMTYPE(LINEAR_FLOAT),
PCMTYPE(LADSPA), PCMTYPE(LADSPA),
PCMTYPE(DMIX), PCMTYPE(DMIX),
PCMTYPE(JACK), PCMTYPE(JACK),
PCMTYPE(DSNOOP), PCMTYPE(DSNOOP),
PCMTYPE(IEC958), PCMTYPE(IEC958),
@ -2086,14 +2086,14 @@ static const char *const snd_pcm_type_names[] = {
}; };
static const char *const snd_pcm_subformat_names[] = { static const char *const snd_pcm_subformat_names[] = {
SUBFORMAT(STD), SUBFORMAT(STD),
SUBFORMAT(MSBITS_MAX), SUBFORMAT(MSBITS_MAX),
SUBFORMAT(MSBITS_20), SUBFORMAT(MSBITS_20),
SUBFORMAT(MSBITS_24), SUBFORMAT(MSBITS_24),
}; };
static const char *const snd_pcm_subformat_descriptions[] = { static const char *const snd_pcm_subformat_descriptions[] = {
SUBFORMATD(STD, "Standard"), SUBFORMATD(STD, "Standard"),
SUBFORMATD(MSBITS_MAX, "Maximum based on PCM format"), SUBFORMATD(MSBITS_MAX, "Maximum based on PCM format"),
SUBFORMATD(MSBITS_20, "20 most significant bits"), SUBFORMATD(MSBITS_20, "20 most significant bits"),
SUBFORMATD(MSBITS_24, "24 most significant bits"), SUBFORMATD(MSBITS_24, "24 most significant bits"),
@ -2343,7 +2343,7 @@ int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out)
snd_check(PCM, "PCM not set up"); snd_check(PCM, "PCM not set up");
return -EIO; return -EIO;
} }
snd_output_printf(out, " stream : %s\n", snd_pcm_stream_name(pcm->stream)); snd_output_printf(out, " stream : %s\n", snd_pcm_stream_name(pcm->stream));
snd_output_printf(out, " access : %s\n", snd_pcm_access_name(pcm->access)); snd_output_printf(out, " access : %s\n", snd_pcm_access_name(pcm->access));
snd_output_printf(out, " format : %s\n", snd_pcm_format_name(pcm->format)); snd_output_printf(out, " format : %s\n", snd_pcm_format_name(pcm->format));
snd_output_printf(out, " subformat : %s\n", snd_pcm_subformat_name(pcm->subformat)); snd_output_printf(out, " subformat : %s\n", snd_pcm_subformat_name(pcm->subformat));
@ -2513,7 +2513,7 @@ ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples)
* *
* The asynchronous callback is called when period boundary elapses. * The asynchronous callback is called when period boundary elapses.
*/ */
int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
snd_async_callback_t callback, void *private_data) snd_async_callback_t callback, void *private_data)
{ {
int err; int err;
@ -2570,8 +2570,8 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
const char *id; const char *id;
const char *lib = NULL, *open_name = NULL; const char *lib = NULL, *open_name = NULL;
int (*open_func)(snd_pcm_t **, const char *, int (*open_func)(snd_pcm_t **, const char *,
snd_config_t *, snd_config_t *, snd_config_t *, snd_config_t *,
snd_pcm_stream_t, int) = NULL; snd_pcm_stream_t, int) = NULL;
#ifndef PIC #ifndef PIC
extern void *snd_pcm_open_symbols(void); extern void *snd_pcm_open_symbols(void);
@ -2741,7 +2741,7 @@ static int snd_pcm_open_noupdate(snd_pcm_t **pcmp, snd_config_t *root,
* \param mode Open mode (see #SND_PCM_NONBLOCK, #SND_PCM_ASYNC) * \param mode Open mode (see #SND_PCM_NONBLOCK, #SND_PCM_ASYNC)
* \return 0 on success otherwise a negative error code * \return 0 on success otherwise a negative error code
*/ */
int snd_pcm_open(snd_pcm_t **pcmp, const char *name, int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_t *top; snd_config_t *top;
@ -2771,7 +2771,7 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
* \param lconf Local configuration * \param lconf Local configuration
* \return 0 on success otherwise a negative error code * \return 0 on success otherwise a negative error code
*/ */
int snd_pcm_open_lconf(snd_pcm_t **pcmp, const char *name, int snd_pcm_open_lconf(snd_pcm_t **pcmp, const char *name,
snd_pcm_stream_t stream, int mode, snd_pcm_stream_t stream, int mode,
snd_config_t *lconf) snd_config_t *lconf)
{ {
@ -2894,7 +2894,7 @@ int snd_pcm_open_named_slave(snd_pcm_t **pcmp, const char *name,
* see also SND_PCM_WAIT_IO and SND_PCM_WAIT_DRAIN * see also SND_PCM_WAIT_IO and SND_PCM_WAIT_DRAIN
* \return a positive value on success otherwise a negative error code * \return a positive value on success otherwise a negative error code
* (-EPIPE for the xrun and -ESTRPIPE for the suspended status, * (-EPIPE for the xrun and -ESTRPIPE for the suspended status,
* others for general errors) * others for general errors)
* \retval 0 timeout occurred * \retval 0 timeout occurred
* \retval 1 PCM stream is ready for I/O * \retval 1 PCM stream is ready for I/O
* *
@ -2957,7 +2957,7 @@ static int __snd_pcm_wait_drain_timeout(snd_pcm_t *pcm)
return timeout; return timeout;
} }
/* /*
* like snd_pcm_wait() but doesn't check mmap_avail before calling poll() * like snd_pcm_wait() but doesn't check mmap_avail before calling poll()
* *
* used in drain code in some plugins * used in drain code in some plugins
@ -2969,7 +2969,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
struct pollfd *pfd; struct pollfd *pfd;
unsigned short revents = 0; unsigned short revents = 0;
int npfds, err, err_poll; int npfds, err, err_poll;
npfds = __snd_pcm_poll_descriptors_count(pcm); npfds = __snd_pcm_poll_descriptors_count(pcm);
if (npfds <= 0 || npfds >= 16) { if (npfds <= 0 || npfds >= 16) {
snd_error(PCM, "Invalid poll_fds %d", npfds); snd_error(PCM, "Invalid poll_fds %d", npfds);
@ -2995,9 +2995,9 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
__snd_pcm_lock(pcm->fast_op_arg); __snd_pcm_lock(pcm->fast_op_arg);
if (err_poll < 0) { if (err_poll < 0) {
if (errno == EINTR && !PCMINABORT(pcm) && !(pcm->mode & SND_PCM_EINTR)) if (errno == EINTR && !PCMINABORT(pcm) && !(pcm->mode & SND_PCM_EINTR))
continue; continue;
return -errno; return -errno;
} }
if (! err_poll) if (! err_poll)
break; break;
err = __snd_pcm_poll_revents(pcm, pfd, npfds, &revents); err = __snd_pcm_poll_revents(pcm, pfd, npfds, &revents);
@ -3164,13 +3164,13 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes
dst = snd_pcm_channel_area_addr(dst_area, dst_offset); dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
width = snd_pcm_format_physical_width(format); width = snd_pcm_format_physical_width(format);
silence = snd_pcm_format_silence_64(format); silence = snd_pcm_format_silence_64(format);
/* /*
* Iterate copying silent sample for sample data aligned to 64 bit. * Iterate copying silent sample for sample data aligned to 64 bit.
* This is a fast path. * This is a fast path.
*/ */
if (dst_area->step == (unsigned int) width && if (dst_area->step == (unsigned int) width &&
width != 24 && width != 24 &&
((intptr_t)dst & 7) == 0) { ((intptr_t)dst & 7) == 0) {
unsigned int dwords = samples * width / 64; unsigned int dwords = samples * width / 64;
uint64_t *dstp = (uint64_t *)dst; uint64_t *dstp = (uint64_t *)dst;
samples -= dwords * 64 / width; samples -= dwords * 64 / width;
@ -3487,7 +3487,7 @@ int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_
d.first = dst_start->first; d.first = dst_start->first;
d.step = width; d.step = width;
snd_pcm_area_copy(&d, dst_offset * chns, snd_pcm_area_copy(&d, dst_offset * chns,
&s, src_offset * chns, &s, src_offset * chns,
frames * chns, format); frames * chns, format);
} }
channels -= chns; channels -= chns;
@ -6354,10 +6354,10 @@ int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_u
return err; return err;
// compute frame bits // compute frame bits
fb = snd_pcm_format_physical_width((snd_pcm_format_t)format) * channels; fb = snd_pcm_format_physical_width((snd_pcm_format_t)format) * channels;
min_align = 1; min_align = 1;
while (fb % 8) { while (fb % 8) {
fb *= 2; fb *= 2;
min_align *= 2; min_align *= 2;
} }
if (val) if (val)
*val = min_align; *val = min_align;
@ -6793,7 +6793,7 @@ int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_
* \param val Start threshold in frames * \param val Start threshold in frames
* \return 0 otherwise a negative error code * \return 0 otherwise a negative error code
* *
* PCM is automatically started when playback frames available to PCM * PCM is automatically started when playback frames available to PCM
* are >= threshold or when requested capture frames are >= threshold * are >= threshold or when requested capture frames are >= threshold
*/ */
#ifndef DOXYGEN #ifndef DOXYGEN
@ -6813,7 +6813,7 @@ int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *p
* \param val Returned start threshold in frames * \param val Returned start threshold in frames
* \return 0 otherwise a negative error code * \return 0 otherwise a negative error code
* *
* PCM is automatically started when playback frames available to PCM * PCM is automatically started when playback frames available to PCM
* are >= threshold or when requested capture frames are >= threshold * are >= threshold or when requested capture frames are >= threshold
*/ */
#ifndef DOXYGEN #ifndef DOXYGEN
@ -6878,10 +6878,10 @@ int snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params, snd_
* \brief Set silence threshold inside a software configuration container * \brief Set silence threshold inside a software configuration container
* \param pcm PCM handle * \param pcm PCM handle
* \param params Software configuration container * \param params Software configuration container
* \param val Silence threshold in frames * \param val Silence threshold in frames
* \return 0 otherwise a negative error code * \return 0 otherwise a negative error code
* *
* A portion of playback buffer is overwritten with silence (see * A portion of playback buffer is overwritten with silence (see
* #snd_pcm_sw_params_set_silence_size) when playback underrun is nearer * #snd_pcm_sw_params_set_silence_size) when playback underrun is nearer
* than silence threshold. * than silence threshold.
*/ */
@ -6908,7 +6908,7 @@ int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t
* \param val Returned silence threshold in frames * \param val Returned silence threshold in frames
* \return 0 otherwise a negative error value * \return 0 otherwise a negative error value
* *
* A portion of playback buffer is overwritten with silence (see * A portion of playback buffer is overwritten with silence (see
* #snd_pcm_sw_params_set_silence_size) when playback underrun is nearer * #snd_pcm_sw_params_set_silence_size) when playback underrun is nearer
* than silence threshold. * than silence threshold.
*/ */
@ -6932,7 +6932,7 @@ int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, s
* \return 0 otherwise a negative error code * \return 0 otherwise a negative error code
* *
* A portion of playback buffer is overwritten with silence when playback * A portion of playback buffer is overwritten with silence when playback
* underrun is nearer than silence threshold (see * underrun is nearer than silence threshold (see
* #snd_pcm_sw_params_set_silence_threshold) * #snd_pcm_sw_params_set_silence_threshold)
* *
* When drain silence (see #snd_pcm_hw_params_get_drain_silence) is disabled, * When drain silence (see #snd_pcm_hw_params_get_drain_silence) is disabled,
@ -6968,7 +6968,7 @@ int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *para
* \return 0 otherwise a negative error code * \return 0 otherwise a negative error code
* *
* A portion of playback buffer is overwritten with silence when playback * A portion of playback buffer is overwritten with silence when playback
* underrun is nearer than silence threshold (see * underrun is nearer than silence threshold (see
* #snd_pcm_sw_params_set_silence_threshold) * #snd_pcm_sw_params_set_silence_threshold)
*/ */
#ifndef DOXYGEN #ifndef DOXYGEN
@ -7026,7 +7026,7 @@ void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src)
*dst = *src; *dst = *src;
} }
/** /**
* \brief Get state from a PCM status container (see #snd_pcm_state) * \brief Get state from a PCM status container (see #snd_pcm_state)
* \param obj #snd_pcm_status_t pointer * \param obj #snd_pcm_status_t pointer
* \return PCM state * \return PCM state
@ -7037,7 +7037,7 @@ snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj)
return obj->state; return obj->state;
} }
/** /**
* \brief Get trigger timestamp from a PCM status container * \brief Get trigger timestamp from a PCM status container
* \param obj #snd_pcm_status_t pointer * \param obj #snd_pcm_status_t pointer
* \param ptr Pointer to returned timestamp * \param ptr Pointer to returned timestamp
@ -7053,7 +7053,7 @@ void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestam
ptr->tv_usec = obj->trigger_tstamp.tv_nsec / 1000L; ptr->tv_usec = obj->trigger_tstamp.tv_nsec / 1000L;
} }
/** /**
* \brief Get trigger hi-res timestamp from a PCM status container * \brief Get trigger hi-res timestamp from a PCM status container
* \param obj #snd_pcm_status_t pointer * \param obj #snd_pcm_status_t pointer
* \param ptr Pointer to returned timestamp * \param ptr Pointer to returned timestamp
@ -7073,7 +7073,7 @@ void snd_pcm_status_get_trigger_htstamp(const snd_pcm_status_t *obj, snd_htimest
} }
use_default_symbol_version(__snd_pcm_status_get_trigger_htstamp, snd_pcm_status_get_trigger_htstamp, ALSA_0.9.0rc8); use_default_symbol_version(__snd_pcm_status_get_trigger_htstamp, snd_pcm_status_get_trigger_htstamp, ALSA_0.9.0rc8);
/** /**
* \brief Get "now" timestamp from a PCM status container * \brief Get "now" timestamp from a PCM status container
* \param obj #snd_pcm_status_t pointer * \param obj #snd_pcm_status_t pointer
* \param ptr Pointer to returned timestamp * \param ptr Pointer to returned timestamp
@ -7085,7 +7085,7 @@ void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr
ptr->tv_usec = obj->tstamp.tv_nsec / 1000L; ptr->tv_usec = obj->tstamp.tv_nsec / 1000L;
} }
/** /**
* \brief Get "now" hi-res timestamp from a PCM status container * \brief Get "now" hi-res timestamp from a PCM status container
* \param obj pointer to #snd_pcm_status_t * \param obj pointer to #snd_pcm_status_t
* \param ptr Pointer to returned timestamp * \param ptr Pointer to returned timestamp
@ -7101,7 +7101,7 @@ void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *p
} }
use_default_symbol_version(__snd_pcm_status_get_htstamp, snd_pcm_status_get_htstamp, ALSA_0.9.0rc8); use_default_symbol_version(__snd_pcm_status_get_htstamp, snd_pcm_status_get_htstamp, ALSA_0.9.0rc8);
/** /**
* \brief Get "now" hi-res audio timestamp from a PCM status container * \brief Get "now" hi-res audio timestamp from a PCM status container
* \param obj pointer to #snd_pcm_status_t * \param obj pointer to #snd_pcm_status_t
* \param ptr Pointer to returned timestamp * \param ptr Pointer to returned timestamp
@ -7166,7 +7166,7 @@ snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj)
return obj->delay; return obj->delay;
} }
/** /**
* \brief Get number of frames available from a PCM status container (see #snd_pcm_avail_update) * \brief Get number of frames available from a PCM status container (see #snd_pcm_avail_update)
* \return Number of frames ready to be read/written * \return Number of frames ready to be read/written
*/ */
@ -7176,7 +7176,7 @@ snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj)
return obj->avail; return obj->avail;
} }
/** /**
* \brief Get maximum number of frames available from a PCM status container after last #snd_pcm_status call * \brief Get maximum number of frames available from a PCM status container after last #snd_pcm_status call
* \return Maximum number of frames ready to be read/written * \return Maximum number of frames ready to be read/written
* *
@ -7188,7 +7188,7 @@ snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj)
return obj->avail_max; return obj->avail_max;
} }
/** /**
* \brief Get count of ADC overrange detections since last call * \brief Get count of ADC overrange detections since last call
* \return Count of ADC overrange detections * \return Count of ADC overrange detections
*/ */
@ -7413,7 +7413,7 @@ void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val)
/** /**
* \brief Application request to access a portion of direct (mmap) area * \brief Application request to access a portion of direct (mmap) area
* \param pcm PCM handle * \param pcm PCM handle
* \param areas Returned mmap channel areas * \param areas Returned mmap channel areas
* \param offset Returned mmap area offset in area steps (== frames) * \param offset Returned mmap area offset in area steps (== frames)
* \param frames mmap area portion size in frames (wanted on entry, contiguous available on exit) * \param frames mmap area portion size in frames (wanted on entry, contiguous available on exit)
@ -7516,7 +7516,7 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas,
if (avail < 0) if (avail < 0)
error(avail); error(avail);
// at this point, we can transfer at least 'avail' frames // at this point, we can transfer at least 'avail' frames
// we want to process frames in chunks (period_size) // we want to process frames in chunks (period_size)
if (avail < period_size) if (avail < period_size)
goto _skip; goto _skip;
@ -7533,7 +7533,7 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas,
commitres = snd_pcm_mmap_commit(pcm_handle, offset, frames); commitres = snd_pcm_mmap_commit(pcm_handle, offset, frames);
if (commitres < 0 || commitres != frames) if (commitres < 0 || commitres != frames)
error(commitres >= 0 ? -EPIPE : commitres); error(commitres >= 0 ? -EPIPE : commitres);
size -= frames; size -= frames;
} }
_skip: _skip:
@ -7591,7 +7591,7 @@ int _snd_pcm_poll_descriptor(snd_pcm_t *pcm)
return pcm->poll_fd; return pcm->poll_fd;
} }
void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas,
void *buf) void *buf)
{ {
unsigned int channel; unsigned int channel;
@ -7607,7 +7607,7 @@ void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas,
snd_pcm_unlock(pcm); snd_pcm_unlock(pcm);
} }
void snd_pcm_areas_from_bufs(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, void snd_pcm_areas_from_bufs(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas,
void **bufs) void **bufs)
{ {
unsigned int channel; unsigned int channel;
@ -7677,7 +7677,7 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_
if (err < 0) if (err < 0)
break; break;
goto _again; goto _again;
} }
frames = size; frames = size;
if (frames > (snd_pcm_uframes_t) avail) if (frames > (snd_pcm_uframes_t) avail)
@ -7938,13 +7938,13 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
pcm_conf = NULL; pcm_conf = NULL;
err = 0; err = 0;
_err: _err:
if (pcm_conf) if (pcm_conf)
snd_config_delete(pcm_conf); snd_config_delete(pcm_conf);
if (to_free) if (to_free)
snd_config_delete(conf); snd_config_delete(conf);
return err; return err;
} }
static void snd_pcm_set_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *rbptr, static void snd_pcm_set_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *rbptr,
volatile snd_pcm_uframes_t *hw_ptr, int fd, off_t offset) volatile snd_pcm_uframes_t *hw_ptr, int fd, off_t offset)
{ {
@ -7975,7 +7975,7 @@ static void snd_pcm_link_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *pcm_rbptr,
{ {
snd_pcm_t **a; snd_pcm_t **a;
int idx; int idx;
a = slave_rbptr->link_dst; a = slave_rbptr->link_dst;
for (idx = 0; idx < slave_rbptr->link_dst_count; idx++) for (idx = 0; idx < slave_rbptr->link_dst_count; idx++)
if (a[idx] == NULL) { if (a[idx] == NULL) {
@ -8017,7 +8017,7 @@ static void snd_pcm_unlink_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *pcm_rbptr,
return; return;
__found: __found:
pcm_rbptr->master = NULL; pcm_rbptr->master = NULL;
pcm_rbptr->ptr = NULL; pcm_rbptr->ptr = NULL;
pcm_rbptr->fd = -1; pcm_rbptr->fd = -1;
pcm_rbptr->offset = 0UL; pcm_rbptr->offset = 0UL;
@ -8752,8 +8752,8 @@ _snd_pcm_parse_config_chmaps(snd_config_t *conf)
/* /*
* basic helpers * basic helpers
*/ */
/** /**
* \brief Recover the stream state from an error or suspend * \brief Recover the stream state from an error or suspend
* \param pcm PCM handle * \param pcm PCM handle
@ -8772,39 +8772,39 @@ _snd_pcm_parse_config_chmaps(snd_config_t *conf)
*/ */
int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent) int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
{ {
if (err > 0) if (err > 0)
err = -err; err = -err;
if (err == -EINTR) /* nothing to do, continue */ if (err == -EINTR) /* nothing to do, continue */
return 0; return 0;
if (err == -EPIPE) { if (err == -EPIPE) {
const char *s; const char *s;
if (snd_pcm_stream(pcm) == SND_PCM_STREAM_PLAYBACK) if (snd_pcm_stream(pcm) == SND_PCM_STREAM_PLAYBACK)
s = "underrun"; s = "underrun";
else else
s = "overrun"; s = "overrun";
if (!silent) if (!silent)
snd_error(PCM, "%s occurred", s); snd_error(PCM, "%s occurred", s);
err = snd_pcm_prepare(pcm); err = snd_pcm_prepare(pcm);
if (err < 0) { if (err < 0) {
snd_error(PCM, "cannot recovery from %s, prepare failed: %s", s, snd_strerror(err)); snd_error(PCM, "cannot recovery from %s, prepare failed: %s", s, snd_strerror(err));
return err; return err;
} }
return 0; return 0;
} }
if (err == -ESTRPIPE) { if (err == -ESTRPIPE) {
while ((err = snd_pcm_resume(pcm)) == -EAGAIN) while ((err = snd_pcm_resume(pcm)) == -EAGAIN)
/* wait until suspend flag is released */ /* wait until suspend flag is released */
poll(NULL, 0, 1000); poll(NULL, 0, 1000);
if (err < 0) { if (err < 0) {
err = snd_pcm_prepare(pcm); err = snd_pcm_prepare(pcm);
if (err < 0) { if (err < 0) {
snd_error(PCM, "cannot recovery from suspend, prepare failed: %s", snd_strerror(err)); snd_error(PCM, "cannot recovery from suspend, prepare failed: %s", snd_strerror(err));
return err; return err;
} }
} }
return 0; return 0;
} }
return err; return err;
} }
/** /**
@ -8819,12 +8819,12 @@ int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
* \return 0 on success otherwise a negative error code * \return 0 on success otherwise a negative error code
*/ */
int snd_pcm_set_params(snd_pcm_t *pcm, int snd_pcm_set_params(snd_pcm_t *pcm,
snd_pcm_format_t format, snd_pcm_format_t format,
snd_pcm_access_t access, snd_pcm_access_t access,
unsigned int channels, unsigned int channels,
unsigned int rate, unsigned int rate,
int soft_resample, int soft_resample,
unsigned int latency) unsigned int latency)
{ {
snd_pcm_hw_params_t params_saved, params = {0}; snd_pcm_hw_params_t params_saved, params = {0};
snd_pcm_sw_params_t swparams = {0}; snd_pcm_sw_params_t swparams = {0};
@ -8841,7 +8841,7 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
s); s);
return err; return err;
} }
/* set software resampling */ /* set software resampling */
err = snd_pcm_hw_params_set_rate_resample(pcm, &params, soft_resample); err = snd_pcm_hw_params_set_rate_resample(pcm, &params, soft_resample);
if (err < 0) { if (err < 0) {
@ -9028,8 +9028,8 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
* \return 0 on success otherwise a negative error code * \return 0 on success otherwise a negative error code
*/ */
int snd_pcm_get_params(snd_pcm_t *pcm, int snd_pcm_get_params(snd_pcm_t *pcm,
snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t *period_size) snd_pcm_uframes_t *period_size)
{ {
snd_pcm_hw_params_t params = {0}; snd_pcm_hw_params_t params = {0};
int err; int err;
@ -9037,7 +9037,7 @@ int snd_pcm_get_params(snd_pcm_t *pcm,
assert(pcm); assert(pcm);
err = snd_pcm_hw_params_current(pcm, &params); err = snd_pcm_hw_params_current(pcm, &params);
if (err < 0) if (err < 0)
return err; return err;
err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(&params, buffer_size); err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(&params, buffer_size);
if (err < 0) if (err < 0)
return err; return err;

View file

@ -32,7 +32,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/* /*
These routines convert 16 bit linear PCM samples to 4 bit ADPCM code These routines convert 16 bit linear PCM samples to 4 bit ADPCM code
and vice versa. The ADPCM code used is the Intel/DVI ADPCM code which and vice versa. The ADPCM code used is the Intel/DVI ADPCM code which
@ -376,7 +376,7 @@ static int snd_pcm_adpcm_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
return err; return err;
return 0; return 0;
} }
static int snd_pcm_adpcm_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, static int snd_pcm_adpcm_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams) snd_pcm_hw_params_t *sparams)
{ {
@ -477,7 +477,7 @@ snd_pcm_adpcm_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
adpcm->func(slave_areas, slave_offset, adpcm->func(slave_areas, slave_offset,
areas, offset, areas, offset,
pcm->channels, size, pcm->channels, size,
adpcm->getput_idx, adpcm->states); adpcm->getput_idx, adpcm->states);
*slave_sizep = size; *slave_sizep = size;
@ -496,7 +496,7 @@ snd_pcm_adpcm_read_areas(snd_pcm_t *pcm,
snd_pcm_adpcm_t *adpcm = pcm->private_data; snd_pcm_adpcm_t *adpcm = pcm->private_data;
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
adpcm->func(areas, offset, adpcm->func(areas, offset,
slave_areas, slave_offset, slave_areas, slave_offset,
pcm->channels, size, pcm->channels, size,
adpcm->getput_idx, adpcm->states); adpcm->getput_idx, adpcm->states);
@ -507,7 +507,7 @@ snd_pcm_adpcm_read_areas(snd_pcm_t *pcm,
static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, snd_output_t *out) static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, snd_output_t *out)
{ {
snd_pcm_adpcm_t *adpcm = pcm->private_data; snd_pcm_adpcm_t *adpcm = pcm->private_data;
snd_output_printf(out, "Ima-ADPCM conversion PCM (%s)\n", snd_output_printf(out, "Ima-ADPCM conversion PCM (%s)\n",
snd_pcm_format_name(adpcm->sformat)); snd_pcm_format_name(adpcm->sformat));
if (pcm->setup) { if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n"); snd_output_printf(out, "Its setup is:\n");
@ -596,15 +596,15 @@ format and rate must match for both of them.
\code \code
pcm.name { pcm.name {
type adpcm # Ima-ADPCM conversion PCM type adpcm # Ima-ADPCM conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
format STR # Slave format format STR # Slave format
} }
} }
\endcode \endcode
@ -631,7 +631,7 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
@ -663,7 +663,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
return err; return err;
if (snd_pcm_format_linear(sformat) != 1 && if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_IMA_ADPCM) { sformat != SND_PCM_FORMAT_IMA_ADPCM) {
snd_config_delete(sconf); snd_config_delete(sconf);
snd_error(PCM, "invalid slave format"); snd_error(PCM, "invalid slave format");
return -EINVAL; return -EINVAL;
} }

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "bswap.h" #include "bswap.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
@ -232,7 +232,7 @@ static int snd_pcm_alaw_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *
err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT, err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
&format_mask); &format_mask);
} else { } else {
err = _snd_pcm_hw_params_set_format(params, err = _snd_pcm_hw_params_set_format(params,
SND_PCM_FORMAT_A_LAW); SND_PCM_FORMAT_A_LAW);
} }
if (err < 0) if (err < 0)
@ -273,7 +273,7 @@ static int snd_pcm_alaw_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_p
return err; return err;
return 0; return 0;
} }
static int snd_pcm_alaw_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, static int snd_pcm_alaw_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams) snd_pcm_hw_params_t *sparams)
{ {
@ -317,7 +317,7 @@ static int snd_pcm_alaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format); err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
if (err < 0) if (err < 0)
return err; return err;
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) { if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
if (alaw->sformat == SND_PCM_FORMAT_A_LAW) { if (alaw->sformat == SND_PCM_FORMAT_A_LAW) {
alaw->getput_idx = snd_pcm_linear_get_index(format, SND_PCM_FORMAT_S16); alaw->getput_idx = snd_pcm_linear_get_index(format, SND_PCM_FORMAT_S16);
@ -351,7 +351,7 @@ snd_pcm_alaw_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
alaw->func(slave_areas, slave_offset, alaw->func(slave_areas, slave_offset,
areas, offset, areas, offset,
pcm->channels, size, pcm->channels, size,
alaw->getput_idx); alaw->getput_idx);
*slave_sizep = size; *slave_sizep = size;
@ -370,7 +370,7 @@ snd_pcm_alaw_read_areas(snd_pcm_t *pcm,
snd_pcm_alaw_t *alaw = pcm->private_data; snd_pcm_alaw_t *alaw = pcm->private_data;
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
alaw->func(areas, offset, alaw->func(areas, offset,
slave_areas, slave_offset, slave_areas, slave_offset,
pcm->channels, size, pcm->channels, size,
alaw->getput_idx); alaw->getput_idx);
@ -381,7 +381,7 @@ snd_pcm_alaw_read_areas(snd_pcm_t *pcm,
static void snd_pcm_alaw_dump(snd_pcm_t *pcm, snd_output_t *out) static void snd_pcm_alaw_dump(snd_pcm_t *pcm, snd_output_t *out)
{ {
snd_pcm_alaw_t *alaw = pcm->private_data; snd_pcm_alaw_t *alaw = pcm->private_data;
snd_output_printf(out, "A-Law conversion PCM (%s)\n", snd_output_printf(out, "A-Law conversion PCM (%s)\n",
snd_pcm_format_name(alaw->sformat)); snd_pcm_format_name(alaw->sformat));
if (pcm->setup) { if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n"); snd_output_printf(out, "Its setup is:\n");
@ -420,7 +420,7 @@ static const snd_pcm_ops_t snd_pcm_alaw_ops = {
* \warning Using of this function might be dangerous in the sense * \warning Using of this function might be dangerous in the sense
* of compatibility reasons. The prototype might be freely * of compatibility reasons. The prototype might be freely
* changed in future. * changed in future.
*/ */
int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave) int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
{ {
snd_pcm_t *pcm; snd_pcm_t *pcm;
@ -471,15 +471,15 @@ format and rate must match for both of them.
\code \code
pcm.name { pcm.name {
type alaw # A-Law conversion PCM type alaw # A-Law conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
format STR # Slave format format STR # Slave format
} }
} }
\endcode \endcode
@ -506,7 +506,7 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
@ -538,7 +538,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
return err; return err;
if (snd_pcm_format_linear(sformat) != 1 && if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_A_LAW) { sformat != SND_PCM_FORMAT_A_LAW) {
snd_config_delete(sconf); snd_config_delete(sconf);
snd_error(PCM, "invalid slave format"); snd_error(PCM, "invalid slave format");
return -EINVAL; return -EINVAL;
} }

View file

@ -22,21 +22,21 @@ Slave PCMs can be defined asymmetrically for both directions.
\code \code
pcm.name { pcm.name {
type asym # Asym PCM type asym # Asym PCM
playback STR # Playback slave name playback STR # Playback slave name
# or # or
playback { # Playback slave definition playback { # Playback slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
} }
capture STR # Capture slave name capture STR # Capture slave name
# or # or
capture { # Capture slave definition capture { # Capture slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
} }
} }
\endcode \endcode

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
#include "bswap.h" #include "bswap.h"
@ -73,7 +73,7 @@ static int snd_pcm_copy_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_p
return err; return err;
return 0; return 0;
} }
static int snd_pcm_copy_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, static int snd_pcm_copy_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams) snd_pcm_hw_params_t *sparams)
{ {
@ -133,7 +133,7 @@ snd_pcm_copy_read_areas(snd_pcm_t *pcm,
{ {
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
snd_pcm_areas_copy(areas, offset, snd_pcm_areas_copy(areas, offset,
slave_areas, slave_offset, slave_areas, slave_offset,
pcm->channels, size, pcm->format); pcm->channels, size, pcm->format);
*slave_sizep = size; *slave_sizep = size;
@ -222,7 +222,7 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int
\section pcm_plugins_copy Plugin: copy \section pcm_plugins_copy Plugin: copy
This plugin copies samples from master copy PCM to given slave PCM. This plugin copies samples from master copy PCM to given slave PCM.
The channel count, format and rate must match for both of them. The channel count, format and rate must match for both of them.
\code \code
pcm.name { pcm.name {
@ -260,7 +260,7 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -44,7 +44,7 @@
/* /*
* *
*/ */
#if !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__ANDROID__) #if !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__ANDROID__)
union semun { union semun {
int val; /* Value for SETVAL */ int val; /* Value for SETVAL */
@ -55,7 +55,7 @@ union semun {
#endif #endif
}; };
#endif #endif
/* /*
* FIXME: * FIXME:
* add possibility to use futexes here * add possibility to use futexes here
@ -96,14 +96,14 @@ static unsigned int snd_pcm_direct_magic(snd_pcm_direct_t *dmix)
} }
/* /*
* global shared memory area * global shared memory area
*/ */
int snd_pcm_direct_shm_create_or_connect(snd_pcm_direct_t *dmix) int snd_pcm_direct_shm_create_or_connect(snd_pcm_direct_t *dmix)
{ {
struct shmid_ds buf; struct shmid_ds buf;
int tmpid, err, first_instance = 0; int tmpid, err, first_instance = 0;
retryget: retryget:
dmix->shmid = shmget(dmix->ipc_key, sizeof(snd_pcm_direct_share_t), dmix->shmid = shmget(dmix->ipc_key, sizeof(snd_pcm_direct_share_t),
dmix->ipc_perm); dmix->ipc_perm);
@ -120,7 +120,7 @@ retryget:
if ((tmpid = shmget(dmix->ipc_key, 0, dmix->ipc_perm)) != -1) if ((tmpid = shmget(dmix->ipc_key, 0, dmix->ipc_perm)) != -1)
if (!shmctl(tmpid, IPC_STAT, &buf)) if (!shmctl(tmpid, IPC_STAT, &buf))
if (!buf.shm_nattch) if (!buf.shm_nattch)
/* no users so destroy the segment */ /* no users so destroy the segment */
if (!shmctl(tmpid, IPC_RMID, NULL)) if (!shmctl(tmpid, IPC_RMID, NULL))
goto retryget; goto retryget;
return err; return err;
@ -221,7 +221,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
memset(addr, 0, size); /* make valgrind happy */ memset(addr, 0, size); /* make valgrind happy */
addr->sun_family = AF_LOCAL; addr->sun_family = AF_LOCAL;
memcpy(addr->sun_path, filename, l); memcpy(addr->sun_path, filename, l);
if (server) { if (server) {
if (bind(sock, (struct sockaddr *) addr, size) < 0) { if (bind(sock, (struct sockaddr *) addr, size) < 0) {
int result = -errno; int result = -errno;
@ -309,7 +309,7 @@ static int _snd_send_fd(int sock, void *data, size_t len, int fd)
msghdr.msg_name = NULL; msghdr.msg_name = NULL;
msghdr.msg_namelen = 0; msghdr.msg_namelen = 0;
msghdr.msg_iov = &vec; msghdr.msg_iov = &vec;
msghdr.msg_iovlen = 1; msghdr.msg_iovlen = 1;
msghdr.msg_control = cmsg; msghdr.msg_control = cmsg;
msghdr.msg_controllen = cmsg_len; msghdr.msg_controllen = cmsg_len;
msghdr.msg_flags = 0; msghdr.msg_flags = 0;
@ -342,7 +342,7 @@ static void server_job(snd_pcm_direct_t *dmix)
if (i != dmix->server_fd && i != dmix->hw_fd) if (i != dmix->server_fd && i != dmix->hw_fd)
close(i); close(i);
} }
/* detach from parent */ /* detach from parent */
setsid(); setsid();
@ -431,7 +431,7 @@ int snd_pcm_direct_server_create(snd_pcm_direct_t *dmix)
ret = get_tmp_name(dmix->shmptr->socket_name, sizeof(dmix->shmptr->socket_name)); ret = get_tmp_name(dmix->shmptr->socket_name, sizeof(dmix->shmptr->socket_name));
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = make_local_socket(dmix->shmptr->socket_name, 1, dmix->ipc_perm, dmix->ipc_gid); ret = make_local_socket(dmix->shmptr->socket_name, 1, dmix->ipc_perm, dmix->ipc_gid);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -442,7 +442,7 @@ int snd_pcm_direct_server_create(snd_pcm_direct_t *dmix)
close(dmix->server_fd); close(dmix->server_fd);
return ret; return ret;
} }
ret = fork(); ret = fork();
if (ret < 0) { if (ret < 0) {
close(dmix->server_fd); close(dmix->server_fd);
@ -894,7 +894,7 @@ static int snd_interval_step(struct snd_interval *i, unsigned int min,
int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{ {
snd_pcm_direct_t *dshare = pcm->private_data; snd_pcm_direct_t *dshare = pcm->private_data;
static const snd_mask_t access = { .bits = { static const snd_mask_t access = { .bits = {
(1<<SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) | (1<<SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) |
(1<<SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED) | (1<<SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED) |
(1<<SNDRV_PCM_ACCESS_RW_INTERLEAVED) | (1<<SNDRV_PCM_ACCESS_RW_INTERLEAVED) |
@ -1057,14 +1057,14 @@ int snd_pcm_direct_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
int snd_pcm_direct_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info) int snd_pcm_direct_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
{ {
return snd_pcm_channel_info_shm(pcm, info, -1); return snd_pcm_channel_info_shm(pcm, info, -1);
} }
int snd_pcm_direct_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED) int snd_pcm_direct_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
{ {
return 0; return 0;
} }
int snd_pcm_direct_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED) int snd_pcm_direct_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
{ {
return 0; return 0;
@ -1202,10 +1202,10 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
int loops = 10; int loops = 10;
__again: __again:
if (loops-- <= 0) { if (loops-- <= 0) {
snd_error(PCM, "unable to find a valid configuration for slave"); snd_error(PCM, "unable to find a valid configuration for slave");
return -EINVAL; return -EINVAL;
} }
ret = snd_pcm_hw_params_any(spcm, &hw_params); ret = snd_pcm_hw_params_any(spcm, &hw_params);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "snd_pcm_hw_params_any failed"); snd_error(PCM, "snd_pcm_hw_params_any failed");
@ -1306,8 +1306,8 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
snd_error(PCM, "unable to set period_size"); snd_error(PCM, "unable to set period_size");
return ret; return ret;
} }
} }
if (buffer_is_not_initialized && params->periods > 0) { if (buffer_is_not_initialized && params->periods > 0) {
unsigned int periods = params->periods; unsigned int periods = params->periods;
ret = INTERNAL(snd_pcm_hw_params_set_periods_near)(spcm, ret = INTERNAL(snd_pcm_hw_params_set_periods_near)(spcm,
@ -1329,7 +1329,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
return ret; return ret;
} }
} }
ret = snd_pcm_hw_params(spcm, &hw_params); ret = snd_pcm_hw_params(spcm, &hw_params);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "unable to install hw params"); snd_error(PCM, "unable to install hw params");
@ -1420,7 +1420,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
snd_pcm_areas_silence(dst_areas, 0, spcm->channels, snd_pcm_areas_silence(dst_areas, 0, spcm->channels,
spcm->buffer_size, spcm->format); spcm->buffer_size, spcm->format);
} }
ret = snd_pcm_start(spcm); ret = snd_pcm_start(spcm);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "unable to start PCM stream"); snd_error(PCM, "unable to start PCM stream");
@ -1433,7 +1433,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
} }
snd_pcm_poll_descriptors(spcm, &fd, 1); snd_pcm_poll_descriptors(spcm, &fd, 1);
dmix->hw_fd = fd.fd; dmix->hw_fd = fd.fd;
save_slave_setting(dmix, spcm); save_slave_setting(dmix, spcm);
/* Currently, we assume that each dmix client has the same /* Currently, we assume that each dmix client has the same
@ -1601,7 +1601,7 @@ int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dm
snd_error(PCM, "unable to open hardware"); snd_error(PCM, "unable to open hardware");
return ret; return ret;
} }
spcm = *spcmp; spcm = *spcmp;
spcm->donot_close = 1; spcm->donot_close = 1;
spcm->setup = 1; spcm->setup = 1;

View file

@ -19,7 +19,7 @@
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "../timer/timer_local.h" #include "../timer/timer_local.h"
#define DIRECT_IPC_SEMS 1 #define DIRECT_IPC_SEMS 1
@ -103,8 +103,8 @@ typedef struct {
unsigned int period_step; unsigned int period_step;
unsigned int sleep_min; /* not used */ unsigned int sleep_min; /* not used */
unsigned int avail_min; unsigned int avail_min;
unsigned int start_threshold; unsigned int start_threshold;
unsigned int stop_threshold; unsigned int stop_threshold;
unsigned int silence_threshold; unsigned int silence_threshold;
unsigned int silence_size; unsigned int silence_size;
unsigned int recoveries; /* no of executed recoveries on slave*/ unsigned int recoveries; /* no of executed recoveries on slave*/

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -63,7 +63,7 @@ const char *_snd_module_pcm_dmix = "";
static int shm_sum_discard(snd_pcm_direct_t *dmix); static int shm_sum_discard(snd_pcm_direct_t *dmix);
/* /*
* sum ring buffer shared memory area * sum ring buffer shared memory area
*/ */
static int shm_sum_create_or_connect(snd_pcm_direct_t *dmix) static int shm_sum_create_or_connect(snd_pcm_direct_t *dmix)
{ {
@ -73,7 +73,7 @@ static int shm_sum_create_or_connect(snd_pcm_direct_t *dmix)
size = dmix->shmptr->s.channels * size = dmix->shmptr->s.channels *
dmix->shmptr->s.buffer_size * dmix->shmptr->s.buffer_size *
sizeof(signed int); sizeof(signed int);
retryshm: retryshm:
dmix->u.dmix.shmid_sum = shmget(dmix->ipc_key + 1, size, dmix->u.dmix.shmid_sum = shmget(dmix->ipc_key + 1, size,
IPC_CREAT | dmix->ipc_perm); IPC_CREAT | dmix->ipc_perm);
@ -82,7 +82,7 @@ retryshm:
if (errno == EINVAL) if (errno == EINVAL)
if ((tmpid = shmget(dmix->ipc_key + 1, 0, dmix->ipc_perm)) != -1) if ((tmpid = shmget(dmix->ipc_key + 1, 0, dmix->ipc_perm)) != -1)
if (!shmctl(tmpid, IPC_STAT, &buf)) if (!shmctl(tmpid, IPC_STAT, &buf))
if (!buf.shm_nattch) if (!buf.shm_nattch)
/* no users so destroy the segment */ /* no users so destroy the segment */
if (!shmctl(tmpid, IPC_RMID, NULL)) if (!shmctl(tmpid, IPC_RMID, NULL))
goto retryshm; goto retryshm;
@ -95,7 +95,7 @@ retryshm:
} }
if (dmix->ipc_gid >= 0) { if (dmix->ipc_gid >= 0) {
buf.shm_perm.gid = dmix->ipc_gid; buf.shm_perm.gid = dmix->ipc_gid;
shmctl(dmix->u.dmix.shmid_sum, IPC_SET, &buf); shmctl(dmix->u.dmix.shmid_sum, IPC_SET, &buf);
} }
dmix->u.dmix.sum_buffer = shmat(dmix->u.dmix.shmid_sum, 0, 0); dmix->u.dmix.sum_buffer = shmat(dmix->u.dmix.shmid_sum, 0, 0);
if (dmix->u.dmix.sum_buffer == (void *) -1) { if (dmix->u.dmix.sum_buffer == (void *) -1) {
@ -162,7 +162,7 @@ static void mix_areas(snd_pcm_direct_t *dmix,
unsigned int src_step, dst_step; unsigned int src_step, dst_step;
unsigned int chn, dchn, channels, sample_size; unsigned int chn, dchn, channels, sample_size;
mix_areas_t *do_mix_areas; mix_areas_t *do_mix_areas;
channels = dmix->channels; channels = dmix->channels;
switch (dmix->shmptr->s.format) { switch (dmix->shmptr->s.format) {
case SND_PCM_FORMAT_S16_LE: case SND_PCM_FORMAT_S16_LE:
@ -230,7 +230,7 @@ static void remix_areas(snd_pcm_direct_t *dmix,
unsigned int src_step, dst_step; unsigned int src_step, dst_step;
unsigned int chn, dchn, channels, sample_size; unsigned int chn, dchn, channels, sample_size;
mix_areas_t *do_remix_areas; mix_areas_t *do_remix_areas;
channels = dmix->channels; channels = dmix->channels;
switch (dmix->shmptr->s.format) { switch (dmix->shmptr->s.format) {
case SND_PCM_FORMAT_S16_LE: case SND_PCM_FORMAT_S16_LE:
@ -315,7 +315,7 @@ static void snd_pcm_dmix_sync_area(snd_pcm_t *pcm)
snd_pcm_uframes_t slave_hw_ptr, slave_appl_ptr, slave_size; snd_pcm_uframes_t slave_hw_ptr, slave_appl_ptr, slave_size;
snd_pcm_uframes_t appl_ptr, size, transfer; snd_pcm_uframes_t appl_ptr, size, transfer;
const snd_pcm_channel_area_t *src_areas, *dst_areas; const snd_pcm_channel_area_t *src_areas, *dst_areas;
/* calculate the size to transfer */ /* calculate the size to transfer */
/* check the available size in the local buffer /* check the available size in the local buffer
* last_appl_ptr keeps the last updated position * last_appl_ptr keeps the last updated position
@ -391,7 +391,7 @@ static int snd_pcm_dmix_sync_ptr0(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr
snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_direct_t *dmix = pcm->private_data;
snd_pcm_uframes_t old_slave_hw_ptr, avail; snd_pcm_uframes_t old_slave_hw_ptr, avail;
snd_pcm_sframes_t diff; snd_pcm_sframes_t diff;
old_slave_hw_ptr = dmix->slave_hw_ptr; old_slave_hw_ptr = dmix->slave_hw_ptr;
dmix->slave_hw_ptr = slave_hw_ptr; dmix->slave_hw_ptr = slave_hw_ptr;
diff = pcm_frame_diff(slave_hw_ptr, old_slave_hw_ptr, dmix->slave_boundary); diff = pcm_frame_diff(slave_hw_ptr, old_slave_hw_ptr, dmix->slave_boundary);
@ -483,7 +483,7 @@ static int snd_pcm_dmix_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
{ {
snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_direct_t *dmix = pcm->private_data;
int err; int err;
switch(dmix->state) { switch(dmix->state) {
case SNDRV_PCM_STATE_DRAINING: case SNDRV_PCM_STATE_DRAINING:
case SNDRV_PCM_STATE_RUNNING: case SNDRV_PCM_STATE_RUNNING:
@ -554,7 +554,7 @@ static int snd_pcm_dmix_start(snd_pcm_t *pcm)
snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_direct_t *dmix = pcm->private_data;
snd_pcm_sframes_t avail; snd_pcm_sframes_t avail;
int err; int err;
if (dmix->state != SND_PCM_STATE_PREPARED) if (dmix->state != SND_PCM_STATE_PREPARED)
return -EBADFD; return -EBADFD;
avail = snd_pcm_mmap_playback_hw_avail(pcm); avail = snd_pcm_mmap_playback_hw_avail(pcm);
@ -784,11 +784,11 @@ static int snd_pcm_dmix_close(snd_pcm_t *pcm)
snd_timer_close(dmix->timer); snd_timer_close(dmix->timer);
snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
snd_pcm_close(dmix->spcm); snd_pcm_close(dmix->spcm);
if (dmix->server) if (dmix->server)
snd_pcm_direct_server_discard(dmix); snd_pcm_direct_server_discard(dmix);
if (dmix->client) if (dmix->client)
snd_pcm_direct_client_discard(dmix); snd_pcm_direct_client_discard(dmix);
shm_sum_discard(dmix); shm_sum_discard(dmix);
if (snd_pcm_direct_shm_discard(dmix)) { if (snd_pcm_direct_shm_discard(dmix)) {
if (snd_pcm_direct_semaphore_discard(dmix)) if (snd_pcm_direct_semaphore_discard(dmix))
snd_pcm_direct_semaphore_final(dmix, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_final(dmix, DIRECT_IPC_SEM_CLIENT);
@ -837,7 +837,7 @@ static snd_pcm_sframes_t snd_pcm_dmix_avail_update(snd_pcm_t *pcm)
{ {
snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_direct_t *dmix = pcm->private_data;
int err; int err;
if (dmix->state == SND_PCM_STATE_RUNNING || if (dmix->state == SND_PCM_STATE_RUNNING ||
dmix->state == SND_PCM_STATE_DRAINING) { dmix->state == SND_PCM_STATE_DRAINING) {
if ((err = snd_pcm_dmix_sync_ptr(pcm)) < 0) if ((err = snd_pcm_dmix_sync_ptr(pcm)) < 0)
@ -856,7 +856,7 @@ static int snd_pcm_dmix_htimestamp(snd_pcm_t *pcm,
snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_direct_t *dmix = pcm->private_data;
snd_pcm_uframes_t avail1; snd_pcm_uframes_t avail1;
int ok = 0; int ok = 0;
while (1) { while (1) {
if (dmix->state == SND_PCM_STATE_RUNNING || if (dmix->state == SND_PCM_STATE_RUNNING ||
dmix->state == SND_PCM_STATE_DRAINING) dmix->state == SND_PCM_STATE_DRAINING)
@ -1000,13 +1000,13 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to open slave"); snd_error(PCM, "unable to open slave");
goto _err; goto _err;
} }
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) { if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
snd_error(PCM, "dmix plugin can be only connected to hw plugin"); snd_error(PCM, "dmix plugin can be only connected to hw plugin");
ret = -EINVAL; ret = -EINVAL;
goto _err; goto _err;
} }
ret = snd_pcm_direct_initialize_slave(dmix, spcm, params); ret = snd_pcm_direct_initialize_slave(dmix, spcm, params);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "unable to initialize slave"); snd_error(PCM, "unable to initialize slave");
@ -1017,7 +1017,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
if (dmix->shmptr->use_server) { if (dmix->shmptr->use_server) {
dmix->server_free = dmix_server_free; dmix->server_free = dmix_server_free;
ret = snd_pcm_direct_server_create(dmix); ret = snd_pcm_direct_server_create(dmix);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "unable to create server"); snd_error(PCM, "unable to create server");
@ -1035,7 +1035,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to connect client"); snd_error(PCM, "unable to connect client");
goto _err_nosem; goto _err_nosem;
} }
snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_open_secondary_client(&spcm, dmix, "dmix_client"); ret = snd_pcm_direct_open_secondary_client(&spcm, dmix, "dmix_client");
if (ret < 0) if (ret < 0)
@ -1062,7 +1062,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
ret = -EINVAL; ret = -EINVAL;
goto _err; goto _err;
} }
ret = snd_pcm_direct_initialize_secondary_slave(dmix, spcm, params); ret = snd_pcm_direct_initialize_secondary_slave(dmix, spcm, params);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "unable to initialize slave"); snd_error(PCM, "unable to initialize slave");
@ -1086,14 +1086,14 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
} }
mix_select_callbacks(dmix); mix_select_callbacks(dmix);
pcm->poll_fd = dmix->poll_fd; pcm->poll_fd = dmix->poll_fd;
pcm->poll_events = POLLIN; /* it's different than other plugins */ pcm->poll_events = POLLIN; /* it's different than other plugins */
pcm->tstamp_type = spcm->tstamp_type; pcm->tstamp_type = spcm->tstamp_type;
pcm->mmap_rw = 1; pcm->mmap_rw = 1;
snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0); snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0);
snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0);
if (dmix->channels == UINT_MAX) if (dmix->channels == UINT_MAX)
dmix->channels = dmix->shmptr->s.channels; dmix->channels = dmix->shmptr->s.channels;
@ -1101,7 +1101,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
*pcmp = pcm; *pcmp = pcm;
return 0; return 0;
_err: _err:
if (dmix->timer) if (dmix->timer)
snd_timer_close(dmix->timer); snd_timer_close(dmix->timer);
@ -1317,7 +1317,7 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
if (err < 0) if (err < 0)
return err; return err;
/* set a reasonable default */ /* set a reasonable default */
if (psize == -1 && params.period_time == -1) if (psize == -1 && params.period_time == -1)
params.period_time = 125000; /* 0.125 seconds */ params.period_time = 125000; /* 0.125 seconds */

View file

@ -289,12 +289,12 @@ static void generic_mix_areas_16_swap(unsigned int size,
} }
static void generic_remix_areas_16_swap(unsigned int size, static void generic_remix_areas_16_swap(unsigned int size,
volatile signed short *dst, volatile signed short *dst,
signed short *src, signed short *src,
volatile signed int *sum, volatile signed int *sum,
size_t dst_step, size_t dst_step,
size_t src_step, size_t src_step,
size_t sum_step) size_t sum_step)
{ {
register signed int sample; register signed int sample;
@ -354,12 +354,12 @@ static void generic_mix_areas_32_swap(unsigned int size,
} }
static void generic_remix_areas_32_swap(unsigned int size, static void generic_remix_areas_32_swap(unsigned int size,
volatile signed int *dst, volatile signed int *dst,
signed int *src, signed int *src,
volatile signed int *sum, volatile signed int *sum,
size_t dst_step, size_t dst_step,
size_t src_step, size_t src_step,
size_t sum_step) size_t sum_step)
{ {
register signed int sample; register signed int sample;

View file

@ -55,7 +55,7 @@
#undef LOCK_PREFIX #undef LOCK_PREFIX
#undef XADD #undef XADD
#undef XSUB #undef XSUB
#define MIX_AREAS_16 remix_areas_16_smp #define MIX_AREAS_16 remix_areas_16_smp
#define MIX_AREAS_16_MMX remix_areas_16_smp_mmx #define MIX_AREAS_16_MMX remix_areas_16_smp_mmx
#define MIX_AREAS_32 remix_areas_32_smp #define MIX_AREAS_32 remix_areas_32_smp
@ -73,7 +73,7 @@
#undef LOCK_PREFIX #undef LOCK_PREFIX
#undef XADD #undef XADD
#undef XSUB #undef XSUB
#define i386_dmix_supported_format \ #define i386_dmix_supported_format \
((1ULL << SND_PCM_FORMAT_S16_LE) |\ ((1ULL << SND_PCM_FORMAT_S16_LE) |\
(1ULL << SND_PCM_FORMAT_S32_LE) |\ (1ULL << SND_PCM_FORMAT_S32_LE) |\
@ -100,7 +100,7 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix)
if (!smp) { if (!smp) {
FILE *in; FILE *in;
char line[255]; char line[255];
/* try to determine the capabilities of the CPU */ /* try to determine the capabilities of the CPU */
in = fopen("/proc/cpuinfo", "r"); in = fopen("/proc/cpuinfo", "r");
if (in) { if (in) {
@ -117,7 +117,7 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix)
fclose(in); fclose(in);
} }
} }
if (mmx) { if (mmx) {
dmix->u.dmix.mix_areas_16 = smp > 1 ? mix_areas_16_smp_mmx : mix_areas_16_mmx; dmix->u.dmix.mix_areas_16 = smp > 1 ? mix_areas_16_smp_mmx : mix_areas_16_mmx;
dmix->u.dmix.remix_areas_16 = smp > 1 ? remix_areas_16_smp_mmx : remix_areas_16_mmx; dmix->u.dmix.remix_areas_16 = smp > 1 ? remix_areas_16_smp_mmx : remix_areas_16_mmx;

View file

@ -244,7 +244,7 @@ static void MIX_AREAS_16_MMX(unsigned int size,
"\tdecl %[size]\n" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
"\temms\n" "\temms\n"
"5:" "5:"
#ifdef BOUNDED_EBX #ifdef BOUNDED_EBX
"\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
#endif #endif

View file

@ -43,7 +43,7 @@
#undef LOCK_PREFIX #undef LOCK_PREFIX
#undef XADD #undef XADD
#undef XSUB #undef XSUB
#define MIX_AREAS_16 remix_areas_16_smp #define MIX_AREAS_16 remix_areas_16_smp
#define MIX_AREAS_32 remix_areas_32_smp #define MIX_AREAS_32 remix_areas_32_smp
#define MIX_AREAS_24 remix_areas_24_smp #define MIX_AREAS_24 remix_areas_24_smp
@ -57,7 +57,7 @@
#undef LOCK_PREFIX #undef LOCK_PREFIX
#undef XADD #undef XADD
#undef XSUB #undef XSUB
#define x86_64_dmix_supported_format \ #define x86_64_dmix_supported_format \
((1ULL << SND_PCM_FORMAT_S16_LE) |\ ((1ULL << SND_PCM_FORMAT_S16_LE) |\
(1ULL << SND_PCM_FORMAT_S32_LE) |\ (1ULL << SND_PCM_FORMAT_S32_LE) |\
@ -69,7 +69,7 @@
static void mix_select_callbacks(snd_pcm_direct_t *dmix) static void mix_select_callbacks(snd_pcm_direct_t *dmix)
{ {
static int smp = 0; static int smp = 0;
if (!dmix->direct_memory_access) { if (!dmix->direct_memory_access) {
generic_mix_select_callbacks(dmix); generic_mix_select_callbacks(dmix);
return; return;

View file

@ -137,7 +137,7 @@ static void MIX_AREAS_16(unsigned int size,
#ifdef BOUNDED_RBX #ifdef BOUNDED_RBX
, [old_rbx] "=m" (old_rbx) , [old_rbx] "=m" (old_rbx)
#endif #endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "im" (dst_step), [src_step] "im" (src_step), [dst_step] "im" (dst_step), [src_step] "im" (src_step),
[sum_step] "im" (sum_step) [sum_step] "im" (sum_step)
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
@ -279,7 +279,7 @@ static void MIX_AREAS_32(unsigned int size,
#ifdef BOUNDED_RBX #ifdef BOUNDED_RBX
, [old_rbx] "=m" (old_rbx) , [old_rbx] "=m" (old_rbx)
#endif #endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "im" (dst_step), [src_step] "im" (src_step), [dst_step] "im" (dst_step), [src_step] "im" (src_step),
[sum_step] "im" (sum_step) [sum_step] "im" (sum_step)
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
@ -403,7 +403,7 @@ static void MIX_AREAS_24(unsigned int size,
#ifdef BOUNDED_RBX #ifdef BOUNDED_RBX
, [old_rbx] "=m" (old_rbx) , [old_rbx] "=m" (old_rbx)
#endif #endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "im" (dst_step), [src_step] "im" (src_step), [dst_step] "im" (dst_step), [src_step] "im" (src_step),
[sum_step] "im" (sum_step) [sum_step] "im" (sum_step)
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -111,7 +111,7 @@ static void snd_pcm_dshare_sync_area(snd_pcm_t *pcm)
snd_pcm_uframes_t slave_hw_ptr, slave_appl_ptr, slave_size; snd_pcm_uframes_t slave_hw_ptr, slave_appl_ptr, slave_size;
snd_pcm_uframes_t appl_ptr, size; snd_pcm_uframes_t appl_ptr, size;
const snd_pcm_channel_area_t *src_areas, *dst_areas; const snd_pcm_channel_area_t *src_areas, *dst_areas;
/* calculate the size to transfer */ /* calculate the size to transfer */
size = pcm_frame_diff(dshare->appl_ptr, dshare->last_appl_ptr, pcm->boundary); size = pcm_frame_diff(dshare->appl_ptr, dshare->last_appl_ptr, pcm->boundary);
if (! size) if (! size)
@ -259,7 +259,7 @@ static int snd_pcm_dshare_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
{ {
snd_pcm_direct_t *dshare = pcm->private_data; snd_pcm_direct_t *dshare = pcm->private_data;
int err; int err;
switch (dshare->state) { switch (dshare->state) {
case SNDRV_PCM_STATE_DRAINING: case SNDRV_PCM_STATE_DRAINING:
case SNDRV_PCM_STATE_RUNNING: case SNDRV_PCM_STATE_RUNNING:
@ -328,7 +328,7 @@ static int snd_pcm_dshare_start(snd_pcm_t *pcm)
snd_pcm_direct_t *dshare = pcm->private_data; snd_pcm_direct_t *dshare = pcm->private_data;
snd_pcm_sframes_t avail; snd_pcm_sframes_t avail;
int err; int err;
if (dshare->state != SND_PCM_STATE_PREPARED) if (dshare->state != SND_PCM_STATE_PREPARED)
return -EBADFD; return -EBADFD;
avail = snd_pcm_mmap_playback_hw_avail(pcm); avail = snd_pcm_mmap_playback_hw_avail(pcm);
@ -484,10 +484,10 @@ static int snd_pcm_dshare_close(snd_pcm_t *pcm)
snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT);
dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask; dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask;
snd_pcm_close(dshare->spcm); snd_pcm_close(dshare->spcm);
if (dshare->server) if (dshare->server)
snd_pcm_direct_server_discard(dshare); snd_pcm_direct_server_discard(dshare);
if (dshare->client) if (dshare->client)
snd_pcm_direct_client_discard(dshare); snd_pcm_direct_client_discard(dshare);
if (snd_pcm_direct_shm_discard(dshare)) { if (snd_pcm_direct_shm_discard(dshare)) {
if (snd_pcm_direct_semaphore_discard(dshare)) if (snd_pcm_direct_semaphore_discard(dshare))
snd_pcm_direct_semaphore_final(dshare, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_final(dshare, DIRECT_IPC_SEM_CLIENT);
@ -537,7 +537,7 @@ static snd_pcm_sframes_t snd_pcm_dshare_avail_update(snd_pcm_t *pcm)
{ {
snd_pcm_direct_t *dshare = pcm->private_data; snd_pcm_direct_t *dshare = pcm->private_data;
int err; int err;
if (dshare->state == SND_PCM_STATE_RUNNING || if (dshare->state == SND_PCM_STATE_RUNNING ||
dshare->state == SND_PCM_STATE_DRAINING) { dshare->state == SND_PCM_STATE_DRAINING) {
if ((err = snd_pcm_dshare_sync_ptr(pcm)) < 0) if ((err = snd_pcm_dshare_sync_ptr(pcm)) < 0)
@ -556,7 +556,7 @@ static int snd_pcm_dshare_htimestamp(snd_pcm_t *pcm,
snd_pcm_direct_t *dshare = pcm->private_data; snd_pcm_direct_t *dshare = pcm->private_data;
snd_pcm_uframes_t avail1; snd_pcm_uframes_t avail1;
int ok = 0; int ok = 0;
while (1) { while (1) {
if (dshare->state == SND_PCM_STATE_RUNNING || if (dshare->state == SND_PCM_STATE_RUNNING ||
dshare->state == SND_PCM_STATE_DRAINING) dshare->state == SND_PCM_STATE_DRAINING)
@ -701,12 +701,12 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to open slave"); snd_error(PCM, "unable to open slave");
goto _err; goto _err;
} }
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) { if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
snd_error(PCM, "dshare plugin can be only connected to hw plugin"); snd_error(PCM, "dshare plugin can be only connected to hw plugin");
goto _err; goto _err;
} }
ret = snd_pcm_direct_initialize_slave(dshare, spcm, params); ret = snd_pcm_direct_initialize_slave(dshare, spcm, params);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "unable to initialize slave"); snd_error(PCM, "unable to initialize slave");
@ -714,7 +714,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
} }
dshare->spcm = spcm; dshare->spcm = spcm;
if (dshare->shmptr->use_server) { if (dshare->shmptr->use_server) {
ret = snd_pcm_direct_server_create(dshare); ret = snd_pcm_direct_server_create(dshare);
if (ret < 0) { if (ret < 0) {
@ -733,7 +733,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to connect client"); snd_error(PCM, "unable to connect client");
goto _err_nosem; goto _err_nosem;
} }
snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_open_secondary_client(&spcm, dshare, "dshare_client"); ret = snd_pcm_direct_open_secondary_client(&spcm, dshare, "dshare_client");
if (ret < 0) if (ret < 0)
@ -761,7 +761,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
ret = -EINVAL; ret = -EINVAL;
goto _err; goto _err;
} }
ret = snd_pcm_direct_initialize_secondary_slave(dshare, spcm, params); ret = snd_pcm_direct_initialize_secondary_slave(dshare, spcm, params);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "unable to initialize slave"); snd_error(PCM, "unable to initialize slave");
@ -784,7 +784,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
goto _err; goto _err;
} }
dshare->shmptr->u.dshare.chn_mask |= dshare->u.dshare.chn_mask; dshare->shmptr->u.dshare.chn_mask |= dshare->u.dshare.chn_mask;
ret = snd_pcm_direct_initialize_poll_fd(dshare); ret = snd_pcm_direct_initialize_poll_fd(dshare);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "unable to initialize poll_fd"); snd_error(PCM, "unable to initialize poll_fd");
@ -797,12 +797,12 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
pcm->mmap_rw = 1; pcm->mmap_rw = 1;
snd_pcm_set_hw_ptr(pcm, &dshare->hw_ptr, -1, 0); snd_pcm_set_hw_ptr(pcm, &dshare->hw_ptr, -1, 0);
snd_pcm_set_appl_ptr(pcm, &dshare->appl_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &dshare->appl_ptr, -1, 0);
snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
*pcmp = pcm; *pcmp = pcm;
return 0; return 0;
_err: _err:
if (dshare->shmptr != (void *) -1) if (dshare->shmptr != (void *) -1)
dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask; dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask;

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -106,7 +106,7 @@ static void snd_pcm_dsnoop_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_
snd_pcm_uframes_t hw_ptr = dsnoop->hw_ptr; snd_pcm_uframes_t hw_ptr = dsnoop->hw_ptr;
snd_pcm_uframes_t transfer; snd_pcm_uframes_t transfer;
const snd_pcm_channel_area_t *src_areas, *dst_areas; const snd_pcm_channel_area_t *src_areas, *dst_areas;
/* add sample areas here */ /* add sample areas here */
dst_areas = snd_pcm_mmap_areas(pcm); dst_areas = snd_pcm_mmap_areas(pcm);
src_areas = snd_pcm_mmap_areas(dsnoop->spcm); src_areas = snd_pcm_mmap_areas(dsnoop->spcm);
@ -119,7 +119,7 @@ static void snd_pcm_dsnoop_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_
size -= transfer; size -= transfer;
snoop_areas(dsnoop, src_areas, dst_areas, slave_hw_ptr, hw_ptr, transfer); snoop_areas(dsnoop, src_areas, dst_areas, slave_hw_ptr, hw_ptr, transfer);
slave_hw_ptr += transfer; slave_hw_ptr += transfer;
slave_hw_ptr %= dsnoop->slave_buffer_size; slave_hw_ptr %= dsnoop->slave_buffer_size;
hw_ptr += transfer; hw_ptr += transfer;
hw_ptr %= pcm->buffer_size; hw_ptr %= pcm->buffer_size;
} }
@ -206,7 +206,7 @@ static int snd_pcm_dsnoop_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
{ {
snd_pcm_direct_t *dsnoop = pcm->private_data; snd_pcm_direct_t *dsnoop = pcm->private_data;
int err; int err;
switch(dsnoop->state) { switch(dsnoop->state) {
case SNDRV_PCM_STATE_DRAINING: case SNDRV_PCM_STATE_DRAINING:
case SNDRV_PCM_STATE_RUNNING: case SNDRV_PCM_STATE_RUNNING:
@ -373,10 +373,10 @@ static int snd_pcm_dsnoop_close(snd_pcm_t *pcm)
snd_timer_close(dsnoop->timer); snd_timer_close(dsnoop->timer);
snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT);
snd_pcm_close(dsnoop->spcm); snd_pcm_close(dsnoop->spcm);
if (dsnoop->server) if (dsnoop->server)
snd_pcm_direct_server_discard(dsnoop); snd_pcm_direct_server_discard(dsnoop);
if (dsnoop->client) if (dsnoop->client)
snd_pcm_direct_client_discard(dsnoop); snd_pcm_direct_client_discard(dsnoop);
if (snd_pcm_direct_shm_discard(dsnoop)) { if (snd_pcm_direct_shm_discard(dsnoop)) {
if (snd_pcm_direct_semaphore_discard(dsnoop)) if (snd_pcm_direct_semaphore_discard(dsnoop))
snd_pcm_direct_semaphore_final(dsnoop, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_final(dsnoop, DIRECT_IPC_SEM_CLIENT);
@ -414,7 +414,7 @@ static snd_pcm_sframes_t snd_pcm_dsnoop_avail_update(snd_pcm_t *pcm)
{ {
snd_pcm_direct_t *dsnoop = pcm->private_data; snd_pcm_direct_t *dsnoop = pcm->private_data;
int err; int err;
if (dsnoop->state == SND_PCM_STATE_RUNNING) { if (dsnoop->state == SND_PCM_STATE_RUNNING) {
err = snd_pcm_dsnoop_sync_ptr(pcm); err = snd_pcm_dsnoop_sync_ptr(pcm);
if (err < 0) if (err < 0)
@ -433,7 +433,7 @@ static int snd_pcm_dsnoop_htimestamp(snd_pcm_t *pcm,
snd_pcm_direct_t *dsnoop = pcm->private_data; snd_pcm_direct_t *dsnoop = pcm->private_data;
snd_pcm_uframes_t avail1; snd_pcm_uframes_t avail1;
int ok = 0; int ok = 0;
while (1) { while (1) {
if (dsnoop->state == SND_PCM_STATE_RUNNING || if (dsnoop->state == SND_PCM_STATE_RUNNING ||
dsnoop->state == SND_PCM_STATE_DRAINING) dsnoop->state == SND_PCM_STATE_DRAINING)
@ -567,12 +567,12 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to open slave"); snd_error(PCM, "unable to open slave");
goto _err; goto _err;
} }
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) { if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
snd_error(PCM, "dsnoop plugin can be only connected to hw plugin"); snd_error(PCM, "dsnoop plugin can be only connected to hw plugin");
goto _err; goto _err;
} }
ret = snd_pcm_direct_initialize_slave(dsnoop, spcm, params); ret = snd_pcm_direct_initialize_slave(dsnoop, spcm, params);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "unable to initialize slave"); snd_error(PCM, "unable to initialize slave");
@ -580,7 +580,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
} }
dsnoop->spcm = spcm; dsnoop->spcm = spcm;
if (dsnoop->shmptr->use_server) { if (dsnoop->shmptr->use_server) {
ret = snd_pcm_direct_server_create(dsnoop); ret = snd_pcm_direct_server_create(dsnoop);
if (ret < 0) { if (ret < 0) {
@ -599,7 +599,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to connect client"); snd_error(PCM, "unable to connect client");
goto _err_nosem; goto _err_nosem;
} }
snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_open_secondary_client(&spcm, dsnoop, "dsnoop_client"); ret = snd_pcm_direct_open_secondary_client(&spcm, dsnoop, "dsnoop_client");
@ -627,7 +627,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
ret = -EINVAL; ret = -EINVAL;
goto _err; goto _err;
} }
ret = snd_pcm_direct_initialize_secondary_slave(dsnoop, spcm, params); ret = snd_pcm_direct_initialize_secondary_slave(dsnoop, spcm, params);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "unable to initialize slave"); snd_error(PCM, "unable to initialize slave");
@ -650,17 +650,17 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
pcm->mmap_rw = 1; pcm->mmap_rw = 1;
snd_pcm_set_hw_ptr(pcm, &dsnoop->hw_ptr, -1, 0); snd_pcm_set_hw_ptr(pcm, &dsnoop->hw_ptr, -1, 0);
snd_pcm_set_appl_ptr(pcm, &dsnoop->appl_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &dsnoop->appl_ptr, -1, 0);
if (dsnoop->channels == UINT_MAX) if (dsnoop->channels == UINT_MAX)
dsnoop->channels = dsnoop->shmptr->s.channels; dsnoop->channels = dsnoop->shmptr->s.channels;
snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
*pcmp = pcm; *pcmp = pcm;
return 0; return 0;
_err: _err:
if (dsnoop->timer) if (dsnoop->timer)
snd_timer_close(dsnoop->timer); snd_timer_close(dsnoop->timer);
if (dsnoop->server) if (dsnoop->server)
snd_pcm_direct_server_discard(dsnoop); snd_pcm_direct_server_discard(dsnoop);
@ -804,7 +804,7 @@ int _snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
if (err < 0) if (err < 0)
return err; return err;
/* set a reasonable default */ /* set a reasonable default */
if (psize == -1 && params.period_time == -1) if (psize == -1 && params.period_time == -1)
params.period_time = 125000; /* 0.125 seconds */ params.period_time = 125000; /* 0.125 seconds */

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
@ -77,8 +77,8 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED, int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_t *slave = NULL, *sconf; snd_config_t *slave = NULL, *sconf;
snd_config_iterator_t i, next; snd_config_iterator_t i, next;

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
#include "pcm_extplug.h" #include "pcm_extplug.h"
@ -264,7 +264,7 @@ static int snd_pcm_extplug_hw_refine_schange(snd_pcm_t *pcm,
return _snd_pcm_hw_params_refine(sparams, links, params); return _snd_pcm_hw_params_refine(sparams, links, params);
} }
static int snd_pcm_extplug_hw_refine_cchange(snd_pcm_t *pcm, static int snd_pcm_extplug_hw_refine_cchange(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams) snd_pcm_hw_params_t *sparams)
@ -511,7 +511,7 @@ usually you will call the external plugin API function,
#snd_pcm_extplug_create() or #snd_pcm_ioplug_create(), depending #snd_pcm_extplug_create() or #snd_pcm_ioplug_create(), depending
on the plugin type. The PCM handle must be filled *pcmp in return. on the plugin type. The PCM handle must be filled *pcmp in return.
Then this function must return either a value 0 when succeeded, or a Then this function must return either a value 0 when succeeded, or a
negative value as the error code. negative value as the error code.
Finally, add #SND_PCM_PLUGIN_SYMBOL() with the name of your Finally, add #SND_PCM_PLUGIN_SYMBOL() with the name of your
plugin as the argument at the end. This defines the proper versioned plugin as the argument at the end. This defines the proper versioned
@ -596,7 +596,7 @@ Otherfields are optional and should be initialized with zero.
The constant #SND_PCM_EXTPLUG_VERSION must be passed to the version The constant #SND_PCM_EXTPLUG_VERSION must be passed to the version
field for the version check in alsa-lib. A non-NULL ASCII string field for the version check in alsa-lib. A non-NULL ASCII string
has to be passed to the name field. The callback field contains the has to be passed to the name field. The callback field contains the
table of callback functions for this plugin (defined as table of callback functions for this plugin (defined as
#snd_pcm_extplug_callback_t). #snd_pcm_extplug_callback_t).
@ -611,7 +611,7 @@ The callback functions in #snd_pcm_extplug_callback_t define the real
behavior of the driver. behavior of the driver.
At least, transfer callback must be given. This callback is called At least, transfer callback must be given. This callback is called
at each time certain size of data block is transfered to the slave at each time certain size of data block is transfered to the slave
PCM. Other callbacks are optional. PCM. Other callbacks are optional.
The close callback is called when the PCM is closed. If the plugin The close callback is called when the PCM is closed. If the plugin
allocates private resources, this is the place to release them allocates private resources, this is the place to release them
@ -640,7 +640,7 @@ either #snd_pcm_extplug_set_slave_param_minmax() and
as former functions. as former functions.
To clear the parameter constraints, call #snd_pcm_extplug_params_reset() To clear the parameter constraints, call #snd_pcm_extplug_params_reset()
function. function.
When using snd_pcm_extplug_set_param_*() or snd_pcm_extplug_set_slave_param_*() When using snd_pcm_extplug_set_param_*() or snd_pcm_extplug_set_slave_param_*()
for any parameter. This parameter is no longer linked between the client and for any parameter. This parameter is no longer linked between the client and

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
#include "bswap.h" #include "bswap.h"
@ -353,7 +353,7 @@ static int write_wav_header(snd_pcm_t *pcm)
'd', 'a', 't', 'a', 'd', 'a', 't', 'a',
0, 0, 0, 0 0, 0, 0, 0
}; };
setup_wav_header(pcm, &file->wav_header); setup_wav_header(pcm, &file->wav_header);
res = safe_write(file->fd, header, sizeof(header)); res = safe_write(file->fd, header, sizeof(header));
@ -472,7 +472,7 @@ static int snd_pcm_file_add_frames(snd_pcm_t *pcm,
n = cont; n = cont;
if (n > avail) if (n > avail)
n = avail; n = avail;
snd_pcm_areas_copy(file->wbuf_areas, file->appl_ptr, snd_pcm_areas_copy(file->wbuf_areas, file->appl_ptr,
areas, offset, areas, offset,
pcm->channels, n, pcm->format); pcm->channels, n, pcm->format);
frames -= n; frames -= n;
@ -564,7 +564,7 @@ static snd_pcm_sframes_t snd_pcm_file_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f
snd_pcm_file_t *file = pcm->private_data; snd_pcm_file_t *file = pcm->private_data;
snd_pcm_sframes_t err; snd_pcm_sframes_t err;
snd_pcm_uframes_t n; snd_pcm_uframes_t n;
n = snd_pcm_frames_to_bytes(pcm, frames); n = snd_pcm_frames_to_bytes(pcm, frames);
if (n > file->wbuf_used_bytes) if (n > file->wbuf_used_bytes)
frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes); frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes);
@ -592,7 +592,7 @@ static snd_pcm_sframes_t snd_pcm_file_forward(snd_pcm_t *pcm, snd_pcm_uframes_t
snd_pcm_file_t *file = pcm->private_data; snd_pcm_file_t *file = pcm->private_data;
snd_pcm_sframes_t err; snd_pcm_sframes_t err;
snd_pcm_uframes_t n; snd_pcm_uframes_t n;
n = snd_pcm_frames_to_bytes(pcm, frames); n = snd_pcm_frames_to_bytes(pcm, frames);
if (file->wbuf_used_bytes + n > file->wbuf_size_bytes) if (file->wbuf_used_bytes + n > file->wbuf_size_bytes)
frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_size_bytes - file->wbuf_used_bytes); frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_size_bytes - file->wbuf_used_bytes);
@ -690,7 +690,7 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm
} }
static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm, static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm,
snd_pcm_uframes_t offset, snd_pcm_uframes_t offset,
snd_pcm_uframes_t size) snd_pcm_uframes_t size)
{ {
snd_pcm_file_t *file = pcm->private_data; snd_pcm_file_t *file = pcm->private_data;
@ -982,14 +982,14 @@ to a command, and optionally uses an existing file as an input data source
\code \code
pcm.name { pcm.name {
type file # File PCM type file # File PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
} }
file STR # Output filename (or shell command the stream file STR # Output filename (or shell command the stream
# will be piped to if STR starts with the pipe # will be piped to if STR starts with the pipe
# char). # char).
@ -1034,7 +1034,7 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;

View file

@ -7,7 +7,7 @@
*/ */
/* /*
* PCM - Common generic plugin code * PCM - Common generic plugin code
* Copyright (c) 2004 by Jaroslav Kysela <perex@perex.cz> * Copyright (c) 2004 by Jaroslav Kysela <perex@perex.cz>
* *
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
@ -125,7 +125,7 @@ int snd_pcm_generic_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
} }
int snd_pcm_generic_status(snd_pcm_t *pcm, snd_pcm_status_t * status) int snd_pcm_generic_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
{ {
snd_pcm_generic_t *generic = pcm->private_data; snd_pcm_generic_t *generic = pcm->private_data;
return snd_pcm_status(generic->slave, status); return snd_pcm_status(generic->slave, status);
} }
@ -256,7 +256,7 @@ snd_pcm_sframes_t snd_pcm_generic_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_ufr
return _snd_pcm_readn(generic->slave, bufs, size); return _snd_pcm_readn(generic->slave, bufs, size);
} }
snd_pcm_sframes_t snd_pcm_generic_mmap_commit(snd_pcm_t *pcm, snd_pcm_sframes_t snd_pcm_generic_mmap_commit(snd_pcm_t *pcm,
snd_pcm_uframes_t offset, snd_pcm_uframes_t offset,
snd_pcm_uframes_t size) snd_pcm_uframes_t size)
{ {

View file

@ -18,11 +18,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
typedef struct { typedef struct {
snd_pcm_t *slave; snd_pcm_t *slave;
int close_slave; int close_slave;
} snd_pcm_generic_t; } snd_pcm_generic_t;
/* make local functions really local */ /* make local functions really local */
#define snd_pcm_generic_close \ #define snd_pcm_generic_close \

View file

@ -26,7 +26,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_generic.h" #include "pcm_generic.h"
@ -283,9 +283,9 @@ pcm.NAME {
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
} }
hooks { hooks {
ID STR # Hook name (see pcm_hook) ID STR # Hook name (see pcm_hook)
@ -480,7 +480,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
* changed in future. * changed in future.
*/ */
int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;

View file

@ -26,7 +26,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "../control/control_local.h" #include "../control/control_local.h"
#include "../timer/timer_local.h" #include "../timer/timer_local.h"
@ -375,7 +375,7 @@ static int snd_pcm_hw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
if (pcm->tstamp_type != SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY) if (pcm->tstamp_type != SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY)
params->info |= SND_PCM_INFO_MONOTONIC; params->info |= SND_PCM_INFO_MONOTONIC;
} }
return 0; return 0;
} }
@ -434,7 +434,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
snd_timer_params_t params = {0}; snd_timer_params_t params = {0};
unsigned int suspend, resume; unsigned int suspend, resume;
int err; int err;
if (enable) { if (enable) {
err = snd_timer_hw_open(&hw->period_timer, err = snd_timer_hw_open(&hw->period_timer,
"hw-pcm-period-event", "hw-pcm-period-event",
@ -456,7 +456,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
return -EINVAL; return -EINVAL;
} }
hw->period_timer_pfd.events = POLLIN; hw->period_timer_pfd.events = POLLIN;
hw->period_timer_pfd.revents = 0; hw->period_timer_pfd.revents = 0;
snd_timer_poll_descriptors(hw->period_timer, snd_timer_poll_descriptors(hw->period_timer,
&hw->period_timer_pfd, 1); &hw->period_timer_pfd, 1);
hw->period_timer_need_poll = 0; hw->period_timer_need_poll = 0;
@ -473,7 +473,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
* In older versions, check via poll before read() is * In older versions, check via poll before read() is
* needed because of the confliction between * needed because of the confliction between
* TIMER_START and FIONBIO ioctls. * TIMER_START and FIONBIO ioctls.
*/ */
if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 4)) if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 4))
hw->period_timer_need_poll = 1; hw->period_timer_need_poll = 1;
/* /*
@ -1691,7 +1691,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
return ret; return ret;
} }
} }
hw = calloc(1, sizeof(snd_pcm_hw_t)); hw = calloc(1, sizeof(snd_pcm_hw_t));
if (!hw) { if (!hw) {
close(fd); close(fd);
@ -1785,7 +1785,7 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
sprintf(filename, filefmt, card, device); sprintf(filename, filefmt, card, device);
__again: __again:
if (attempt++ > 3) { if (attempt++ > 3) {
ret = -EBUSY; ret = -EBUSY;
goto _err; goto _err;
} }
@ -2085,8 +2085,8 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
return 0; return 0;
fail: fail:
snd_pcm_free_chmaps(chmap); snd_pcm_free_chmaps(chmap);
return err; return err;
} }
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN
@ -2152,7 +2152,7 @@ static int use_old_hw_params_ioctl(int fd, unsigned int cmd, snd_pcm_hw_params_t
struct sndrv_pcm_hw_params_old oparams; struct sndrv_pcm_hw_params_old oparams;
unsigned int cmask = 0; unsigned int cmask = 0;
int res; int res;
snd_pcm_hw_convert_to_old_params(&oparams, params, &cmask); snd_pcm_hw_convert_to_old_params(&oparams, params, &cmask);
res = ioctl(fd, cmd, &oparams); res = ioctl(fd, cmd, &oparams);
snd_pcm_hw_convert_from_old_params(params, &oparams); snd_pcm_hw_convert_from_old_params(params, &oparams);

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
#include "plugin_ops.h" #include "plugin_ops.h"
@ -295,7 +295,7 @@ static int snd_pcm_iec958_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd
return err; return err;
return 0; return 0;
} }
static int snd_pcm_iec958_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, static int snd_pcm_iec958_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams) snd_pcm_hw_params_t *sparams)
{ {
@ -454,7 +454,7 @@ snd_pcm_iec958_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
iec->func(iec, slave_areas, slave_offset, iec->func(iec, slave_areas, slave_offset,
areas, offset, areas, offset,
pcm->channels, size); pcm->channels, size);
*slave_sizep = size; *slave_sizep = size;
return size; return size;
@ -472,7 +472,7 @@ snd_pcm_iec958_read_areas(snd_pcm_t *pcm,
snd_pcm_iec958_t *iec = pcm->private_data; snd_pcm_iec958_t *iec = pcm->private_data;
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
iec->func(iec, areas, offset, iec->func(iec, areas, offset,
slave_areas, slave_offset, slave_areas, slave_offset,
pcm->channels, size); pcm->channels, size);
*slave_sizep = size; *slave_sizep = size;
@ -489,7 +489,7 @@ static int snd_pcm_iec958_init(snd_pcm_t *pcm)
static void snd_pcm_iec958_dump(snd_pcm_t *pcm, snd_output_t *out) static void snd_pcm_iec958_dump(snd_pcm_t *pcm, snd_output_t *out)
{ {
snd_pcm_iec958_t *iec = pcm->private_data; snd_pcm_iec958_t *iec = pcm->private_data;
snd_output_printf(out, "IEC958 subframe conversion PCM (%s)\n", snd_output_printf(out, "IEC958 subframe conversion PCM (%s)\n",
snd_pcm_format_name(iec->sformat)); snd_pcm_format_name(iec->sformat));
if (pcm->setup) { if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n"); snd_output_printf(out, "Its setup is:\n");
@ -560,12 +560,12 @@ static const snd_pcm_ops_t snd_pcm_iec958_ops = {
* \warning Using of this function might be dangerous in the sense * \warning Using of this function might be dangerous in the sense
* of compatibility reasons. The prototype might be freely * of compatibility reasons. The prototype might be freely
* changed in future. * changed in future.
*/ */
int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat,
snd_pcm_t *slave, int close_slave, snd_pcm_t *slave, int close_slave,
const unsigned char *status_bits, const unsigned char *status_bits,
const unsigned char *preamble_vals, const unsigned char *preamble_vals,
int hdmi_mode) int hdmi_mode)
{ {
snd_pcm_t *pcm; snd_pcm_t *pcm;
snd_pcm_iec958_t *iec; snd_pcm_iec958_t *iec;
@ -638,14 +638,14 @@ This plugin converts 32bit IEC958 subframe samples to linear, or linear to
\code \code
pcm.name { pcm.name {
type iec958 # IEC958 subframe conversion PCM type iec958 # IEC958 subframe conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
} }
[status status-bytes] # IEC958 status bits (given in byte array) [status status-bytes] # IEC958 status bits (given in byte array)
# IEC958 preamble bits definitions # IEC958 preamble bits definitions
# B/M/W or Z/X/Y, B = block start, M = even subframe, W = odd subframe # B/M/W or Z/X/Y, B = block start, M = even subframe, W = odd subframe
@ -684,7 +684,7 @@ by the HDMI HBR specification.
* changed in future. * changed in future.
*/ */
int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
@ -797,7 +797,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
if (snd_pcm_format_linear(sformat) != 1 && if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE && sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE &&
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE) { sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE) {
snd_config_delete(sconf); snd_config_delete(sconf);
snd_error(PCM, "invalid slave format"); snd_error(PCM, "invalid slave format");
return -EINVAL; return -EINVAL;
} }

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_ioplug.h" #include "pcm_ioplug.h"
#include "pcm_ext_parm.h" #include "pcm_ext_parm.h"
@ -482,7 +482,7 @@ static int snd_pcm_ioplug_start(snd_pcm_t *pcm)
{ {
ioplug_priv_t *io = pcm->private_data; ioplug_priv_t *io = pcm->private_data;
int err; int err;
if (io->data->state != SND_PCM_STATE_PREPARED) if (io->data->state != SND_PCM_STATE_PREPARED)
return -EBADFD; return -EBADFD;
@ -637,7 +637,7 @@ static snd_pcm_sframes_t ioplug_priv_transfer_areas(snd_pcm_t *pcm,
{ {
ioplug_priv_t *io = pcm->private_data; ioplug_priv_t *io = pcm->private_data;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
if (! size) if (! size)
return 0; return 0;
if (io->data->callback->transfer) if (io->data->callback->transfer)
@ -656,7 +656,7 @@ static snd_pcm_sframes_t snd_pcm_ioplug_writei(snd_pcm_t *pcm, const void *buffe
else { else {
snd_pcm_channel_area_t areas[pcm->channels]; snd_pcm_channel_area_t areas[pcm->channels];
snd_pcm_areas_from_buf(pcm, areas, (void*)buffer); snd_pcm_areas_from_buf(pcm, areas, (void*)buffer);
return snd_pcm_write_areas(pcm, areas, 0, size, return snd_pcm_write_areas(pcm, areas, 0, size,
ioplug_priv_transfer_areas); ioplug_priv_transfer_areas);
} }
} }
@ -982,7 +982,7 @@ Otherfields are optional and should be initialized with zero.
The constant #SND_PCM_IOPLUG_VERSION must be passed to the version The constant #SND_PCM_IOPLUG_VERSION must be passed to the version
field for the version check in alsa-lib. A non-NULL ASCII string field for the version check in alsa-lib. A non-NULL ASCII string
has to be passed to the name field. The callback field contains the has to be passed to the name field. The callback field contains the
table of callback functions for this plugin (defined as table of callback functions for this plugin (defined as
#snd_pcm_ioplug_callback_t). #snd_pcm_ioplug_callback_t).

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
#include "plugin_ops.h" #include "plugin_ops.h"
@ -236,7 +236,7 @@ static int snd_pcm_lfloat_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd
return err; return err;
return 0; return 0;
} }
static int snd_pcm_lfloat_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, static int snd_pcm_lfloat_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams) snd_pcm_hw_params_t *sparams)
{ {
@ -309,7 +309,7 @@ snd_pcm_lfloat_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
lfloat->func(slave_areas, slave_offset, lfloat->func(slave_areas, slave_offset,
areas, offset, areas, offset,
pcm->channels, size, pcm->channels, size,
lfloat->int32_idx, lfloat->float32_idx); lfloat->int32_idx, lfloat->float32_idx);
*slave_sizep = size; *slave_sizep = size;
@ -328,7 +328,7 @@ snd_pcm_lfloat_read_areas(snd_pcm_t *pcm,
snd_pcm_lfloat_t *lfloat = pcm->private_data; snd_pcm_lfloat_t *lfloat = pcm->private_data;
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
lfloat->func(areas, offset, lfloat->func(areas, offset,
slave_areas, slave_offset, slave_areas, slave_offset,
pcm->channels, size, pcm->channels, size,
lfloat->int32_idx, lfloat->float32_idx); lfloat->int32_idx, lfloat->float32_idx);
@ -339,7 +339,7 @@ snd_pcm_lfloat_read_areas(snd_pcm_t *pcm,
static void snd_pcm_lfloat_dump(snd_pcm_t *pcm, snd_output_t *out) static void snd_pcm_lfloat_dump(snd_pcm_t *pcm, snd_output_t *out)
{ {
snd_pcm_lfloat_t *lfloat = pcm->private_data; snd_pcm_lfloat_t *lfloat = pcm->private_data;
snd_output_printf(out, "Linear Integer <-> Linear Float conversion PCM (%s)\n", snd_output_printf(out, "Linear Integer <-> Linear Float conversion PCM (%s)\n",
snd_pcm_format_name(lfloat->sformat)); snd_pcm_format_name(lfloat->sformat));
if (pcm->setup) { if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n"); snd_output_printf(out, "Its setup is:\n");
@ -415,7 +415,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo
snd_pcm_set_hw_ptr(pcm, &lfloat->plug.hw_ptr, -1, 0); snd_pcm_set_hw_ptr(pcm, &lfloat->plug.hw_ptr, -1, 0);
snd_pcm_set_appl_ptr(pcm, &lfloat->plug.appl_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &lfloat->plug.appl_ptr, -1, 0);
*pcmp = pcm; *pcmp = pcm;
return 0; return 0;
} }
@ -429,15 +429,15 @@ match for both of them.
\code \code
pcm.name { pcm.name {
type lfloat # Linear<->Float conversion PCM type lfloat # Linear<->Float conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
format STR # Slave format format STR # Slave format
} }
} }
\endcode \endcode
@ -464,7 +464,7 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
@ -528,7 +528,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
int _snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED, int _snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
const char *name ATTRIBUTE_UNUSED, const char *name ATTRIBUTE_UNUSED,
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf ATTRIBUTE_UNUSED, snd_config_t *conf ATTRIBUTE_UNUSED,
snd_pcm_stream_t stream ATTRIBUTE_UNUSED, snd_pcm_stream_t stream ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED) int mode ATTRIBUTE_UNUSED)
{ {

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
#include "plugin_ops.h" #include "plugin_ops.h"
@ -78,7 +78,7 @@ int snd_pcm_linear_convert_index(snd_pcm_format_t src_format,
int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format) int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
{ {
int sign, width, pwidth, endian; int sign, width, pwidth, endian;
sign = (snd_pcm_format_signed(src_format) != sign = (snd_pcm_format_signed(src_format) !=
snd_pcm_format_signed(dst_format)); snd_pcm_format_signed(dst_format));
#ifdef SND_LITTLE_ENDIAN #ifdef SND_LITTLE_ENDIAN
endian = snd_pcm_format_big_endian(src_format); endian = snd_pcm_format_big_endian(src_format);
@ -112,7 +112,7 @@ int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_f
int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format) int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
{ {
int sign, width, pwidth, endian; int sign, width, pwidth, endian;
sign = (snd_pcm_format_signed(src_format) != sign = (snd_pcm_format_signed(src_format) !=
snd_pcm_format_signed(dst_format)); snd_pcm_format_signed(dst_format));
#ifdef SND_LITTLE_ENDIAN #ifdef SND_LITTLE_ENDIAN
endian = snd_pcm_format_big_endian(dst_format); endian = snd_pcm_format_big_endian(dst_format);
@ -264,7 +264,7 @@ static int snd_pcm_linear_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd
return err; return err;
return 0; return 0;
} }
static int snd_pcm_linear_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, static int snd_pcm_linear_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams) snd_pcm_hw_params_t *sparams)
{ {
@ -344,12 +344,12 @@ snd_pcm_linear_write_areas(snd_pcm_t *pcm,
size = *slave_sizep; size = *slave_sizep;
if (linear->use_getput) if (linear->use_getput)
snd_pcm_linear_getput(slave_areas, slave_offset, snd_pcm_linear_getput(slave_areas, slave_offset,
areas, offset, areas, offset,
pcm->channels, size, pcm->channels, size,
linear->get_idx, linear->put_idx); linear->get_idx, linear->put_idx);
else else
snd_pcm_linear_convert(slave_areas, slave_offset, snd_pcm_linear_convert(slave_areas, slave_offset,
areas, offset, areas, offset,
pcm->channels, size, linear->conv_idx); pcm->channels, size, linear->conv_idx);
*slave_sizep = size; *slave_sizep = size;
return size; return size;
@ -368,12 +368,12 @@ snd_pcm_linear_read_areas(snd_pcm_t *pcm,
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
if (linear->use_getput) if (linear->use_getput)
snd_pcm_linear_getput(areas, offset, snd_pcm_linear_getput(areas, offset,
slave_areas, slave_offset, slave_areas, slave_offset,
pcm->channels, size, pcm->channels, size,
linear->get_idx, linear->put_idx); linear->get_idx, linear->put_idx);
else else
snd_pcm_linear_convert(areas, offset, snd_pcm_linear_convert(areas, offset,
slave_areas, slave_offset, slave_areas, slave_offset,
pcm->channels, size, linear->conv_idx); pcm->channels, size, linear->conv_idx);
*slave_sizep = size; *slave_sizep = size;
@ -383,7 +383,7 @@ snd_pcm_linear_read_areas(snd_pcm_t *pcm,
static void snd_pcm_linear_dump(snd_pcm_t *pcm, snd_output_t *out) static void snd_pcm_linear_dump(snd_pcm_t *pcm, snd_output_t *out)
{ {
snd_pcm_linear_t *linear = pcm->private_data; snd_pcm_linear_t *linear = pcm->private_data;
snd_output_printf(out, "Linear conversion PCM (%s)\n", snd_output_printf(out, "Linear conversion PCM (%s)\n",
snd_pcm_format_name(linear->sformat)); snd_pcm_format_name(linear->sformat));
if (pcm->setup) { if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n"); snd_output_printf(out, "Its setup is:\n");
@ -472,15 +472,15 @@ slave PCM. The channel count, format and rate must match for both of them.
\code \code
pcm.name { pcm.name {
type linear # Linear conversion PCM type linear # Linear conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
format STR # Slave format format STR # Slave format
} }
} }
\endcode \endcode
@ -507,7 +507,7 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;

View file

@ -401,9 +401,9 @@ snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_ufram
snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
typedef snd_pcm_sframes_t (*snd_pcm_xfer_areas_func_t)(snd_pcm_t *pcm, typedef snd_pcm_sframes_t (*snd_pcm_xfer_areas_func_t)(snd_pcm_t *pcm,
const snd_pcm_channel_area_t *areas, const snd_pcm_channel_area_t *areas,
snd_pcm_uframes_t offset, snd_pcm_uframes_t offset,
snd_pcm_uframes_t size); snd_pcm_uframes_t size);
snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas, snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas,
@ -606,13 +606,13 @@ static inline const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm)
static inline snd_pcm_uframes_t snd_pcm_mmap_offset(snd_pcm_t *pcm) static inline snd_pcm_uframes_t snd_pcm_mmap_offset(snd_pcm_t *pcm)
{ {
assert(pcm); assert(pcm);
return *pcm->appl.ptr % pcm->buffer_size; return *pcm->appl.ptr % pcm->buffer_size;
} }
static inline snd_pcm_uframes_t snd_pcm_mmap_hw_offset(snd_pcm_t *pcm) static inline snd_pcm_uframes_t snd_pcm_mmap_hw_offset(snd_pcm_t *pcm)
{ {
assert(pcm); assert(pcm);
return *pcm->hw.ptr % pcm->buffer_size; return *pcm->hw.ptr % pcm->buffer_size;
} }
@ -1079,7 +1079,7 @@ const snd_config_t *snd_pcm_rate_get_default_converter(snd_config_t *root);
(1U << (SND_PCM_FORMAT_U18_3LE - 32)) | \ (1U << (SND_PCM_FORMAT_U18_3LE - 32)) | \
(1U << (SND_PCM_FORMAT_S18_3BE - 32)) | \ (1U << (SND_PCM_FORMAT_S18_3BE - 32)) | \
(1U << (SND_PCM_FORMAT_U18_3BE - 32))) } (1U << (SND_PCM_FORMAT_U18_3BE - 32))) }
#define SND_PCM_FMTBIT_FLOAT \ #define SND_PCM_FMTBIT_FLOAT \
{ ((1U << SND_PCM_FORMAT_FLOAT_LE) | \ { ((1U << SND_PCM_FORMAT_FLOAT_LE) | \

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
@ -93,7 +93,7 @@ static void snd_pcm_meter_add_frames(snd_pcm_t *pcm,
n = dst_cont; n = dst_cont;
if (n > src_cont) if (n > src_cont)
n = src_cont; n = src_cont;
snd_pcm_areas_copy(meter->buf_areas, dst_offset, snd_pcm_areas_copy(meter->buf_areas, dst_offset,
areas, src_offset, areas, src_offset,
pcm->channels, n, pcm->format); pcm->channels, n, pcm->format);
frames -= n; frames -= n;
@ -259,7 +259,7 @@ static void *snd_pcm_meter_thread(void *data)
if (scope->enabled) if (scope->enabled)
scope->ops->update(scope); scope->ops->update(scope);
} }
nanosleep(&meter->delay, NULL); nanosleep(&meter->delay, NULL);
} }
list_for_each(pos, &meter->scopes) { list_for_each(pos, &meter->scopes) {
scope = list_entry(pos, snd_pcm_scope_t, list); scope = list_entry(pos, snd_pcm_scope_t, list);
@ -404,7 +404,7 @@ static int snd_pcm_meter_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
return err; return err;
return 0; return 0;
} }
static int snd_pcm_meter_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, static int snd_pcm_meter_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams) snd_pcm_hw_params_t *sparams)
{ {
@ -716,14 +716,14 @@ pcm_scope.name {
} }
pcm.name { pcm.name {
type meter # Meter PCM type meter # Meter PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
} }
[frequency INT] # Updates per second [frequency INT] # Updates per second
scopes { scopes {
ID STR # Scope name (see pcm_scope) ID STR # Scope name (see pcm_scope)
@ -756,7 +756,7 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
@ -1174,7 +1174,7 @@ static const snd_pcm_scope_ops_t s16_ops = {
* \param scopep Pointer to newly created and added scope * \param scopep Pointer to newly created and added scope
* \return 0 on success otherwise a negative error code * \return 0 on success otherwise a negative error code
* *
* s16 pseudo scope convert #SND_PCM_TYPE_METER PCM frames in CPU endian * s16 pseudo scope convert #SND_PCM_TYPE_METER PCM frames in CPU endian
* 16 bit frames for use with other scopes. Don't forget to insert it before * 16 bit frames for use with other scopes. Don't forget to insert it before
* and to not insert it more time (see #snd_pcm_meter_search_scope) * and to not insert it more time (see #snd_pcm_meter_search_scope)
*/ */

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "bswap.h" #include "bswap.h"
#include <stdio.h> #include <stdio.h>
@ -519,7 +519,7 @@ uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
return bswap_64(u.i); return bswap_64(u.i);
#endif #endif
} }
case SNDRV_PCM_FORMAT_FLOAT_BE: case SNDRV_PCM_FORMAT_FLOAT_BE:
{ {
union { union {
float f[2]; float f[2];
@ -547,7 +547,7 @@ uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
} }
case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE: case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE: case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE:
return 0; return 0;
case SNDRV_PCM_FORMAT_MU_LAW: case SNDRV_PCM_FORMAT_MU_LAW:
return 0x7f7f7f7f7f7f7f7fULL; return 0x7f7f7f7f7f7f7f7fULL;
case SNDRV_PCM_FORMAT_A_LAW: case SNDRV_PCM_FORMAT_A_LAW:

View file

@ -85,8 +85,8 @@ static snd_pcm_sframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm,
__snd_pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames); __snd_pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames);
snd_pcm_areas_copy(pcm_areas, pcm_offset, snd_pcm_areas_copy(pcm_areas, pcm_offset,
areas, offset, areas, offset,
pcm->channels, pcm->channels,
frames, pcm->format); frames, pcm->format);
result = __snd_pcm_mmap_commit(pcm, pcm_offset, frames); result = __snd_pcm_mmap_commit(pcm, pcm_offset, frames);
if (result < 0) if (result < 0)
@ -114,11 +114,11 @@ static snd_pcm_sframes_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm,
snd_pcm_uframes_t pcm_offset; snd_pcm_uframes_t pcm_offset;
snd_pcm_uframes_t frames = size; snd_pcm_uframes_t frames = size;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
__snd_pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames); __snd_pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames);
snd_pcm_areas_copy(areas, offset, snd_pcm_areas_copy(areas, offset,
pcm_areas, pcm_offset, pcm_areas, pcm_offset,
pcm->channels, pcm->channels,
frames, pcm->format); frames, pcm->format);
result = __snd_pcm_mmap_commit(pcm, pcm_offset, frames); result = __snd_pcm_mmap_commit(pcm, pcm_offset, frames);
if (result < 0) if (result < 0)
@ -255,7 +255,7 @@ int snd_pcm_channel_info_shm(snd_pcm_t *pcm, snd_pcm_channel_info_t *info, int s
} else } else
info->type = SND_PCM_AREA_LOCAL; info->type = SND_PCM_AREA_LOCAL;
return 0; return 0;
} }
int snd_pcm_mmap(snd_pcm_t *pcm) int snd_pcm_mmap(snd_pcm_t *pcm)
{ {
@ -306,12 +306,12 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
size_t size; size_t size;
unsigned int c1; unsigned int c1;
if (i->addr) { if (i->addr) {
a->addr = i->addr; a->addr = i->addr;
a->first = i->first; a->first = i->first;
a->step = i->step; a->step = i->step;
continue; continue;
} }
size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits; size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits;
for (c1 = c + 1; c1 < pcm->channels; ++c1) { for (c1 = c + 1; c1 < pcm->channels; ++c1) {
snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1]; snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
size_t s; size_t s;
@ -415,7 +415,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
switch (i1->type) { switch (i1->type) {
case SND_PCM_AREA_MMAP: case SND_PCM_AREA_MMAP:
if (i1->u.mmap.fd != i->u.mmap.fd || if (i1->u.mmap.fd != i->u.mmap.fd ||
i1->u.mmap.offset != i->u.mmap.offset) i1->u.mmap.offset != i->u.mmap.offset)
continue; continue;
break; break;
case SND_PCM_AREA_SHM: case SND_PCM_AREA_SHM:
@ -425,7 +425,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
case SND_PCM_AREA_LOCAL: case SND_PCM_AREA_LOCAL:
if (pcm->access != SND_PCM_ACCESS_MMAP_INTERLEAVED && if (pcm->access != SND_PCM_ACCESS_MMAP_INTERLEAVED &&
pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED) pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED)
continue; continue;
break; break;
default: default:
assert(0); assert(0);

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_generic.h" #include "pcm_generic.h"

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
#include "plugin_ops.h" #include "plugin_ops.h"
@ -287,7 +287,7 @@ static int snd_pcm_mulaw_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
return err; return err;
return 0; return 0;
} }
static int snd_pcm_mulaw_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, static int snd_pcm_mulaw_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams) snd_pcm_hw_params_t *sparams)
{ {
@ -365,7 +365,7 @@ snd_pcm_mulaw_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
mulaw->func(slave_areas, slave_offset, mulaw->func(slave_areas, slave_offset,
areas, offset, areas, offset,
pcm->channels, size, pcm->channels, size,
mulaw->getput_idx); mulaw->getput_idx);
*slave_sizep = size; *slave_sizep = size;
@ -384,7 +384,7 @@ snd_pcm_mulaw_read_areas(snd_pcm_t *pcm,
snd_pcm_mulaw_t *mulaw = pcm->private_data; snd_pcm_mulaw_t *mulaw = pcm->private_data;
if (size > *slave_sizep) if (size > *slave_sizep)
size = *slave_sizep; size = *slave_sizep;
mulaw->func(areas, offset, mulaw->func(areas, offset,
slave_areas, slave_offset, slave_areas, slave_offset,
pcm->channels, size, pcm->channels, size,
mulaw->getput_idx); mulaw->getput_idx);
@ -395,7 +395,7 @@ snd_pcm_mulaw_read_areas(snd_pcm_t *pcm,
static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, snd_output_t *out) static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, snd_output_t *out)
{ {
snd_pcm_mulaw_t *mulaw = pcm->private_data; snd_pcm_mulaw_t *mulaw = pcm->private_data;
snd_output_printf(out, "Mu-Law conversion PCM (%s)\n", snd_output_printf(out, "Mu-Law conversion PCM (%s)\n",
snd_pcm_format_name(mulaw->sformat)); snd_pcm_format_name(mulaw->sformat));
if (pcm->setup) { if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n"); snd_output_printf(out, "Its setup is:\n");
@ -484,15 +484,15 @@ format and rate must match for both of them.
\code \code
pcm.name { pcm.name {
type mulaw # Mu-Law conversion PCM type mulaw # Mu-Law conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
format STR # Slave format format STR # Slave format
} }
} }
\endcode \endcode
@ -519,7 +519,7 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_generic.h" #include "pcm_generic.h"
#include <stdio.h> #include <stdio.h>
@ -208,7 +208,7 @@ static int snd_pcm_multi_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
return err; return err;
return 0; return 0;
} }
static int snd_pcm_multi_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, static int snd_pcm_multi_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
unsigned int slave_idx ATTRIBUTE_UNUSED, unsigned int slave_idx ATTRIBUTE_UNUSED,
snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *params,
@ -523,7 +523,7 @@ static int snd_pcm_multi_reset(snd_pcm_t *pcm)
for (i = 0; i < multi->slaves_count; ++i) { for (i = 0; i < multi->slaves_count; ++i) {
/* Reset each slave, as well as in prepare */ /* Reset each slave, as well as in prepare */
err = snd_pcm_reset(multi->slaves[i].pcm); err = snd_pcm_reset(multi->slaves[i].pcm);
if (err < 0) if (err < 0)
result = err; result = err;
} }
multi->hw_ptr = multi->appl_ptr = 0; multi->hw_ptr = multi->appl_ptr = 0;
@ -735,7 +735,7 @@ static int snd_pcm_multi_resume(snd_pcm_t *pcm)
* including the first one has to be relinked to the given master. * including the first one has to be relinked to the given master.
*/ */
static int snd_pcm_multi_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master) static int snd_pcm_multi_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master)
{ {
snd_pcm_multi_t *multi = pcm->private_data; snd_pcm_multi_t *multi = pcm->private_data;
unsigned int i; unsigned int i;
int err; int err;
@ -993,7 +993,7 @@ static void snd_pcm_multi_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_multi_channel_t *c = &multi->channels[k]; snd_pcm_multi_channel_t *c = &multi->channels[k];
if (c->slave_idx < 0) if (c->slave_idx < 0)
continue; continue;
snd_output_printf(out, " %d: slave %d, channel %d\n", snd_output_printf(out, " %d: slave %d, channel %d\n",
k, c->slave_idx, c->slave_channel); k, c->slave_idx, c->slave_channel);
} }
if (pcm->setup) { if (pcm->setup) {
@ -1097,7 +1097,7 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
} }
stream = slaves_pcm[0]->stream; stream = slaves_pcm[0]->stream;
multi->slaves_count = slaves_count; multi->slaves_count = slaves_count;
multi->master_slave = master_slave; multi->master_slave = master_slave;
multi->slaves = calloc(slaves_count, sizeof(*multi->slaves)); multi->slaves = calloc(slaves_count, sizeof(*multi->slaves));
@ -1160,8 +1160,8 @@ This plugin converts multiple streams to one.
\code \code
pcm.name { pcm.name {
type multi # Multiple streams conversion PCM type multi # Multiple streams conversion PCM
slaves { # Slaves definition slaves { # Slaves definition
ID STR # Slave PCM name ID STR # Slave PCM name
# or # or
ID { ID {
@ -1170,7 +1170,7 @@ pcm.name {
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
channels INT # Slave channels channels INT # Slave channels
} }
} }
bindings { # Bindings table bindings { # Bindings table
N { N {
slave STR # Slave key slave STR # Slave key
@ -1412,7 +1412,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
err = -EINVAL; err = -EINVAL;
goto _free; goto _free;
} }
if (schannel < 0 || if (schannel < 0 ||
(unsigned int) schannel >= slaves_channels[slave]) { (unsigned int) schannel >= slaves_channels[slave]) {
snd_error(PCM, "Invalid or missing schannel for channel %s", id); snd_error(PCM, "Invalid or missing schannel for channel %s", id);
err = -EINVAL; err = -EINVAL;
@ -1421,7 +1421,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
channels_sidx[cchannel] = slave; channels_sidx[cchannel] = slave;
channels_schannel[cchannel] = schannel; channels_schannel[cchannel] = schannel;
} }
for (idx = 0; idx < slaves_count; ++idx) { for (idx = 0; idx < slaves_count; ++idx) {
err = snd_pcm_open_slave(&slaves_pcm[idx], root, err = snd_pcm_open_slave(&slaves_pcm[idx], root,
slaves_conf[idx], stream, mode, slaves_conf[idx], stream, mode,

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
#include "bswap.h" #include "bswap.h"
@ -82,11 +82,11 @@ static int snd_pcm_null_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
static snd_pcm_sframes_t snd_pcm_null_avail_update(snd_pcm_t *pcm) static snd_pcm_sframes_t snd_pcm_null_avail_update(snd_pcm_t *pcm)
{ {
snd_pcm_null_t *null = pcm->private_data; snd_pcm_null_t *null = pcm->private_data;
if (null->state == SND_PCM_STATE_PREPARED) { if (null->state == SND_PCM_STATE_PREPARED) {
/* it is required to return the correct avail count for */ /* it is required to return the correct avail count for */
/* the prepared stream, otherwise the start is not called */ /* the prepared stream, otherwise the start is not called */
return snd_pcm_mmap_avail(pcm); return snd_pcm_mmap_avail(pcm);
} }
return pcm->buffer_size; return pcm->buffer_size;
} }
@ -403,7 +403,7 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea
} }
null->poll_fd = fd; null->poll_fd = fd;
null->state = SND_PCM_STATE_OPEN; null->state = SND_PCM_STATE_OPEN;
err = snd_pcm_new(&pcm, SND_PCM_TYPE_NULL, name, stream, mode); err = snd_pcm_new(&pcm, SND_PCM_TYPE_NULL, name, stream, mode);
if (err < 0) { if (err < 0) {
close(fd); close(fd);
@ -434,7 +434,7 @@ and /dev/full (capture, must be readable).
\code \code
pcm.name { pcm.name {
type null # Null PCM type null # Null PCM
[chmap MAP] # Provide channel maps; MAP is a string array [chmap MAP] # Provide channel maps; MAP is a string array
} }
\endcode \endcode
@ -462,7 +462,7 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#ifndef NDEBUG #ifndef NDEBUG
@ -124,7 +124,7 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params)
params->info = ~0U; params->info = ~0U;
} }
/* Return the value for field PAR if it's fixed in configuration space /* Return the value for field PAR if it's fixed in configuration space
defined by PARAMS. Return -EINVAL otherwise defined by PARAMS. Return -EINVAL otherwise
*/ */
int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
@ -267,12 +267,12 @@ static int _snd_pcm_hw_param_set_integer(snd_pcm_hw_params_t *params,
} }
return changed; return changed;
} }
/* Inside configuration space defined by PARAMS remove from PAR all /* Inside configuration space defined by PARAMS remove from PAR all
non integer values. Reduce configuration space accordingly. non integer values. Reduce configuration space accordingly.
Return -EINVAL if the configuration space is empty Return -EINVAL if the configuration space is empty
*/ */
int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm, int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *params,
snd_set_mode_t mode, snd_set_mode_t mode,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
@ -328,12 +328,12 @@ static int _snd_pcm_hw_param_set_first(snd_pcm_hw_params_t *params,
} }
/* Inside configuration space defined by PARAMS remove from PAR all /* Inside configuration space defined by PARAMS remove from PAR all
values > minimum. Reduce configuration space accordingly. values > minimum. Reduce configuration space accordingly.
Return the minimum. Return the minimum.
*/ */
int snd_pcm_hw_param_set_first(snd_pcm_t *pcm, int snd_pcm_hw_param_set_first(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
unsigned int *rval, int *dir) unsigned int *rval, int *dir)
{ {
@ -370,11 +370,11 @@ static int _snd_pcm_hw_param_set_last(snd_pcm_hw_params_t *params,
} }
/* Inside configuration space defined by PARAMS remove from PAR all /* Inside configuration space defined by PARAMS remove from PAR all
values < maximum. Reduce configuration space accordingly. values < maximum. Reduce configuration space accordingly.
Return the maximum. Return the maximum.
*/ */
int snd_pcm_hw_param_set_last(snd_pcm_t *pcm, int snd_pcm_hw_param_set_last(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
unsigned int *rval, int *dir) unsigned int *rval, int *dir)
@ -422,7 +422,7 @@ int _snd_pcm_hw_param_set_min(snd_pcm_hw_params_t *params,
return changed; return changed;
} }
/* Inside configuration space defined by PARAMS remove from PAR all /* Inside configuration space defined by PARAMS remove from PAR all
values < VAL. Reduce configuration space accordingly. values < VAL. Reduce configuration space accordingly.
Return new minimum or -EINVAL if the configuration space is empty Return new minimum or -EINVAL if the configuration space is empty
*/ */
@ -499,7 +499,7 @@ int _snd_pcm_hw_param_set_max(snd_pcm_hw_params_t *params,
return changed; return changed;
} }
/* Inside configuration space defined by PARAMS remove from PAR all /* Inside configuration space defined by PARAMS remove from PAR all
values >= VAL + 1. Reduce configuration space accordingly. values >= VAL + 1. Reduce configuration space accordingly.
Return new maximum or -EINVAL if the configuration space is empty Return new maximum or -EINVAL if the configuration space is empty
*/ */
@ -610,7 +610,7 @@ int _snd_pcm_hw_param_set_minmax(snd_pcm_hw_params_t *params,
return changed; return changed;
} }
/* Inside configuration space defined by PARAMS remove from PAR all /* Inside configuration space defined by PARAMS remove from PAR all
values < MIN and all values > MAX. Reduce configuration space accordingly. values < MIN and all values > MAX. Reduce configuration space accordingly.
Return 0 or -EINVAL if the configuration space is empty Return 0 or -EINVAL if the configuration space is empty
*/ */
@ -636,7 +636,7 @@ int snd_pcm_hw_param_set_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
assert(0); assert(0);
return -EINVAL; return -EINVAL;
} }
err = _snd_pcm_hw_param_set_minmax(params, var, err = _snd_pcm_hw_param_set_minmax(params, var,
*min, mindir ? *mindir : 0, *min, mindir ? *mindir : 0,
*max, maxdir ? *maxdir : 0); *max, maxdir ? *maxdir : 0);
if (err < 0) if (err < 0)
@ -707,7 +707,7 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params,
return changed; return changed;
} }
/* Inside configuration space defined by PARAMS remove from PAR all /* Inside configuration space defined by PARAMS remove from PAR all
values != VAL. Reduce configuration space accordingly. values != VAL. Reduce configuration space accordingly.
Return -EINVAL if the configuration space is empty Return -EINVAL if the configuration space is empty
*/ */
@ -845,7 +845,7 @@ int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
dump_hw_params(params, "set_near", var, *val, err); dump_hw_params(params, "set_near", var, *val, err);
return err; return err;
} }
if (err >= 0) { if (err >= 0) {
snd_pcm_hw_params_t params1; snd_pcm_hw_params_t params1;
if (min == saved_min && mindir == valdir) if (min == saved_min && mindir == valdir)
@ -887,7 +887,7 @@ int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
Return the value found. Return the value found.
*/ */
int snd_pcm_hw_param_set_next(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int snd_pcm_hw_param_set_next(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
unsigned int best, int bestdir, unsigned int best, int bestdir,
unsigned int val, int *dir) unsigned int val, int *dir)
{ {
@ -1110,7 +1110,7 @@ static int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
if (err >= 0) if (err >= 0)
err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, &max, &dir); err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, &max, &dir);
if (err >= 0 && (long)min < pcm->minperiodtime && if (err >= 0 && (long)min < pcm->minperiodtime &&
(long)max > pcm->minperiodtime) { (long)max > pcm->minperiodtime) {
min = pcm->minperiodtime; dir = 1; min = pcm->minperiodtime; dir = 1;
snd_pcm_hw_param_set_min(pcm, params, SND_CHANGE, SND_PCM_HW_PARAM_PERIOD_TIME, &min, &dir); snd_pcm_hw_param_set_min(pcm, params, SND_CHANGE, SND_PCM_HW_PARAM_PERIOD_TIME, &min, &dir);
} }
@ -1187,7 +1187,7 @@ int _snd_pcm_hw_param_refine(snd_pcm_hw_params_t *params,
} }
return changed; return changed;
} }
#if 0 #if 0
static void _snd_pcm_hw_param_copy(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, static void _snd_pcm_hw_param_copy(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
const snd_pcm_hw_params_t *src) const snd_pcm_hw_params_t *src)
@ -1474,7 +1474,7 @@ unsigned int snd_pcm_hw_strategy_simple_near_min_badness(const snd_pcm_hw_params
diff = -diff; diff = -diff;
return diff * p->mul; return diff * p->mul;
} }
int snd_pcm_hw_strategy_simple_near_next_value(snd_pcm_hw_params_t *params, int snd_pcm_hw_strategy_simple_near_next_value(snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
int value, int *dir, int value, int *dir,
@ -1510,7 +1510,7 @@ unsigned int snd_pcm_hw_strategy_simple_choices_min_badness(const snd_pcm_hw_par
assert(0); assert(0);
return UINT_MAX; return UINT_MAX;
} }
int snd_pcm_hw_strategy_simple_choices_next_value(snd_pcm_hw_params_t *params, int snd_pcm_hw_strategy_simple_choices_next_value(snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
int value, int *dir, int value, int *dir,
@ -1638,7 +1638,7 @@ int snd_pcm_hw_params_try_explain_failure1(snd_pcm_t *pcm,
i = *success; i = *success;
_snd_pcm_hw_param_copy(&i, var, fail); _snd_pcm_hw_param_copy(&i, var, fail);
err = snd_pcm_hw_refine(pcm, &i); err = snd_pcm_hw_refine(pcm, &i);
if (err == 0 && if (err == 0 &&
snd_pcm_hw_params_try_explain_failure1(pcm, fail, &i, depth - 1, out) < 0) snd_pcm_hw_params_try_explain_failure1(pcm, fail, &i, depth - 1, out) < 0)
continue; continue;
snd_output_printf(out, "%s: ", snd_pcm_hw_param_name(var)); snd_output_printf(out, "%s: ", snd_pcm_hw_param_name(var));
@ -1801,133 +1801,133 @@ static const snd_pcm_hw_rule_t refine_rules[] = {
.private_data = 0, .private_data = 0,
}, },
{ {
.var = SND_PCM_HW_PARAM_SAMPLE_BITS, .var = SND_PCM_HW_PARAM_SAMPLE_BITS,
.func = snd_pcm_hw_rule_sample_bits, .func = snd_pcm_hw_rule_sample_bits,
.deps = { SND_PCM_HW_PARAM_FORMAT, .deps = { SND_PCM_HW_PARAM_FORMAT,
SND_PCM_HW_PARAM_SAMPLE_BITS, -1 }, SND_PCM_HW_PARAM_SAMPLE_BITS, -1 },
.private_data = 0, .private_data = 0,
}, },
{ {
.var = SND_PCM_HW_PARAM_SAMPLE_BITS, .var = SND_PCM_HW_PARAM_SAMPLE_BITS,
.func = snd_pcm_hw_rule_div, .func = snd_pcm_hw_rule_div,
.deps = { SND_PCM_HW_PARAM_FRAME_BITS, .deps = { SND_PCM_HW_PARAM_FRAME_BITS,
SND_PCM_HW_PARAM_CHANNELS, -1 }, SND_PCM_HW_PARAM_CHANNELS, -1 },
.private_data = 0, .private_data = 0,
}, },
{ {
.var = SND_PCM_HW_PARAM_FRAME_BITS, .var = SND_PCM_HW_PARAM_FRAME_BITS,
.func = snd_pcm_hw_rule_mul, .func = snd_pcm_hw_rule_mul,
.deps = { SND_PCM_HW_PARAM_SAMPLE_BITS, .deps = { SND_PCM_HW_PARAM_SAMPLE_BITS,
SND_PCM_HW_PARAM_CHANNELS, -1 }, SND_PCM_HW_PARAM_CHANNELS, -1 },
.private_data = 0, .private_data = 0,
}, },
{ {
.var = SND_PCM_HW_PARAM_FRAME_BITS, .var = SND_PCM_HW_PARAM_FRAME_BITS,
.func = snd_pcm_hw_rule_mulkdiv, .func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_PERIOD_BYTES, .deps = { SND_PCM_HW_PARAM_PERIOD_BYTES,
SND_PCM_HW_PARAM_PERIOD_SIZE, -1 }, SND_PCM_HW_PARAM_PERIOD_SIZE, -1 },
.private_data = (void*) 8, .private_data = (void*) 8,
}, },
{ {
.var = SND_PCM_HW_PARAM_FRAME_BITS, .var = SND_PCM_HW_PARAM_FRAME_BITS,
.func = snd_pcm_hw_rule_mulkdiv, .func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_BUFFER_BYTES, .deps = { SND_PCM_HW_PARAM_BUFFER_BYTES,
SND_PCM_HW_PARAM_BUFFER_SIZE, -1 }, SND_PCM_HW_PARAM_BUFFER_SIZE, -1 },
.private_data = (void*) 8, .private_data = (void*) 8,
}, },
{ {
.var = SND_PCM_HW_PARAM_CHANNELS, .var = SND_PCM_HW_PARAM_CHANNELS,
.func = snd_pcm_hw_rule_div, .func = snd_pcm_hw_rule_div,
.deps = { SND_PCM_HW_PARAM_FRAME_BITS, .deps = { SND_PCM_HW_PARAM_FRAME_BITS,
SND_PCM_HW_PARAM_SAMPLE_BITS, -1 }, SND_PCM_HW_PARAM_SAMPLE_BITS, -1 },
.private_data = 0, .private_data = 0,
}, },
{ {
.var = SND_PCM_HW_PARAM_RATE, .var = SND_PCM_HW_PARAM_RATE,
.func = snd_pcm_hw_rule_mulkdiv, .func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_PERIOD_SIZE, .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
SND_PCM_HW_PARAM_PERIOD_TIME, -1 }, SND_PCM_HW_PARAM_PERIOD_TIME, -1 },
.private_data = (void*) 1000000, .private_data = (void*) 1000000,
}, },
{ {
.var = SND_PCM_HW_PARAM_RATE, .var = SND_PCM_HW_PARAM_RATE,
.func = snd_pcm_hw_rule_mulkdiv, .func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_BUFFER_SIZE, .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
SND_PCM_HW_PARAM_BUFFER_TIME, -1 }, SND_PCM_HW_PARAM_BUFFER_TIME, -1 },
.private_data = (void*) 1000000, .private_data = (void*) 1000000,
}, },
{ {
.var = SND_PCM_HW_PARAM_PERIODS, .var = SND_PCM_HW_PARAM_PERIODS,
.func = snd_pcm_hw_rule_div, .func = snd_pcm_hw_rule_div,
.deps = { SND_PCM_HW_PARAM_BUFFER_SIZE, .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
SND_PCM_HW_PARAM_PERIOD_SIZE, -1 }, SND_PCM_HW_PARAM_PERIOD_SIZE, -1 },
.private_data = 0, .private_data = 0,
}, },
{ {
.var = SND_PCM_HW_PARAM_PERIOD_SIZE, .var = SND_PCM_HW_PARAM_PERIOD_SIZE,
.func = snd_pcm_hw_rule_div, .func = snd_pcm_hw_rule_div,
.deps = { SND_PCM_HW_PARAM_BUFFER_SIZE, .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
SND_PCM_HW_PARAM_PERIODS, -1 }, SND_PCM_HW_PARAM_PERIODS, -1 },
.private_data = 0, .private_data = 0,
}, },
{ {
.var = SND_PCM_HW_PARAM_PERIOD_SIZE, .var = SND_PCM_HW_PARAM_PERIOD_SIZE,
.func = snd_pcm_hw_rule_mulkdiv, .func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_PERIOD_BYTES, .deps = { SND_PCM_HW_PARAM_PERIOD_BYTES,
SND_PCM_HW_PARAM_FRAME_BITS, -1 }, SND_PCM_HW_PARAM_FRAME_BITS, -1 },
.private_data = (void*) 8, .private_data = (void*) 8,
}, },
{ {
.var = SND_PCM_HW_PARAM_PERIOD_SIZE, .var = SND_PCM_HW_PARAM_PERIOD_SIZE,
.func = snd_pcm_hw_rule_muldivk, .func = snd_pcm_hw_rule_muldivk,
.deps = { SND_PCM_HW_PARAM_PERIOD_TIME, .deps = { SND_PCM_HW_PARAM_PERIOD_TIME,
SND_PCM_HW_PARAM_RATE, -1 }, SND_PCM_HW_PARAM_RATE, -1 },
.private_data = (void*) 1000000, .private_data = (void*) 1000000,
}, },
{ {
.var = SND_PCM_HW_PARAM_BUFFER_SIZE, .var = SND_PCM_HW_PARAM_BUFFER_SIZE,
.func = snd_pcm_hw_rule_mul, .func = snd_pcm_hw_rule_mul,
.deps = { SND_PCM_HW_PARAM_PERIOD_SIZE, .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
SND_PCM_HW_PARAM_PERIODS, -1 }, SND_PCM_HW_PARAM_PERIODS, -1 },
.private_data = 0, .private_data = 0,
}, },
{ {
.var = SND_PCM_HW_PARAM_BUFFER_SIZE, .var = SND_PCM_HW_PARAM_BUFFER_SIZE,
.func = snd_pcm_hw_rule_mulkdiv, .func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_BUFFER_BYTES, .deps = { SND_PCM_HW_PARAM_BUFFER_BYTES,
SND_PCM_HW_PARAM_FRAME_BITS, -1 }, SND_PCM_HW_PARAM_FRAME_BITS, -1 },
.private_data = (void*) 8, .private_data = (void*) 8,
}, },
{ {
.var = SND_PCM_HW_PARAM_BUFFER_SIZE, .var = SND_PCM_HW_PARAM_BUFFER_SIZE,
.func = snd_pcm_hw_rule_muldivk, .func = snd_pcm_hw_rule_muldivk,
.deps = { SND_PCM_HW_PARAM_BUFFER_TIME, .deps = { SND_PCM_HW_PARAM_BUFFER_TIME,
SND_PCM_HW_PARAM_RATE, -1 }, SND_PCM_HW_PARAM_RATE, -1 },
.private_data = (void*) 1000000, .private_data = (void*) 1000000,
}, },
{ {
.var = SND_PCM_HW_PARAM_PERIOD_BYTES, .var = SND_PCM_HW_PARAM_PERIOD_BYTES,
.func = snd_pcm_hw_rule_muldivk, .func = snd_pcm_hw_rule_muldivk,
.deps = { SND_PCM_HW_PARAM_PERIOD_SIZE, .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
SND_PCM_HW_PARAM_FRAME_BITS, -1 }, SND_PCM_HW_PARAM_FRAME_BITS, -1 },
.private_data = (void*) 8, .private_data = (void*) 8,
}, },
{ {
.var = SND_PCM_HW_PARAM_BUFFER_BYTES, .var = SND_PCM_HW_PARAM_BUFFER_BYTES,
.func = snd_pcm_hw_rule_muldivk, .func = snd_pcm_hw_rule_muldivk,
.deps = { SND_PCM_HW_PARAM_BUFFER_SIZE, .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
SND_PCM_HW_PARAM_FRAME_BITS, -1 }, SND_PCM_HW_PARAM_FRAME_BITS, -1 },
.private_data = (void*) 8, .private_data = (void*) 8,
}, },
{ {
.var = SND_PCM_HW_PARAM_PERIOD_TIME, .var = SND_PCM_HW_PARAM_PERIOD_TIME,
.func = snd_pcm_hw_rule_mulkdiv, .func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_PERIOD_SIZE, .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
SND_PCM_HW_PARAM_RATE, -1 }, SND_PCM_HW_PARAM_RATE, -1 },
.private_data = (void*) 1000000, .private_data = (void*) 1000000,
}, },
{ {
.var = SND_PCM_HW_PARAM_BUFFER_TIME, .var = SND_PCM_HW_PARAM_BUFFER_TIME,
.func = snd_pcm_hw_rule_mulkdiv, .func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_BUFFER_SIZE, .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
SND_PCM_HW_PARAM_RATE, -1 }, SND_PCM_HW_PARAM_RATE, -1 },
@ -2015,7 +2015,7 @@ static const snd_mask_t refine_masks[SND_PCM_HW_PARAM_LAST_MASK - SND_PCM_HW_PAR
}, },
}, },
}; };
static const snd_interval_t refine_intervals[SND_PCM_HW_PARAM_LAST_INTERVAL - SND_PCM_HW_PARAM_FIRST_INTERVAL + 1] = { static const snd_interval_t refine_intervals[SND_PCM_HW_PARAM_LAST_INTERVAL - SND_PCM_HW_PARAM_FIRST_INTERVAL + 1] = {
[SND_PCM_HW_PARAM_SAMPLE_BITS - SND_PCM_HW_PARAM_FIRST_INTERVAL] = { [SND_PCM_HW_PARAM_SAMPLE_BITS - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
.min = 1, .max = UINT_MAX, .min = 1, .max = UINT_MAX,
@ -2433,14 +2433,14 @@ int _snd_pcm_hw_params_internal(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
min_align *= 2; min_align *= 2;
} }
pcm->min_align = min_align; pcm->min_align = min_align;
pcm->hw_flags = params->flags; pcm->hw_flags = params->flags;
pcm->info = params->info; pcm->info = params->info;
pcm->msbits = params->msbits; pcm->msbits = params->msbits;
pcm->rate_num = params->rate_num; pcm->rate_num = params->rate_num;
pcm->rate_den = params->rate_den; pcm->rate_den = params->rate_den;
pcm->fifo_size = params->fifo_size; pcm->fifo_size = params->fifo_size;
/* Default sw params */ /* Default sw params */
memset(&sw, 0, sizeof(sw)); memset(&sw, 0, sizeof(sw));
err = snd_pcm_sw_params_default(pcm, &sw); err = snd_pcm_sw_params_default(pcm, &sw);
@ -2450,7 +2450,7 @@ int _snd_pcm_hw_params_internal(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
if (err < 0) if (err < 0)
return err; return err;
if (pcm->mmap_rw || if (pcm->mmap_rw ||
pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED || pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
pcm->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED || pcm->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED ||
pcm->access == SND_PCM_ACCESS_MMAP_COMPLEX) { pcm->access == SND_PCM_ACCESS_MMAP_COMPLEX) {

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
@ -85,7 +85,7 @@ static int snd_pcm_plug_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
snd_pcm_plug_t *plug = pcm->private_data; snd_pcm_plug_t *plug = pcm->private_data;
snd_pcm_t *slave = plug->req_slave; snd_pcm_t *slave = plug->req_slave;
int err; int err;
if ((err = snd_pcm_info(slave, info)) < 0) if ((err = snd_pcm_info(slave, info)) < 0)
return err; return err;
return 0; return 0;
@ -743,7 +743,7 @@ static int snd_pcm_plug_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *
{ {
snd_pcm_plug_t *plug = pcm->private_data; snd_pcm_plug_t *plug = pcm->private_data;
int err; int err;
_snd_pcm_hw_params_any(sparams); _snd_pcm_hw_params_any(sparams);
if (plug->sformat >= 0) { if (plug->sformat >= 0) {
_snd_pcm_hw_params_set_format(sparams, plug->sformat); _snd_pcm_hw_params_set_format(sparams, plug->sformat);
@ -782,7 +782,7 @@ static int check_access_change(snd_pcm_hw_params_t *cparams,
/* no mmap support - we need mmap emulation */ /* no mmap support - we need mmap emulation */
if (!snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_RW_INTERLEAVED) && if (!snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_RW_INTERLEAVED) &&
!snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_RW_NONINTERLEAVED)) !snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_RW_NONINTERLEAVED))
return -EINVAL; /* even no RW access? no way! */ return -EINVAL; /* even no RW access? no way! */
cmask = (const snd_pcm_access_mask_t *) cmask = (const snd_pcm_access_mask_t *)
@ -832,7 +832,7 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
if (err < 0) if (err < 0)
return err; return err;
} }
if (plug->schannels == -2 || (pcm->mode & SND_PCM_NO_AUTO_CHANNELS)) if (plug->schannels == -2 || (pcm->mode & SND_PCM_NO_AUTO_CHANNELS))
links |= SND_PCM_HW_PARBIT_CHANNELS; links |= SND_PCM_HW_PARBIT_CHANNELS;
else { else {
@ -909,7 +909,7 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
return err; return err;
return 0; return 0;
} }
static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams) snd_pcm_hw_params_t *sparams)
@ -964,8 +964,8 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
} }
return -EINVAL; return -EINVAL;
} }
err = _snd_pcm_hw_param_set_mask(params, err = _snd_pcm_hw_param_set_mask(params,
SND_PCM_HW_PARAM_FORMAT, &fmt_mask); SND_PCM_HW_PARAM_FORMAT, &fmt_mask);
if (err < 0) if (err < 0)
return err; return err;
@ -978,7 +978,7 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
else { else {
unsigned int rate_min, srate_min; unsigned int rate_min, srate_min;
int rate_mindir, srate_mindir; int rate_mindir, srate_mindir;
/* This is a temporary hack, waiting for a better solution */ /* This is a temporary hack, waiting for a better solution */
err = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_min, &rate_mindir); err = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_min, &rate_mindir);
if (err < 0) if (err < 0)
@ -1172,7 +1172,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
plug->tt_ssize = tt_ssize; plug->tt_ssize = tt_ssize;
plug->tt_cused = tt_cused; plug->tt_cused = tt_cused;
plug->tt_sused = tt_sused; plug->tt_sused = tt_sused;
err = snd_pcm_new(&pcm, SND_PCM_TYPE_PLUG, name, slave->stream, slave->mode); err = snd_pcm_new(&pcm, SND_PCM_TYPE_PLUG, name, slave->stream, slave->mode);
if (err < 0) { if (err < 0) {
free(plug); free(plug);
@ -1210,17 +1210,17 @@ This plugin converts channels, rate and format on request.
\code \code
pcm.name { pcm.name {
type plug # Automatic conversion PCM type plug # Automatic conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
[format STR] # Slave format (default nearest) or "unchanged" [format STR] # Slave format (default nearest) or "unchanged"
[channels INT] # Slave channels (default nearest) or "unchanged" [channels INT] # Slave channels (default nearest) or "unchanged"
[rate INT] # Slave rate (default nearest) or "unchanged" [rate INT] # Slave rate (default nearest) or "unchanged"
} }
route_policy STR # route policy for automatic ttable generation route_policy STR # route policy for automatic ttable generation
# STR can be 'default', 'average', 'copy', 'duplicate' # STR can be 'default', 'average', 'copy', 'duplicate'
# average: result is average of input channels # average: result is average of input channels
@ -1263,7 +1263,7 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
@ -1357,7 +1357,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
} }
} }
#endif #endif
#ifdef BUILD_PCM_PLUGIN_RATE #ifdef BUILD_PCM_PLUGIN_RATE
if (! rate_converter) if (! rate_converter)
rate_converter = snd_pcm_rate_get_default_converter(root); rate_converter = snd_pcm_rate_get_default_converter(root);

View file

@ -81,7 +81,7 @@ pcm.rate44100Hz {
\endcode \endcode
*/ */
#include "pcm_local.h" #include "pcm_local.h"
#include "pcm_plugin.h" #include "pcm_plugin.h"
#include <limits.h> #include <limits.h>
@ -197,8 +197,8 @@ snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames
frames = n; frames = n;
if (frames == 0) if (frames == 0)
return 0; return 0;
sframes = frames; sframes = frames;
sframes = snd_pcm_rewind(plugin->gen.slave, sframes); sframes = snd_pcm_rewind(plugin->gen.slave, sframes);
if (sframes < 0) if (sframes < 0)
return sframes; return sframes;
@ -221,8 +221,8 @@ snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frame
frames = n; frames = n;
if (frames == 0) if (frames == 0)
return 0; return 0;
sframes = frames; sframes = frames;
sframes = INTERNAL(snd_pcm_forward)(plugin->gen.slave, sframes); sframes = INTERNAL(snd_pcm_forward)(plugin->gen.slave, sframes);
if (sframes < 0) if (sframes < 0)
return sframes; return sframes;
@ -246,7 +246,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
const snd_pcm_channel_area_t *slave_areas; const snd_pcm_channel_area_t *slave_areas;
snd_pcm_uframes_t slave_offset; snd_pcm_uframes_t slave_offset;
snd_pcm_uframes_t slave_frames = ULONG_MAX; snd_pcm_uframes_t slave_frames = ULONG_MAX;
result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames); result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
if (result < 0) { if (result < 0) {
err = result; err = result;
@ -298,13 +298,13 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
snd_pcm_uframes_t xfer = 0; snd_pcm_uframes_t xfer = 0;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
int err; int err;
while (size > 0) { while (size > 0) {
snd_pcm_uframes_t frames = size; snd_pcm_uframes_t frames = size;
const snd_pcm_channel_area_t *slave_areas; const snd_pcm_channel_area_t *slave_areas;
snd_pcm_uframes_t slave_offset; snd_pcm_uframes_t slave_offset;
snd_pcm_uframes_t slave_frames = ULONG_MAX; snd_pcm_uframes_t slave_frames = ULONG_MAX;
result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames); result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
if (result < 0) { if (result < 0) {
err = result; err = result;
@ -324,7 +324,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) { if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
snd_pcm_sframes_t res; snd_pcm_sframes_t res;
res = plugin->undo_read(slave, areas, offset, frames, slave_frames - result); res = plugin->undo_read(slave, areas, offset, frames, slave_frames - result);
if (res < 0) { if (res < 0) {
err = res; err = res;
@ -353,7 +353,7 @@ snd_pcm_plugin_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size
{ {
snd_pcm_channel_area_t areas[pcm->channels]; snd_pcm_channel_area_t areas[pcm->channels];
snd_pcm_areas_from_buf(pcm, areas, (void*)buffer); snd_pcm_areas_from_buf(pcm, areas, (void*)buffer);
return snd_pcm_write_areas(pcm, areas, 0, size, return snd_pcm_write_areas(pcm, areas, 0, size,
snd_pcm_plugin_write_areas); snd_pcm_plugin_write_areas);
} }
@ -427,7 +427,7 @@ snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm,
result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) { if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
snd_pcm_sframes_t res; snd_pcm_sframes_t res;
res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result); res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result);
if (res < 0) { if (res < 0) {
err = res; err = res;
@ -532,8 +532,8 @@ static snd_pcm_sframes_t snd_pcm_plugin_sync_hw_ptr(snd_pcm_t *pcm,
pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED && pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED)
return snd_pcm_plugin_sync_hw_ptr_capture(pcm, slave_size); return snd_pcm_plugin_sync_hw_ptr_capture(pcm, slave_size);
*pcm->hw.ptr = slave_hw_ptr; *pcm->hw.ptr = slave_hw_ptr;
return slave_size; return slave_size;
} }
static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm) static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)

View file

@ -18,16 +18,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
#include "pcm_generic.h" #include "pcm_generic.h"
typedef snd_pcm_uframes_t (*snd_pcm_slave_xfer_areas_func_t) typedef snd_pcm_uframes_t (*snd_pcm_slave_xfer_areas_func_t)
(snd_pcm_t *pcm, (snd_pcm_t *pcm,
const snd_pcm_channel_area_t *areas, const snd_pcm_channel_area_t *areas,
snd_pcm_uframes_t offset, snd_pcm_uframes_t offset,
snd_pcm_uframes_t size, snd_pcm_uframes_t size,
const snd_pcm_channel_area_t *slave_areas, const snd_pcm_channel_area_t *slave_areas,
snd_pcm_uframes_t slave_offset, snd_pcm_uframes_t slave_offset,
snd_pcm_uframes_t *slave_sizep); snd_pcm_uframes_t *slave_sizep);
typedef snd_pcm_sframes_t (*snd_pcm_slave_xfer_areas_undo_func_t) typedef snd_pcm_sframes_t (*snd_pcm_slave_xfer_areas_undo_func_t)
@ -45,7 +45,7 @@ typedef struct {
snd_pcm_slave_xfer_areas_undo_func_t undo_write; snd_pcm_slave_xfer_areas_undo_func_t undo_write;
int (*init)(snd_pcm_t *pcm); int (*init)(snd_pcm_t *pcm);
snd_pcm_uframes_t appl_ptr, hw_ptr; snd_pcm_uframes_t appl_ptr, hw_ptr;
} snd_pcm_plugin_t; } snd_pcm_plugin_t;
/* make local functions really local */ /* make local functions really local */
#define snd_pcm_plugin_init \ #define snd_pcm_plugin_init \

Some files were not shown because too many files have changed in this diff Show more