PortAudio 2.0
|
00001 #ifndef PA_DITHER_H 00002 #define PA_DITHER_H 00003 /* 00004 * $Id: pa_dither.h 1418 2009-10-12 21:00:53Z philburk $ 00005 * Portable Audio I/O Library triangular dither generator 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 00047 #include "pa_types.h" 00048 00049 00050 #ifdef __cplusplus 00051 extern "C" 00052 { 00053 #endif /* __cplusplus */ 00054 00055 /* Note that the linear congruential algorithm requires 32 bit integers 00056 * because it uses arithmetic overflow. So use PaUint32 instead of 00057 * unsigned long so it will work on 64 bit systems. 00058 */ 00059 00061 typedef struct PaUtilTriangularDitherGenerator{ 00062 PaUint32 previous; 00063 PaUint32 randSeed1; 00064 PaUint32 randSeed2; 00065 } PaUtilTriangularDitherGenerator; 00066 00067 00069 void PaUtil_InitializeTriangularDitherState( PaUtilTriangularDitherGenerator *ditherState ); 00070 00071 00084 PaInt32 PaUtil_Generate16BitTriangularDither( PaUtilTriangularDitherGenerator *ditherState ); 00085 00086 00099 float PaUtil_GenerateFloatTriangularDither( PaUtilTriangularDitherGenerator *ditherState ); 00100 00101 00102 00103 #ifdef __cplusplus 00104 } 00105 #endif /* __cplusplus */ 00106 #endif /* PA_DITHER_H */