SND_TRANSPORT_TYPE_TCP,
} snd_transport_type_t;
+#define SND_PCM_IOCTL_AVAIL _IOR('A', 0x22, sndrv_pcm_uframes_t)
#define SND_PCM_IOCTL_STATE _IO ('A', 0xf1)
#define SND_PCM_IOCTL_MMAP _IO ('A', 0xf2)
#define SND_PCM_IOCTL_MUNMAP _IO ('A', 0xf3)
snd_pcm_hw_params_t hw_params;
snd_pcm_sw_params_t sw_params;
snd_pcm_status_t status;
+ struct {
+ snd_pcm_uframes_t frames;
+ } avail;
struct {
snd_pcm_sframes_t frames;
} delay;
snd_async_callback_t callback, void *private_data);
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_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_free(snd_pcm_t *pcm);
+int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
int snd_pcm_prepare(snd_pcm_t *pcm);
int snd_pcm_reset(snd_pcm_t *pcm);
#define snd_pcm_info_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_info_t *) alloca(snd_pcm_info_sizeof()); memset(*ptr, 0, snd_pcm_info_sizeof()); } while (0)
int snd_pcm_info_malloc(snd_pcm_info_t **ptr);
void snd_pcm_info_free(snd_pcm_info_t *obj);
+void snd_pcm_info_clear(snd_pcm_info_t *obj);
void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);
unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj);
unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj);
#define snd_pcm_hw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_hw_params_t *) alloca(snd_pcm_hw_params_sizeof()); memset(*ptr, 0, snd_pcm_hw_params_sizeof()); } while (0)
int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr);
void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj);
+void snd_pcm_hw_params_clear(snd_pcm_hw_params_t *obj);
void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src);
#ifndef ALSA_LIBRARY_BUILD
* \{
*/
-int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
-
size_t snd_pcm_sw_params_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_pcm_sw_params_t using standard alloca
#define snd_pcm_sw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_sw_params_t *) alloca(snd_pcm_sw_params_sizeof()); memset(*ptr, 0, snd_pcm_sw_params_sizeof()); } while (0)
int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr);
void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj);
+void snd_pcm_sw_params_clear(snd_pcm_sw_params_t *obj);
void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src);
int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
snd_pcm_tstamp_t snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params);
#define snd_pcm_status_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_status_t *) alloca(snd_pcm_status_sizeof()); memset(*ptr, 0, snd_pcm_status_sizeof()); } while (0)
int snd_pcm_status_malloc(snd_pcm_status_t **ptr);
void snd_pcm_status_free(snd_pcm_status_t *obj);
+void snd_pcm_status_clear(snd_pcm_status_t *obj);
void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src);
snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj);
void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
int snd_interval_empty(const snd_interval_t *i);
int snd_interval_single(const snd_interval_t *i);
int snd_interval_value(const snd_interval_t *i);
+void snd_interval_set_value(snd_interval_t *i, unsigned int val);
int snd_interval_min(const snd_interval_t *i);
int snd_interval_max(const snd_interval_t *i);
int snd_interval_test(const snd_interval_t *i, unsigned int val);
return i->min;
}
+INTERVAL_INLINE void snd_interval_set_value(snd_interval_t *i, unsigned int val)
+{
+ i->openmax = i->openmin = 0;
+ i->min = i->max = val;
+ i->integer = 0;
+ i->empty = 0;
+}
+
INTERVAL_INLINE int snd_interval_min(const snd_interval_t *i)
{
assert(!snd_interval_empty(i));
return pcm->ops->info(pcm->op_arg, info);
}
+/** \brief Retreive current PCM hardware configuration chosen with #snd_pcm_hw_params
+ * \param pcm PCM handle
+ * \param params Configuration space definition container
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ unsigned int frame_bits;
+
+ assert(pcm && params);
+ if (!pcm->setup)
+ return -EBADFD;
+ snd_pcm_hw_params_clear(params);
+ snd_mask_copy(¶ms->masks[SND_PCM_HW_PARAM_ACCESS], (snd_mask_t *)&pcm->access);
+ snd_mask_copy(¶ms->masks[SND_PCM_HW_PARAM_FORMAT], (snd_mask_t *)&pcm->format);
+ snd_mask_copy(¶ms->masks[SND_PCM_HW_PARAM_SUBFORMAT], (snd_mask_t *)&pcm->subformat);
+ frame_bits = snd_pcm_format_physical_width(pcm->format) * pcm->channels;
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_FRAME_BITS], frame_bits);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_CHANNELS], pcm->channels);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_RATE], pcm->rate);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_PERIOD_TIME], pcm->period_time);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_PERIOD_SIZE], pcm->period_size);
+ snd_interval_copy(¶ms->intervals[SND_PCM_HW_PARAM_PERIODS], &pcm->periods);
+ snd_interval_copy(¶ms->intervals[SND_PCM_HW_PARAM_BUFFER_TIME], &pcm->buffer_time);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_BUFFER_SIZE], pcm->buffer_size);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_BUFFER_BYTES], (pcm->buffer_size * frame_bits) / 8);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_TICK_TIME], pcm->tick_time);
+ params->info = pcm->info;
+ params->msbits = pcm->msbits;
+ params->rate_num = pcm->rate_num;
+ params->rate_den = pcm->rate_den;
+ params->fifo_size = pcm->fifo_size;
+ return 0;
+}
+
/** \brief Install one PCM hardware configuration chosen from a configuration space and #snd_pcm_prepare it
* \param pcm PCM handle
* \param params Configuration space definition container
unsigned int rate; /* rate in Hz */
snd_pcm_uframes_t period_size;
unsigned int period_time; /* period duration */
+ snd_interval_t periods;
unsigned int tick_time;
snd_pcm_tstamp_t tstamp_mode; /* timestamp mode */
unsigned int period_step;
unsigned int rate_den; /* rate denominator */
snd_pcm_uframes_t fifo_size; /* chip FIFO size in frames */
snd_pcm_uframes_t buffer_size;
+ snd_interval_t buffer_time;
unsigned int sample_bits;
unsigned int frame_bits;
snd_pcm_rbptr_t appl;