index 655fe76895ce6248ae2f5d513101fb7db274c066..2e16392f81403be4a80bb0f4eb36cce0011b03d2 100644 (file)
#define ASOUNDLIB_H
#include <sys/time.h>
+#include <stddef.h>
#if defined(__cplusplus)
extern "C" {
#define PCM_IN 0x10000000
#define PCM_MMAP 0x00000001
#define PCM_NOIRQ 0x00000002
+#define PCM_NORESTART 0x00000004 /* PCM_NORESTART - when set, calls to
+ * pcm_write for a playback stream will not
+ * attempt to restart the stream in the case
+ * of an underflow, but will return -EPIPE
+ * instead. After the first -EPIPE error, the
+ * stream is considered to be stopped, and a
+ * second call to pcm_write will attempt to
+ * restart the stream.
+ */
/* PCM runtime states */
#define PCM_STATE_OPEN 0
enum pcm_format {
PCM_FORMAT_S16_LE = 0,
PCM_FORMAT_S32_LE,
+ PCM_FORMAT_S8,
+ PCM_FORMAT_S24_LE,
PCM_FORMAT_MAX,
};
int avail_min;
};
+/* PCM parameters */
+enum pcm_param
+{
+ PCM_PARAM_SAMPLE_BITS,
+ PCM_PARAM_FRAME_BITS,
+ PCM_PARAM_CHANNELS,
+ PCM_PARAM_RATE,
+ PCM_PARAM_PERIOD_TIME,
+ PCM_PARAM_PERIOD_SIZE,
+ PCM_PARAM_PERIOD_BYTES,
+ PCM_PARAM_PERIODS,
+ PCM_PARAM_BUFFER_TIME,
+ PCM_PARAM_BUFFER_SIZE,
+ PCM_PARAM_BUFFER_BYTES,
+ PCM_PARAM_TICK_TIME,
+};
+
/* Mixer control types */
enum mixer_ctl_type {
MIXER_CTL_TYPE_BOOL,
int pcm_close(struct pcm *pcm);
int pcm_is_ready(struct pcm *pcm);
+/* Obtain the parameters for a PCM */
+struct pcm_params *pcm_params_get(unsigned int card, unsigned int device,
+ unsigned int flags);
+void pcm_params_free(struct pcm_params *pcm_params);
+unsigned int pcm_params_get_min(struct pcm_params *pcm_params,
+ enum pcm_param param);
+unsigned int pcm_params_get_max(struct pcm_params *pcm_params,
+ enum pcm_param param);
+
/* Set and get config */
int pcm_get_config(struct pcm *pcm, struct pcm_config *config);
int pcm_set_config(struct pcm *pcm, struct pcm_config *config);
int pcm_start(struct pcm *pcm);
int pcm_stop(struct pcm *pcm);
+/* Interrupt driven API */
+int pcm_wait(struct pcm *pcm, int timeout);
+
/* Change avail_min after the stream has been opened with no need to stop the stream.
* Only accepted if opened with PCM_MMAP and PCM_NOIRQ flags
*/
struct mixer_ctl *mixer_get_ctl_by_name(struct mixer *mixer, const char *name);
/* Get info about mixer controls */
-int mixer_ctl_get_name(struct mixer_ctl *ctl, char *name, unsigned int size);
+const char *mixer_ctl_get_name(struct mixer_ctl *ctl);
enum mixer_ctl_type mixer_ctl_get_type(struct mixer_ctl *ctl);
const char *mixer_ctl_get_type_string(struct mixer_ctl *ctl);
unsigned int mixer_ctl_get_num_values(struct mixer_ctl *ctl);
unsigned int mixer_ctl_get_num_enums(struct mixer_ctl *ctl);
-int mixer_ctl_get_enum_string(struct mixer_ctl *ctl, unsigned int enum_id,
- char *string, unsigned int size);
+const char *mixer_ctl_get_enum_string(struct mixer_ctl *ctl,
+ unsigned int enum_id);
/* Set and get mixer controls */
int mixer_ctl_get_percent(struct mixer_ctl *ctl, unsigned int id);
int mixer_ctl_set_percent(struct mixer_ctl *ctl, unsigned int id, int percent);
int mixer_ctl_get_value(struct mixer_ctl *ctl, unsigned int id);
+int mixer_ctl_get_array(struct mixer_ctl *ctl, void *array, size_t count);
int mixer_ctl_set_value(struct mixer_ctl *ctl, unsigned int id, int value);
+int mixer_ctl_set_array(struct mixer_ctl *ctl, const void *array, size_t count);
int mixer_ctl_set_enum_by_string(struct mixer_ctl *ctl, const char *string);
/* Determe range of integer mixer controls */