PortAudio 2.0

pa_converters.h

Go to the documentation of this file.
00001 #ifndef PA_CONVERTERS_H
00002 #define PA_CONVERTERS_H
00003 /*
00004  * $Id: pa_converters.h 1097 2006-08-26 08:27:53Z rossb $
00005  * Portable Audio I/O Library sample conversion mechanism
00006  *
00007  * Based on the Open Source API proposed by Ross Bencina
00008  * Copyright (c) 1999-2002 Phil Burk, Ross Bencina
00009  *
00010  * Permission is hereby granted, free of charge, to any person obtaining
00011  * a copy of this software and associated documentation files
00012  * (the "Software"), to deal in the Software without restriction,
00013  * including without limitation the rights to use, copy, modify, merge,
00014  * publish, distribute, sublicense, and/or sell copies of the Software,
00015  * and to permit persons to whom the Software is furnished to do so,
00016  * subject to the following conditions:
00017  *
00018  * The above copyright notice and this permission notice shall be
00019  * included in all copies or substantial portions of the Software.
00020  *
00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00022  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00023  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00024  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
00025  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00026  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00027  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00028  */
00029 
00030 /*
00031  * The text above constitutes the entire PortAudio license; however, 
00032  * the PortAudio community also makes the following non-binding requests:
00033  *
00034  * Any person wishing to distribute modifications to the Software is
00035  * requested to send the modifications to the original developer so that
00036  * they can be incorporated into the canonical version. It is also 
00037  * requested that these non-binding requests be included along with the 
00038  * license above.
00039  */
00040 
00049 #include "portaudio.h"  /* for PaSampleFormat */
00050 
00051 #ifdef __cplusplus
00052 extern "C"
00053 {
00054 #endif /* __cplusplus */
00055 
00056 
00057 struct PaUtilTriangularDitherGenerator;
00058 
00059 
00069 PaSampleFormat PaUtil_SelectClosestAvailableFormat(
00070         PaSampleFormat availableFormats, PaSampleFormat format );
00071 
00072 
00073 /* high level conversions functions for use by implementations */
00074 
00075 
00090 typedef void PaUtilConverter(
00091     void *destinationBuffer, signed int destinationStride,
00092     void *sourceBuffer, signed int sourceStride,
00093     unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator );
00094 
00095 
00107 PaUtilConverter* PaUtil_SelectConverter( PaSampleFormat sourceFormat,
00108         PaSampleFormat destinationFormat, PaStreamFlags flags );
00109 
00110 
00119 typedef void PaUtilZeroer(
00120     void *destinationBuffer, signed int destinationStride, unsigned int count );
00121 
00122     
00128 PaUtilZeroer* PaUtil_SelectZeroer( PaSampleFormat destinationFormat );
00129 
00130 /*----------------------------------------------------------------------------*/
00131 /* low level functions and data structures which may be used for
00132     substituting conversion functions */
00133 
00134 
00138 typedef struct{
00139     PaUtilConverter *Float32_To_Int32;
00140     PaUtilConverter *Float32_To_Int32_Dither;
00141     PaUtilConverter *Float32_To_Int32_Clip;
00142     PaUtilConverter *Float32_To_Int32_DitherClip;
00143 
00144     PaUtilConverter *Float32_To_Int24;
00145     PaUtilConverter *Float32_To_Int24_Dither;
00146     PaUtilConverter *Float32_To_Int24_Clip;
00147     PaUtilConverter *Float32_To_Int24_DitherClip;
00148     
00149     PaUtilConverter *Float32_To_Int16;
00150     PaUtilConverter *Float32_To_Int16_Dither;
00151     PaUtilConverter *Float32_To_Int16_Clip;
00152     PaUtilConverter *Float32_To_Int16_DitherClip;
00153 
00154     PaUtilConverter *Float32_To_Int8;
00155     PaUtilConverter *Float32_To_Int8_Dither;
00156     PaUtilConverter *Float32_To_Int8_Clip;
00157     PaUtilConverter *Float32_To_Int8_DitherClip;
00158 
00159     PaUtilConverter *Float32_To_UInt8;
00160     PaUtilConverter *Float32_To_UInt8_Dither;
00161     PaUtilConverter *Float32_To_UInt8_Clip;
00162     PaUtilConverter *Float32_To_UInt8_DitherClip;
00163 
00164     PaUtilConverter *Int32_To_Float32;
00165     PaUtilConverter *Int32_To_Int24;
00166     PaUtilConverter *Int32_To_Int24_Dither;
00167     PaUtilConverter *Int32_To_Int16;
00168     PaUtilConverter *Int32_To_Int16_Dither;
00169     PaUtilConverter *Int32_To_Int8;
00170     PaUtilConverter *Int32_To_Int8_Dither;
00171     PaUtilConverter *Int32_To_UInt8;
00172     PaUtilConverter *Int32_To_UInt8_Dither;
00173 
00174     PaUtilConverter *Int24_To_Float32;
00175     PaUtilConverter *Int24_To_Int32;
00176     PaUtilConverter *Int24_To_Int16;
00177     PaUtilConverter *Int24_To_Int16_Dither;
00178     PaUtilConverter *Int24_To_Int8;
00179     PaUtilConverter *Int24_To_Int8_Dither;
00180     PaUtilConverter *Int24_To_UInt8;
00181     PaUtilConverter *Int24_To_UInt8_Dither;
00182 
00183     PaUtilConverter *Int16_To_Float32;
00184     PaUtilConverter *Int16_To_Int32;
00185     PaUtilConverter *Int16_To_Int24;
00186     PaUtilConverter *Int16_To_Int8;
00187     PaUtilConverter *Int16_To_Int8_Dither;
00188     PaUtilConverter *Int16_To_UInt8;
00189     PaUtilConverter *Int16_To_UInt8_Dither;
00190 
00191     PaUtilConverter *Int8_To_Float32;
00192     PaUtilConverter *Int8_To_Int32;
00193     PaUtilConverter *Int8_To_Int24;
00194     PaUtilConverter *Int8_To_Int16;
00195     PaUtilConverter *Int8_To_UInt8;
00196     
00197     PaUtilConverter *UInt8_To_Float32;
00198     PaUtilConverter *UInt8_To_Int32;
00199     PaUtilConverter *UInt8_To_Int24;
00200     PaUtilConverter *UInt8_To_Int16;
00201     PaUtilConverter *UInt8_To_Int8;
00202 
00203     PaUtilConverter *Copy_8_To_8;       /* copy without any conversion */
00204     PaUtilConverter *Copy_16_To_16;     /* copy without any conversion */
00205     PaUtilConverter *Copy_24_To_24;     /* copy without any conversion */
00206     PaUtilConverter *Copy_32_To_32;     /* copy without any conversion */
00207 } PaUtilConverterTable;
00208 
00209 
00227 extern PaUtilConverterTable paConverters;
00228 
00229 
00233 typedef struct{
00234     PaUtilZeroer *ZeroU8; /* unsigned 8 bit, zero == 128 */
00235     PaUtilZeroer *Zero8;
00236     PaUtilZeroer *Zero16;
00237     PaUtilZeroer *Zero24;
00238     PaUtilZeroer *Zero32;
00239 } PaUtilZeroerTable;
00240 
00241 
00258 extern PaUtilZeroerTable paZeroers;
00259 
00260 #ifdef __cplusplus
00261 }
00262 #endif /* __cplusplus */
00263 #endif /* PA_CONVERTERS_H */

Generated for PortAudio by  doxygen1.7.3