59 #ifndef __AUDIO_TINYALSA_H 60 #define __AUDIO_TINYALSA_H 65 #if defined(__cplusplus) 74 #define PCM_OUT 0x00000010 81 #define PCM_IN 0x00000020 87 #define PCM_MMAP 0x00000001 94 #define PCM_NOIRQ 0x00000002 107 #define PCM_NORESTART 0x00000004 113 #define PCM_STATE_RUNNING 0x03 118 #define PCM_STATE_XRUN 0x04 123 #define PCM_STATE_DRAINING 0x05 128 #define PCM_STATE_SUSPENDED 0x07 133 #define PCM_STATE_DISCONNECTED 0x08 201 struct pcm *
pcm_open(
unsigned int card,
unsigned int device,
unsigned int flags,
const struct pcm_config *config);
337 int pcm_writei(
struct pcm *pcm,
const void *data,
unsigned int frame_count);
349 int pcm_readi(
struct pcm *pcm,
void *data,
unsigned int frame_count);
411 int pcm_mmap_write(
struct pcm *pcm,
const void *data,
unsigned int count);
423 int pcm_mmap_read(
struct pcm *pcm,
void *data,
unsigned int count);
436 int pcm_mmap_begin(
struct pcm *pcm,
void **areas,
unsigned int *offset,
unsigned int *frames);
448 int pcm_mmap_commit(
struct pcm *pcm,
unsigned int offset,
unsigned int frames);
459 int pcm_wait(
struct pcm *pcm,
int timeout);
470 #if defined(__cplusplus) int pcm_writei(struct pcm *pcm, const void *data, unsigned int frame_count)
Writes audio samples to PCM.
struct pcm * pcm_open(unsigned int card, unsigned int device, unsigned int flags, const struct pcm_config *config)
Opens a PCM for playback or recording.
int pcm_mmap_begin(struct pcm *pcm, void **areas, unsigned int *offset, unsigned int *frames)
Application request to access a portion of direct (mmap) area.
unsigned int pcm_get_channels(const struct pcm *pcm)
Gets the channel count of the PCM.
int pcm_mmap_read(struct pcm *pcm, void *data, unsigned int count)
Reads audio samples from the PCM using the mmap buffer.
int pcm_avail_update(struct pcm *pcm)
Returns the number of frames ready to be written or read.
const char * pcm_get_error(const struct pcm *pcm)
Gets the error message for the last error that occured.
unsigned int pcm_format_to_bits(enum pcm_format format)
Determines the number of bits occupied by a pcm_format.
const struct pcm_config * pcm_get_config(const struct pcm *pcm)
Gets the PCM configuration.
int pcm_drain(struct pcm *pcm)
Stop a PCM preserving pending frames.
enum pcm_format pcm_get_format(const struct pcm *pcm)
Gets the format of the PCM.
Encapsulates the hardware and software parameters of a PCM.
unsigned int pcm_get_buffer_size(const struct pcm *pcm)
Gets the buffer size of the PCM.
int pcm_readi(struct pcm *pcm, void *data, unsigned int frame_count)
Reads audio samples from PCM.
int pcm_drop(struct pcm *pcm)
Stops a PCM. Any data present in the buffers will be dropped.
pcm_format
Audio sample format of a PCM.
int pcm_close(struct pcm *pcm)
Closes a PCM returned by pcm_open.
int pcm_prepare(struct pcm *pcm)
Prepares a PCM, if it has not been prepared already.
int pcm_mmap_write(struct pcm *pcm, const void *data, unsigned int count)
Writes audio samples to the PCM using the mmap buffer.
int pcm_get_file_descriptor(const struct pcm *pcm)
Gets the file descriptor of the PCM.
int pcm_wait(struct pcm *pcm, int timeout)
Waits for buffer to become available for mmap access.
struct pcm * pcm_open_by_name(const char *name, unsigned int flags, const struct pcm_config *config)
Opens a PCM by it's name.
int pcm_is_ready(const struct pcm *pcm)
Checks if a PCM file has been opened without error.
unsigned int pcm_frames_to_bytes(const struct pcm *pcm, unsigned int frames)
Determines how many bytes are occupied by a number of frames of a PCM.
unsigned int pcm_get_rate(const struct pcm *pcm)
Gets the sample rate of the PCM.
unsigned int pcm_bytes_to_frames(const struct pcm *pcm, unsigned int bytes)
Determines how many frames of a PCM can fit into a number of bytes.
int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames)
Application has completed the access to area requested with pcm_mmap_begin.
unsigned int pcm_get_subdevice(const struct pcm *pcm)
Gets the subdevice on which the pcm has been opened.
unsigned int period_count