PortAudio  2.0
pa_converters.h
Go to the documentation of this file.
1 #ifndef PA_CONVERTERS_H
2 #define PA_CONVERTERS_H
3 /*
4  * $Id$
5  * Portable Audio I/O Library sample conversion mechanism
6  *
7  * Based on the Open Source API proposed by Ross Bencina
8  * Copyright (c) 1999-2002 Phil Burk, Ross Bencina
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files
12  * (the "Software"), to deal in the Software without restriction,
13  * including without limitation the rights to use, copy, modify, merge,
14  * publish, distribute, sublicense, and/or sell copies of the Software,
15  * and to permit persons to whom the Software is furnished to do so,
16  * subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
25  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28  */
29 
30 /*
31  * The text above constitutes the entire PortAudio license; however,
32  * the PortAudio community also makes the following non-binding requests:
33  *
34  * Any person wishing to distribute modifications to the Software is
35  * requested to send the modifications to the original developer so that
36  * they can be incorporated into the canonical version. It is also
37  * requested that these non-binding requests be included along with the
38  * license above.
39  */
40 
49 #include "portaudio.h" /* for PaSampleFormat */
50 
51 #ifdef __cplusplus
52 extern "C"
53 {
54 #endif /* __cplusplus */
55 
56 
58 
59 
70  PaSampleFormat availableFormats, PaSampleFormat format );
71 
72 
73 /* high level conversions functions for use by implementations */
74 
75 
90 typedef void PaUtilConverter(
91  void *destinationBuffer, signed int destinationStride,
92  void *sourceBuffer, signed int sourceStride,
93  unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator );
94 
95 
108  PaSampleFormat destinationFormat, PaStreamFlags flags );
109 
110 
119 typedef void PaUtilZeroer(
120  void *destinationBuffer, signed int destinationStride, unsigned int count );
121 
122 
128 PaUtilZeroer* PaUtil_SelectZeroer( PaSampleFormat destinationFormat );
129 
130 /*----------------------------------------------------------------------------*/
131 /* low level functions and data structures which may be used for
132  substituting conversion functions */
133 
134 
138 typedef struct{
143 
148 
153 
158 
163 
173 
182 
190 
196 
202 
203  PaUtilConverter *Copy_8_To_8; /* copy without any conversion */
204  PaUtilConverter *Copy_16_To_16; /* copy without any conversion */
205  PaUtilConverter *Copy_24_To_24; /* copy without any conversion */
206  PaUtilConverter *Copy_32_To_32; /* copy without any conversion */
208 
209 
228 
229 
233 typedef struct{
234  PaUtilZeroer *ZeroU8; /* unsigned 8 bit, zero == 128 */
240 
241 
259 
260 #ifdef __cplusplus
261 }
262 #endif /* __cplusplus */
263 #endif /* PA_CONVERTERS_H */
PaUtilConverter * Int32_To_Int16_Dither
Definition: pa_converters.h:168
PaUtilConverter * Float32_To_Int8_DitherClip
Definition: pa_converters.h:157
PaUtilConverter * Int16_To_UInt8_Dither
Definition: pa_converters.h:189
PaUtilConverter * UInt8_To_Float32
Definition: pa_converters.h:197
PaUtilConverter * Int24_To_Int8_Dither
Definition: pa_converters.h:179
PaUtilConverter * Copy_8_To_8
Definition: pa_converters.h:203
PaUtilConverter * Int16_To_Int24
Definition: pa_converters.h:185
PaUtilConverter * Int32_To_UInt8
Definition: pa_converters.h:171
PaUtilConverter * Int32_To_UInt8_Dither
Definition: pa_converters.h:172
PaUtilZeroer * PaUtil_SelectZeroer(PaSampleFormat destinationFormat)
Definition: pa_converters.c:1857
PaUtilConverter * PaUtil_SelectConverter(PaSampleFormat sourceFormat, PaSampleFormat destinationFormat, PaStreamFlags flags)
Definition: pa_converters.c:178
PaUtilConverter * Int32_To_Int8
Definition: pa_converters.h:169
PaUtilConverter * Int24_To_Int32
Definition: pa_converters.h:175
PaUtilConverter * Int32_To_Float32
Definition: pa_converters.h:164
PaUtilConverter * Int32_To_Int16
Definition: pa_converters.h:167
PaUtilZeroer * Zero16
Definition: pa_converters.h:236
PaUtilConverterTable paConverters
Definition: pa_converters.c:1780
PaUtilConverter * Int16_To_Int8_Dither
Definition: pa_converters.h:187
PaUtilConverter * Copy_32_To_32
Definition: pa_converters.h:206
PaUtilConverter * Int8_To_Int32
Definition: pa_converters.h:192
PaUtilConverter * Float32_To_Int24_Clip
Definition: pa_converters.h:146
PaUtilConverter * Float32_To_Int32_Dither
Definition: pa_converters.h:140
PaUtilConverter * Int24_To_UInt8
Definition: pa_converters.h:180
PaUtilConverter * Float32_To_Int32
Definition: pa_converters.h:139
PaUtilConverter * Int32_To_Int24
Definition: pa_converters.h:165
PaUtilConverter * Float32_To_Int16_Dither
Definition: pa_converters.h:150
PaUtilConverter * Int24_To_Int8
Definition: pa_converters.h:178
PaUtilConverter * Copy_16_To_16
Definition: pa_converters.h:204
PaUtilConverter * Int16_To_Int8
Definition: pa_converters.h:186
PaUtilConverter * Int24_To_Int16_Dither
Definition: pa_converters.h:177
The portable PortAudio API.
PaUtilZeroerTable paZeroers
Definition: pa_converters.c:1973
PaUtilConverter * UInt8_To_Int8
Definition: pa_converters.h:201
PaUtilZeroer * Zero8
Definition: pa_converters.h:235
PaUtilConverter * Float32_To_Int16
Definition: pa_converters.h:149
void PaUtilConverter(void *destinationBuffer, signed int destinationStride, void *sourceBuffer, signed int sourceStride, unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator)
Definition: pa_converters.h:90
PaUtilConverter * Int24_To_UInt8_Dither
Definition: pa_converters.h:181
PaUtilConverter * Int16_To_Int32
Definition: pa_converters.h:184
PaUtilConverter * Int16_To_UInt8
Definition: pa_converters.h:188
PaUtilConverter * Int24_To_Float32
Definition: pa_converters.h:174
PaUtilConverter * Float32_To_Int24_DitherClip
Definition: pa_converters.h:147
PaUtilConverter * Float32_To_Int24
Definition: pa_converters.h:144
PaUtilConverter * Int8_To_Int24
Definition: pa_converters.h:193
PaUtilConverter * Int24_To_Int16
Definition: pa_converters.h:176
unsigned long PaStreamFlags
Definition: portaudio.h:653
PaUtilConverter * Float32_To_Int8_Clip
Definition: pa_converters.h:156
PaUtilConverter * Float32_To_UInt8_DitherClip
Definition: pa_converters.h:162
PaUtilConverter * Float32_To_UInt8
Definition: pa_converters.h:159
PaUtilConverter * Float32_To_Int32_DitherClip
Definition: pa_converters.h:142
PaUtilConverter * Int16_To_Float32
Definition: pa_converters.h:183
PaUtilConverter * Float32_To_Int8
Definition: pa_converters.h:154
PaUtilConverter * Float32_To_UInt8_Dither
Definition: pa_converters.h:160
PaUtilConverter * Int32_To_Int8_Dither
Definition: pa_converters.h:170
PaUtilZeroer * ZeroU8
Definition: pa_converters.h:234
PaUtilConverter * Int8_To_Float32
Definition: pa_converters.h:191
PaSampleFormat PaUtil_SelectClosestAvailableFormat(PaSampleFormat availableFormats, PaSampleFormat format)
Definition: pa_converters.c:70
PaUtilConverter * Float32_To_UInt8_Clip
Definition: pa_converters.h:161
PaUtilConverter * Float32_To_Int32_Clip
Definition: pa_converters.h:141
unsigned long PaSampleFormat
Definition: portaudio.h:484
PaUtilZeroer * Zero24
Definition: pa_converters.h:237
Definition: pa_converters.h:138
PaUtilConverter * Float32_To_Int8_Dither
Definition: pa_converters.h:155
PaUtilConverter * Copy_24_To_24
Definition: pa_converters.h:205
PaUtilConverter * UInt8_To_Int32
Definition: pa_converters.h:198
PaUtilConverter * UInt8_To_Int16
Definition: pa_converters.h:200
PaUtilZeroer * Zero32
Definition: pa_converters.h:238
PaUtilConverter * Int8_To_Int16
Definition: pa_converters.h:194
PaUtilConverter * Int32_To_Int24_Dither
Definition: pa_converters.h:166
PaUtilConverter * Float32_To_Int16_DitherClip
Definition: pa_converters.h:152
PaUtilConverter * Int8_To_UInt8
Definition: pa_converters.h:195
State needed to generate a dither signal.
Definition: pa_dither.h:61
void PaUtilZeroer(void *destinationBuffer, signed int destinationStride, unsigned int count)
Definition: pa_converters.h:119
PaUtilConverter * Float32_To_Int16_Clip
Definition: pa_converters.h:151
Definition: pa_converters.h:233
PaUtilConverter * UInt8_To_Int24
Definition: pa_converters.h:199
PaUtilConverter * Float32_To_Int24_Dither
Definition: pa_converters.h:145