Lines Matching defs:*
2 * PCM - Common plugin code
3 * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
6 * This library is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "iatomic.h"
23 #include "pcm_generic.h"
25 typedef snd_pcm_uframes_t (*snd_pcm_slave_xfer_areas_func_t)
26 (snd_pcm_t *pcm,
27 const snd_pcm_channel_area_t *areas,
28 snd_pcm_uframes_t offset,
29 snd_pcm_uframes_t size,
30 const snd_pcm_channel_area_t *slave_areas,
31 snd_pcm_uframes_t slave_offset,
32 snd_pcm_uframes_t *slave_sizep);
34 typedef snd_pcm_sframes_t (*snd_pcm_slave_xfer_areas_undo_func_t)
35 (snd_pcm_t *pcm,
36 const snd_pcm_channel_area_t *res_areas, /* result areas */
37 snd_pcm_uframes_t res_offset, /* offset of result areas */
38 snd_pcm_uframes_t res_size, /* size of result areas */
39 snd_pcm_uframes_t slave_undo_size);
41 typedef struct {
42 snd_pcm_generic_t gen;
43 snd_pcm_slave_xfer_areas_func_t read;
44 snd_pcm_slave_xfer_areas_func_t write;
45 snd_pcm_slave_xfer_areas_undo_func_t undo_read;
46 snd_pcm_slave_xfer_areas_undo_func_t undo_write;
47 int (*init)(snd_pcm_t *pcm);
48 snd_pcm_uframes_t appl_ptr, hw_ptr;
49 snd_atomic_write_t watom;
50 } snd_pcm_plugin_t;
52 /* make local functions really local */
53 #define snd_pcm_plugin_init \
54 snd1_pcm_plugin_init
55 #define snd_pcm_plugin_fast_ops \
56 snd1_pcm_plugin_fast_ops
57 #define snd_pcm_plugin_undo_read_generic \
58 snd1_pcm_plugin_undo_read_generic
59 #define snd_pcm_plugin_undo_write_generic \
60 snd1_pcm_plugin_undo_write_generic
62 void snd_pcm_plugin_init(snd_pcm_plugin_t *plugin);
64 extern const snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops;
66 snd_pcm_sframes_t snd_pcm_plugin_undo_read_generic
67 (snd_pcm_t *pcm,
68 const snd_pcm_channel_area_t *res_areas, /* result areas */
69 snd_pcm_uframes_t res_offset, /* offset of result areas */
70 snd_pcm_uframes_t res_size, /* size of result areas */
71 snd_pcm_uframes_t slave_undo_size);
73 snd_pcm_sframes_t snd_pcm_plugin_undo_write_generic
74 (snd_pcm_t *pcm,
75 const snd_pcm_channel_area_t *res_areas, /* result areas */
76 snd_pcm_uframes_t res_offset, /* offset of result areas */
77 snd_pcm_uframes_t res_size, /* size of result areas */
78 snd_pcm_uframes_t slave_undo_size);
80 /* make local functions really local */
81 #define snd_pcm_linear_get_index snd1_pcm_linear_get_index
82 #define snd_pcm_linear_put_index snd1_pcm_linear_put_index
83 #define snd_pcm_linear_get32_index snd1_pcm_linear_get32_index
84 #define snd_pcm_linear_put32_index snd1_pcm_linear_put32_index
85 #define snd_pcm_linear_convert_index snd1_pcm_linear_convert_index
86 #define snd_pcm_linear_convert snd1_pcm_linear_convert
87 #define snd_pcm_linear_getput snd1_pcm_linear_getput
88 #define snd_pcm_alaw_decode snd1_pcm_alaw_decode
89 #define snd_pcm_alaw_encode snd1_pcm_alaw_encode
90 #define snd_pcm_mulaw_decode snd1_pcm_mulaw_decode
91 #define snd_pcm_mulaw_encode snd1_pcm_mulaw_encode
92 #define snd_pcm_adpcm_decode snd1_pcm_adpcm_decode
93 #define snd_pcm_adpcm_encode snd1_pcm_adpcm_encode
95 int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
96 int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
97 int snd_pcm_linear_get32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
98 int snd_pcm_linear_put32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
99 int snd_pcm_linear_convert_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
101 void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
102 const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
103 unsigned int channels, snd_pcm_uframes_t frames,
104 unsigned int convidx);
105 void snd_pcm_linear_getput(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
106 const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
107 unsigned int channels, snd_pcm_uframes_t frames,
108 unsigned int get_idx, unsigned int put_idx);
109 void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *dst_areas,
110 snd_pcm_uframes_t dst_offset,
111 const snd_pcm_channel_area_t *src_areas,
112 snd_pcm_uframes_t src_offset,
113 unsigned int channels, snd_pcm_uframes_t frames,
114 unsigned int putidx);
115 void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *dst_areas,
116 snd_pcm_uframes_t dst_offset,
117 const snd_pcm_channel_area_t *src_areas,
118 snd_pcm_uframes_t src_offset,
119 unsigned int channels, snd_pcm_uframes_t frames,
120 unsigned int getidx);
121 void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *dst_areas,
122 snd_pcm_uframes_t dst_offset,
123 const snd_pcm_channel_area_t *src_areas,
124 snd_pcm_uframes_t src_offset,
125 unsigned int channels, snd_pcm_uframes_t frames,
126 unsigned int putidx);
127 void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *dst_areas,
128 snd_pcm_uframes_t dst_offset,
129 const snd_pcm_channel_area_t *src_areas,
130 snd_pcm_uframes_t src_offset,
131 unsigned int channels, snd_pcm_uframes_t frames,
132 unsigned int getidx);
134 typedef struct _snd_pcm_adpcm_state {
135 int pred_val; /* Calculated predicted value */
136 int step_idx; /* Previous StepSize lookup index */
137 } snd_pcm_adpcm_state_t;
139 void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *dst_areas,
140 snd_pcm_uframes_t dst_offset,
141 const snd_pcm_channel_area_t *src_areas,
142 snd_pcm_uframes_t src_offset,
143 unsigned int channels, snd_pcm_uframes_t frames,
144 unsigned int putidx,
145 snd_pcm_adpcm_state_t *states);
146 void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *dst_areas,
147 snd_pcm_uframes_t dst_offset,
148 const snd_pcm_channel_area_t *src_areas,
149 snd_pcm_uframes_t src_offset,
150 unsigned int channels, snd_pcm_uframes_t frames,
151 unsigned int getidx,
152 snd_pcm_adpcm_state_t *states);