aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'include/tinyalsa')
-rw-r--r--include/tinyalsa/asoundlib.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h
index 2e8c3e0..3c86c84 100644
--- a/include/tinyalsa/asoundlib.h
+++ b/include/tinyalsa/asoundlib.h
@@ -43,6 +43,19 @@ struct pcm;
43 43
44#define PCM_OUT 0x00000000 44#define PCM_OUT 0x00000000
45#define PCM_IN 0x10000000 45#define PCM_IN 0x10000000
46#define PCM_MMAP 0x00000001
47#define PCM_NOIRQ 0x00000002
48
49/* PCM runtime states */
50#define PCM_STATE_OPEN 0
51#define PCM_STATE_SETUP 1
52#define PCM_STATE_PREPARED 2
53#define PCM_STATE_RUNNING 3
54#define PCM_STATE_XRUN 4
55#define PCM_STATE_DRAINING 5
56#define PCM_STATE_PAUSED 6
57#define PCM_STATE_SUSPENDED 7
58#define PCM_STATE_DISCONNECTED 8
46 59
47/* Bit formats */ 60/* Bit formats */
48enum pcm_format { 61enum pcm_format {
@@ -99,10 +112,12 @@ int pcm_set_config(struct pcm *pcm, struct pcm_config *config);
99/* Returns a human readable reason for the last error */ 112/* Returns a human readable reason for the last error */
100const char *pcm_get_error(struct pcm *pcm); 113const char *pcm_get_error(struct pcm *pcm);
101 114
102/* Returns the buffer size (int bytes) that should be used for pcm_write. 115/* Returns the buffer size (int frames) that should be used for pcm_write.
103 * This will be 1/2 of the actual fifo size. 116 * This will be 1/2 of the actual fifo size.
104 */ 117 */
105unsigned int pcm_get_buffer_size(struct pcm *pcm); 118unsigned int pcm_get_buffer_size(struct pcm *pcm);
119unsigned int pcm_frames_to_bytes(struct pcm *pcm, unsigned int frames);
120unsigned int pcm_bytes_to_frames(struct pcm *pcm, unsigned int frames);
106 121
107/* Returns the pcm latency in ms */ 122/* Returns the pcm latency in ms */
108unsigned int pcm_get_latency(struct pcm *pcm); 123unsigned int pcm_get_latency(struct pcm *pcm);
@@ -123,6 +138,14 @@ int pcm_get_htimestamp(struct pcm *pcm, unsigned int *avail,
123int pcm_write(struct pcm *pcm, void *data, unsigned int count); 138int pcm_write(struct pcm *pcm, void *data, unsigned int count);
124int pcm_read(struct pcm *pcm, void *data, unsigned int count); 139int pcm_read(struct pcm *pcm, void *data, unsigned int count);
125 140
141/*
142 * mmap() support.
143 */
144int pcm_mmap_write(struct pcm *pcm, void *data, unsigned int count);
145int pcm_mmap_begin(struct pcm *pcm, void **areas, unsigned int *offset,
146 unsigned int *frames);
147int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames);
148
126/* Start and stop a PCM channel that doesn't transfer data */ 149/* Start and stop a PCM channel that doesn't transfer data */
127int pcm_start(struct pcm *pcm); 150int pcm_start(struct pcm *pcm);
128int pcm_stop(struct pcm *pcm); 151int pcm_stop(struct pcm *pcm);