aboutsummaryrefslogtreecommitdiff
path: root/pd/portaudio/pa_common
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2006-06-03 19:13:08 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2006-06-03 19:13:08 +0000
commitbeb2211b63b4b80ee07a807e5ffdd441aeea6354 (patch)
tree876eb052d5cec7755053328a470c75e0638b6b94 /pd/portaudio/pa_common
parenteb976fa09171036cbaeaabf920708b2d39c49acc (diff)
FFT package selection
Zmoelnig's multi-'$' patch big-soundfile support Patch to set open directories (openpanel, savepanel) patch to allow funny characters in extern names fixed makefile.in to support intel mac svn path=/trunk/; revision=5164
Diffstat (limited to 'pd/portaudio/pa_common')
-rw-r--r--pd/portaudio/pa_common/pa_converters.c134
-rw-r--r--pd/portaudio/pa_common/pa_dither.c7
-rw-r--r--pd/portaudio/pa_common/pa_endianness.h6
-rw-r--r--pd/portaudio/pa_common/pa_front.c19
-rw-r--r--pd/portaudio/pa_common/pa_process.c27
-rw-r--r--pd/portaudio/pa_common/pa_trace.c8
-rw-r--r--pd/portaudio/pa_common/pa_util.h4
-rw-r--r--pd/portaudio/pa_common/portaudio.h13
8 files changed, 117 insertions, 101 deletions
diff --git a/pd/portaudio/pa_common/pa_converters.c b/pd/portaudio/pa_common/pa_converters.c
index 4ee73c9a..a7e3a06c 100644
--- a/pd/portaudio/pa_common/pa_converters.c
+++ b/pd/portaudio/pa_common/pa_converters.c
@@ -1,5 +1,5 @@
/*
- * $Id: pa_converters.c,v 1.1.2.26 2004/12/11 16:32:38 aknudsen Exp $
+ * $Id: pa_converters.c,v 1.1.2.27 2005/11/02 12:14:07 rossbencina Exp $
* Portable Audio I/O Library sample conversion mechanism
*
* Based on the Open Source API proposed by Ross Bencina
@@ -325,7 +325,7 @@ static void Float32_To_Int32(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
float *src = (float*)sourceBuffer;
- signed long *dest = (signed long*)destinationBuffer;
+ PaInt32 *dest = (PaInt32*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
while( count-- )
@@ -336,7 +336,7 @@ static void Float32_To_Int32(
*dest = lrintf(scaled-0.5f);
#else
double scaled = *src * 0x7FFFFFFF;
- *dest = (signed long) scaled;
+ *dest = (PaInt32) scaled;
#endif
src += sourceStride;
@@ -352,7 +352,7 @@ static void Float32_To_Int32_Dither(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
float *src = (float*)sourceBuffer;
- signed long *dest = (signed long*)destinationBuffer;
+ PaInt32 *dest = (PaInt32*)destinationBuffer;
while( count-- )
{
@@ -366,7 +366,7 @@ static void Float32_To_Int32_Dither(
double dither = PaUtil_GenerateFloatTriangularDither( ditherGenerator );
/* use smaller scaler to prevent overflow when we add the dither */
double dithered = ((double)*src * (2147483646.0)) + dither;
- *dest = (signed long) dithered;
+ *dest = (PaInt32) dithered;
#endif
src += sourceStride;
dest += destinationStride;
@@ -381,7 +381,7 @@ static void Float32_To_Int32_Clip(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
float *src = (float*)sourceBuffer;
- signed long *dest = (signed long*)destinationBuffer;
+ PaInt32 *dest = (PaInt32*)destinationBuffer;
(void) ditherGenerator; /* unused parameter */
while( count-- )
@@ -394,7 +394,7 @@ static void Float32_To_Int32_Clip(
#else
double scaled = *src * 0x7FFFFFFF;
PA_CLIP_( scaled, -2147483648., 2147483647. );
- *dest = (signed long) scaled;
+ *dest = (PaInt32) scaled;
#endif
src += sourceStride;
@@ -410,7 +410,7 @@ static void Float32_To_Int32_DitherClip(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
float *src = (float*)sourceBuffer;
- signed long *dest = (signed long*)destinationBuffer;
+ PaInt32 *dest = (PaInt32*)destinationBuffer;
while( count-- )
{
@@ -426,7 +426,7 @@ static void Float32_To_Int32_DitherClip(
/* use smaller scaler to prevent overflow when we add the dither */
double dithered = ((double)*src * (2147483646.0)) + dither;
PA_CLIP_( dithered, -2147483648., 2147483647. );
- *dest = (signed long) dithered;
+ *dest = (PaInt32) dithered;
#endif
src += sourceStride;
@@ -443,7 +443,7 @@ static void Float32_To_Int24(
{
float *src = (float*)sourceBuffer;
unsigned char *dest = (unsigned char*)destinationBuffer;
- signed long temp;
+ PaInt32 temp;
(void) ditherGenerator; /* unused parameter */
@@ -451,7 +451,7 @@ static void Float32_To_Int24(
{
/* convert to 32 bit and drop the low 8 bits */
double scaled = *src * 0x7FFFFFFF;
- temp = (signed long) scaled;
+ temp = (PaInt32) scaled;
#if defined(PA_LITTLE_ENDIAN)
dest[0] = (unsigned char)(temp >> 8);
@@ -477,7 +477,7 @@ static void Float32_To_Int24_Dither(
{
float *src = (float*)sourceBuffer;
unsigned char *dest = (unsigned char*)destinationBuffer;
- signed long temp;
+ PaInt32 temp;
while( count-- )
{
@@ -487,7 +487,7 @@ static void Float32_To_Int24_Dither(
/* use smaller scaler to prevent overflow when we add the dither */
double dithered = ((double)*src * (2147483646.0)) + dither;
- temp = (signed long) dithered;
+ temp = (PaInt32) dithered;
#if defined(PA_LITTLE_ENDIAN)
dest[0] = (unsigned char)(temp >> 8);
@@ -513,7 +513,7 @@ static void Float32_To_Int24_Clip(
{
float *src = (float*)sourceBuffer;
unsigned char *dest = (unsigned char*)destinationBuffer;
- signed long temp;
+ PaInt32 temp;
(void) ditherGenerator; /* unused parameter */
@@ -522,7 +522,7 @@ static void Float32_To_Int24_Clip(
/* convert to 32 bit and drop the low 8 bits */
double scaled = *src * 0x7FFFFFFF;
PA_CLIP_( scaled, -2147483648., 2147483647. );
- temp = (signed long) scaled;
+ temp = (PaInt32) scaled;
#if defined(PA_LITTLE_ENDIAN)
dest[0] = (unsigned char)(temp >> 8);
@@ -548,7 +548,7 @@ static void Float32_To_Int24_DitherClip(
{
float *src = (float*)sourceBuffer;
unsigned char *dest = (unsigned char*)destinationBuffer;
- signed long temp;
+ PaInt32 temp;
while( count-- )
{
@@ -559,7 +559,7 @@ static void Float32_To_Int24_DitherClip(
double dithered = ((double)*src * (2147483646.0)) + dither;
PA_CLIP_( dithered, -2147483648., 2147483647. );
- temp = (signed long) dithered;
+ temp = (PaInt32) dithered;
#if defined(PA_LITTLE_ENDIAN)
dest[0] = (unsigned char)(temp >> 8);
@@ -584,7 +584,7 @@ static void Float32_To_Int16(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
float *src = (float*)sourceBuffer;
- signed short *dest = (signed short*)destinationBuffer;
+ PaInt16 *dest = (PaInt16*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
while( count-- )
@@ -610,7 +610,7 @@ static void Float32_To_Int16_Dither(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
float *src = (float*)sourceBuffer;
- signed short *dest = (signed short*)destinationBuffer;
+ PaInt16 *dest = (PaInt16*)destinationBuffer;
while( count-- )
{
@@ -622,7 +622,7 @@ static void Float32_To_Int16_Dither(
#ifdef PA_USE_C99_LRINTF
*dest = lrintf(dithered-0.5f);
#else
- *dest = (signed short) dithered;
+ *dest = (PaInt16) dithered;
#endif
src += sourceStride;
@@ -638,7 +638,7 @@ static void Float32_To_Int16_Clip(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
float *src = (float*)sourceBuffer;
- signed short *dest = (signed short*)destinationBuffer;
+ PaInt16 *dest = (PaInt16*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
while( count-- )
@@ -646,10 +646,10 @@ static void Float32_To_Int16_Clip(
#ifdef PA_USE_C99_LRINTF
long samp = lrintf((*src * (32767.0f)) -0.5f);
#else
- long samp = (signed long) (*src * (32767.0f));
+ long samp = (PaInt32) (*src * (32767.0f));
#endif
PA_CLIP_( samp, -0x8000, 0x7FFF );
- *dest = (signed short) samp;
+ *dest = (PaInt16) samp;
src += sourceStride;
dest += destinationStride;
@@ -664,7 +664,7 @@ static void Float32_To_Int16_DitherClip(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
float *src = (float*)sourceBuffer;
- signed short *dest = (signed short*)destinationBuffer;
+ PaInt16 *dest = (PaInt16*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
while( count-- )
@@ -673,12 +673,12 @@ static void Float32_To_Int16_DitherClip(
float dither = PaUtil_GenerateFloatTriangularDither( ditherGenerator );
/* use smaller scaler to prevent overflow when we add the dither */
float dithered = (*src * (32766.0f)) + dither;
- signed long samp = (signed long) dithered;
+ PaInt32 samp = (PaInt32) dithered;
PA_CLIP_( samp, -0x8000, 0x7FFF );
#ifdef PA_USE_C99_LRINTF
*dest = lrintf(samp-0.5f);
#else
- *dest = (signed short) samp;
+ *dest = (PaInt16) samp;
#endif
src += sourceStride;
@@ -723,7 +723,7 @@ static void Float32_To_Int8_Dither(
float dither = PaUtil_GenerateFloatTriangularDither( ditherGenerator );
/* use smaller scaler to prevent overflow when we add the dither */
float dithered = (*src * (126.0f)) + dither;
- signed long samp = (signed long) dithered;
+ PaInt32 samp = (PaInt32) dithered;
*dest = (signed char) samp;
src += sourceStride;
@@ -744,7 +744,7 @@ static void Float32_To_Int8_Clip(
while( count-- )
{
- signed long samp = (signed long)(*src * (127.0f));
+ PaInt32 samp = (PaInt32)(*src * (127.0f));
PA_CLIP_( samp, -0x80, 0x7F );
*dest = (signed char) samp;
@@ -769,7 +769,7 @@ static void Float32_To_Int8_DitherClip(
float dither = PaUtil_GenerateFloatTriangularDither( ditherGenerator );
/* use smaller scaler to prevent overflow when we add the dither */
float dithered = (*src * (126.0f)) + dither;
- signed long samp = (signed long) dithered;
+ PaInt32 samp = (PaInt32) dithered;
PA_CLIP_( samp, -0x80, 0x7F );
*dest = (signed char) samp;
@@ -866,7 +866,7 @@ static void Int32_To_Float32(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed long *src = (signed long*)sourceBuffer;
+ PaInt32 *src = (PaInt32*)sourceBuffer;
float *dest = (float*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
@@ -886,7 +886,7 @@ static void Int32_To_Int24(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed long *src = (signed long*)sourceBuffer;
+ PaInt32 *src = (PaInt32*)sourceBuffer;
unsigned char *dest = (unsigned char*)destinationBuffer;
(void) ditherGenerator; /* unused parameter */
@@ -930,13 +930,13 @@ static void Int32_To_Int16(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed long *src = (signed long*)sourceBuffer;
- signed short *dest = (signed short*)destinationBuffer;
+ PaInt32 *src = (PaInt32*)sourceBuffer;
+ PaInt16 *dest = (PaInt16*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
while( count-- )
{
- *dest = (signed short) ((*src) >> 16);
+ *dest = (PaInt16) ((*src) >> 16);
src += sourceStride;
dest += destinationStride;
@@ -950,15 +950,15 @@ static void Int32_To_Int16_Dither(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed long *src = (signed long*)sourceBuffer;
- signed short *dest = (signed short*)destinationBuffer;
- signed long dither;
+ PaInt32 *src = (PaInt32*)sourceBuffer;
+ PaInt16 *dest = (PaInt16*)destinationBuffer;
+ PaInt32 dither;
while( count-- )
{
/* REVIEW */
dither = PaUtil_Generate16BitTriangularDither( ditherGenerator );
- *dest = (signed short) ((((*src)>>1) + dither) >> 15);
+ *dest = (PaInt16) ((((*src)>>1) + dither) >> 15);
src += sourceStride;
dest += destinationStride;
@@ -972,7 +972,7 @@ static void Int32_To_Int8(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed long *src = (signed long*)sourceBuffer;
+ PaInt32 *src = (PaInt32*)sourceBuffer;
signed char *dest = (signed char*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
@@ -992,9 +992,9 @@ static void Int32_To_Int8_Dither(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed long *src = (signed long*)sourceBuffer;
+ PaInt32 *src = (PaInt32*)sourceBuffer;
signed char *dest = (signed char*)destinationBuffer;
- signed long dither;
+ PaInt32 dither;
while( count-- )
{
@@ -1014,7 +1014,7 @@ static void Int32_To_UInt8(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed long *src = (signed long*)sourceBuffer;
+ PaInt32 *src = (PaInt32*)sourceBuffer;
unsigned char *dest = (unsigned char*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
@@ -1034,7 +1034,7 @@ static void Int32_To_UInt8_Dither(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed long *src = (signed long*)sourceBuffer;
+ PaInt32 *src = (PaInt32*)sourceBuffer;
unsigned char *dest = (unsigned char*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
@@ -1056,7 +1056,7 @@ static void Int24_To_Float32(
{
unsigned char *src = (unsigned char*)sourceBuffer;
float *dest = (float*)destinationBuffer;
- signed long temp;
+ PaInt32 temp;
(void) ditherGenerator; /* unused parameter */
@@ -1088,8 +1088,8 @@ static void Int24_To_Int32(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
unsigned char *src = (unsigned char*)sourceBuffer;
- signed long *dest = (signed long*) destinationBuffer;
- signed long temp;
+ PaInt32 *dest = (PaInt32*) destinationBuffer;
+ PaInt32 temp;
(void) ditherGenerator; /* unused parameter */
@@ -1121,9 +1121,9 @@ static void Int24_To_Int16(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
unsigned char *src = (unsigned char*)sourceBuffer;
- signed short *dest = (signed short*)destinationBuffer;
+ PaInt16 *dest = (PaInt16*)destinationBuffer;
- signed short temp;
+ PaInt16 temp;
(void) ditherGenerator; /* unused parameter */
@@ -1132,12 +1132,12 @@ static void Int24_To_Int16(
#if defined(PA_LITTLE_ENDIAN)
/* src[0] is discarded */
- temp = (((signed short)src[1]));
- temp = temp | (signed short)(((signed short)src[2]) << 8);
+ temp = (((PaInt16)src[1]));
+ temp = temp | (PaInt16)(((PaInt16)src[2]) << 8);
#elif defined(PA_BIG_ENDIAN)
/* src[2] is discarded */
- temp = (signed short)(((signed short)src[0]) << 8);
- temp = temp | (((signed short)src[1]));
+ temp = (PaInt16)(((PaInt16)src[0]) << 8);
+ temp = temp | (((PaInt16)src[1]));
#endif
*dest = temp;
@@ -1262,7 +1262,7 @@ static void Int16_To_Float32(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed short *src = (signed short*)sourceBuffer;
+ PaInt16 *src = (PaInt16*)sourceBuffer;
float *dest = (float*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
@@ -1283,8 +1283,8 @@ static void Int16_To_Int32(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed short *src = (signed short*)sourceBuffer;
- signed long *dest = (signed long*)destinationBuffer;
+ PaInt16 *src = (PaInt16*)sourceBuffer;
+ PaInt32 *dest = (PaInt32*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
while( count-- )
@@ -1307,9 +1307,9 @@ static void Int16_To_Int24(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed short *src = (signed short*) sourceBuffer;
+ PaInt16 *src = (PaInt16*) sourceBuffer;
unsigned char *dest = (unsigned char*)destinationBuffer;
- signed short temp;
+ PaInt16 temp;
(void) ditherGenerator; /* unused parameter */
@@ -1339,7 +1339,7 @@ static void Int16_To_Int8(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed short *src = (signed short*)sourceBuffer;
+ PaInt16 *src = (PaInt16*)sourceBuffer;
signed char *dest = (signed char*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
@@ -1359,7 +1359,7 @@ static void Int16_To_Int8_Dither(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed short *src = (signed short*)sourceBuffer;
+ PaInt16 *src = (PaInt16*)sourceBuffer;
signed char *dest = (signed char*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
@@ -1379,7 +1379,7 @@ static void Int16_To_UInt8(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed short *src = (signed short*)sourceBuffer;
+ PaInt16 *src = (PaInt16*)sourceBuffer;
unsigned char *dest = (unsigned char*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
@@ -1399,7 +1399,7 @@ static void Int16_To_UInt8_Dither(
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- signed short *src = (signed short*)sourceBuffer;
+ PaInt16 *src = (PaInt16*)sourceBuffer;
unsigned char *dest = (unsigned char*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
@@ -1441,7 +1441,7 @@ static void Int8_To_Int32(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
signed char *src = (signed char*)sourceBuffer;
- signed long *dest = (signed long*)destinationBuffer;
+ PaInt32 *dest = (PaInt32*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
while( count-- )
@@ -1490,12 +1490,12 @@ static void Int8_To_Int16(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
signed char *src = (signed char*)sourceBuffer;
- signed short *dest = (signed short*)destinationBuffer;
+ PaInt16 *dest = (PaInt16*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
while( count-- )
{
- (*dest) = (signed short)((*src) << 8);
+ (*dest) = (PaInt16)((*src) << 8);
src += sourceStride;
dest += destinationStride;
@@ -1551,7 +1551,7 @@ static void UInt8_To_Int32(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
unsigned char *src = (unsigned char*)sourceBuffer;
- signed long *dest = (signed long*)destinationBuffer;
+ PaInt32 *dest = (PaInt32*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
while( count-- )
@@ -1600,12 +1600,12 @@ static void UInt8_To_Int16(
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
unsigned char *src = (unsigned char*)sourceBuffer;
- signed short *dest = (signed short*)destinationBuffer;
+ PaInt16 *dest = (PaInt16*)destinationBuffer;
(void)ditherGenerator; /* unused parameter */
while( count-- )
{
- (*dest) = (signed short)((*src - 128) << 8);
+ (*dest) = (PaInt16)((*src - 128) << 8);
src += sourceStride;
dest += destinationStride;
diff --git a/pd/portaudio/pa_common/pa_dither.c b/pd/portaudio/pa_common/pa_dither.c
index eb6bec38..0600db62 100644
--- a/pd/portaudio/pa_common/pa_dither.c
+++ b/pd/portaudio/pa_common/pa_dither.c
@@ -1,5 +1,5 @@
/*
- * $Id: pa_dither.c,v 1.1.2.5 2003/09/20 21:06:19 rossbencina Exp $
+ * $Id: pa_dither.c,v 1.1.2.6 2005/05/28 22:49:02 rossbencina Exp $
* Portable Audio I/O Library triangular dither generator
*
* Based on the Open Source API proposed by Ross Bencina
@@ -35,6 +35,7 @@
#include "pa_dither.h"
+#include "pa_types.h"
#define PA_DITHER_BITS_ (15)
@@ -59,7 +60,7 @@ signed long PaUtil_Generate16BitTriangularDither( PaUtilTriangularDitherGenerato
* Shift before adding to prevent overflow which would skew the distribution.
* Also shift an extra bit for the high pass filter.
*/
-#define DITHER_SHIFT_ ((32 - PA_DITHER_BITS_) + 1)
+#define DITHER_SHIFT_ ((SIZEOF_LONG*8 - PA_DITHER_BITS_) + 1)
current = (((signed long)state->randSeed1)>>DITHER_SHIFT_) +
(((signed long)state->randSeed2)>>DITHER_SHIFT_);
@@ -86,7 +87,7 @@ float PaUtil_GenerateFloatTriangularDither( PaUtilTriangularDitherGenerator *sta
* Shift before adding to prevent overflow which would skew the distribution.
* Also shift an extra bit for the high pass filter.
*/
-#define DITHER_SHIFT_ ((32 - PA_DITHER_BITS_) + 1)
+#define DITHER_SHIFT_ ((SIZEOF_LONG*8 - PA_DITHER_BITS_) + 1)
current = (((signed long)state->randSeed1)>>DITHER_SHIFT_) +
(((signed long)state->randSeed2)>>DITHER_SHIFT_);
diff --git a/pd/portaudio/pa_common/pa_endianness.h b/pd/portaudio/pa_common/pa_endianness.h
index 052bced6..cb6f8ad5 100644
--- a/pd/portaudio/pa_common/pa_endianness.h
+++ b/pd/portaudio/pa_common/pa_endianness.h
@@ -1,7 +1,7 @@
#ifndef PA_ENDIANNESS_H
#define PA_ENDIANNESS_H
/*
- * $Id: pa_endianness.h,v 1.1.2.3 2003/09/20 21:06:19 rossbencina Exp $
+ * $Id: pa_endianness.h,v 1.1.2.5 2006/02/16 16:26:07 bjornroche Exp $
* Portable Audio I/O Library current platform endianness macros
*
* Based on the Open Source API proposed by Ross Bencina
@@ -67,11 +67,13 @@ extern "C"
/* set PA_LITTLE_ENDIAN or PA_BIG_ENDIAN by testing well known platform specific defines */
- #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
+ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(LITTLE_ENDIAN) || defined(__i386) || defined(_M_IX86)
#define PA_LITTLE_ENDIAN /* win32, assume intel byte order */
#else
+
+ #define PA_BIG_ENDIAN
#endif
diff --git a/pd/portaudio/pa_common/pa_front.c b/pd/portaudio/pa_common/pa_front.c
index d61c3008..696df8b2 100644
--- a/pd/portaudio/pa_common/pa_front.c
+++ b/pd/portaudio/pa_common/pa_front.c
@@ -1,5 +1,5 @@
/*
- * $Id: pa_front.c,v 1.1.2.51 2005/02/05 15:52:12 rossbencina Exp $
+ * $Id: pa_front.c,v 1.1.2.53 2006/03/20 18:11:09 aknudsen Exp $
* Portable Audio I/O Library Multi-Host API front end
* Validate function parameters and manage multiple host APIs.
*
@@ -256,6 +256,9 @@ static PaError InitializeHostApis( void )
if( hostApis_[hostApisCount_] )
{
+ PaUtilHostApiRepresentation* hostApi = hostApis_[hostApisCount_];
+ assert( hostApi->info.defaultInputDevice < hostApi->info.deviceCount );
+ assert( hostApi->info.defaultOutputDevice < hostApi->info.deviceCount );
hostApis_[hostApisCount_]->privatePaFrontInfo.baseDeviceIndex = baseDeviceIndex;
@@ -905,8 +908,8 @@ static int SampleFormatIsValid( PaSampleFormat format )
- at least one of inputParameters & outputParmeters is valid (not NULL)
- - if inputParameters & outputParmeters are both valid, that
- inputParameters->device & outputParmeters->device both use the same host api
+ - if inputParameters & outputParameters are both valid, that
+ inputParameters->device & outputParameters->device both use the same host api
PaDeviceIndex inputParameters->device
- is within range (0 to Pa_GetDeviceCount-1) Or:
@@ -1786,11 +1789,12 @@ PaError Pa_ReadStream( PaStream* stream,
{
if( frames == 0 )
{
- result = paInternalError; /** @todo should return a different error code */
+ /* XXX: Should we not allow the implementation to signal any overflow condition? */
+ result = paNoError;
}
else if( buffer == 0 )
{
- result = paInternalError; /** @todo should return a different error code */
+ result = paBadBufferPtr;
}
else
{
@@ -1830,11 +1834,12 @@ PaError Pa_WriteStream( PaStream* stream,
{
if( frames == 0 )
{
- result = paInternalError; /** @todo should return a different error code */
+ /* XXX: Should we not allow the implementation to signal any underflow condition? */
+ result = paNoError;
}
else if( buffer == 0 )
{
- result = paInternalError; /** @todo should return a different error code */
+ result = paBadBufferPtr;
}
else
{
diff --git a/pd/portaudio/pa_common/pa_process.c b/pd/portaudio/pa_common/pa_process.c
index cf711d41..4a52165b 100644
--- a/pd/portaudio/pa_common/pa_process.c
+++ b/pd/portaudio/pa_common/pa_process.c
@@ -1,5 +1,5 @@
/*
- * $Id: pa_process.c,v 1.1.2.48 2004/12/13 09:48:43 rossbencina Exp $
+ * $Id: pa_process.c,v 1.1.2.51 2005/10/27 23:28:48 aknudsen Exp $
* Portable Audio I/O Library
* streamCallback <-> host buffer processing adapter
*
@@ -131,6 +131,14 @@ PaError PaUtil_InitializeBufferProcessor( PaUtilBufferProcessor* bp,
PaError bytesPerSample;
unsigned long tempInputBufferSize, tempOutputBufferSize;
+ if( streamFlags & paNeverDropInput )
+ {
+ /* paNeverDropInput is only valid for full-duplex callback streams, with an unspecified number of frames per buffer. */
+ if( !streamCallback || !(inputChannelCount > 0 && outputChannelCount > 0) ||
+ framesPerUserBuffer != paFramesPerBufferUnspecified )
+ return paInvalidFlag;
+ }
+
/* initialize buffer ptrs to zero so they can be freed if necessary in error */
bp->tempInputBuffer = 0;
bp->tempInputBufferPtrs = 0;
@@ -571,7 +579,8 @@ void PaUtil_SetOutputChannel( PaUtilBufferProcessor* bp,
unsigned int channel, void *data, unsigned int stride )
{
assert( channel < bp->outputChannelCount );
-
+ assert( data != NULL );
+
bp->hostOutputChannels[0][channel].data = data;
bp->hostOutputChannels[0][channel].stride = stride;
}
@@ -592,9 +601,8 @@ void PaUtil_SetInterleavedOutputChannels( PaUtilBufferProcessor* bp,
for( i=0; i< channelCount; ++i )
{
- bp->hostOutputChannels[0][channel+i].data = p;
+ PaUtil_SetOutputChannel( bp, channel + i, p, channelCount );
p += bp->bytesPerHostOutputSample;
- bp->hostOutputChannels[0][channel+i].stride = channelCount;
}
}
@@ -604,8 +612,7 @@ void PaUtil_SetNonInterleavedOutputChannel( PaUtilBufferProcessor* bp,
{
assert( channel < bp->outputChannelCount );
- bp->hostOutputChannels[0][channel].data = data;
- bp->hostOutputChannels[0][channel].stride = 1;
+ PaUtil_SetOutputChannel( bp, channel, data, 1 );
}
@@ -620,6 +627,7 @@ void PaUtil_Set2ndOutputChannel( PaUtilBufferProcessor* bp,
unsigned int channel, void *data, unsigned int stride )
{
assert( channel < bp->outputChannelCount );
+ assert( data != NULL );
bp->hostOutputChannels[1][channel].data = data;
bp->hostOutputChannels[1][channel].stride = stride;
@@ -641,9 +649,8 @@ void PaUtil_Set2ndInterleavedOutputChannels( PaUtilBufferProcessor* bp,
for( i=0; i< channelCount; ++i )
{
- bp->hostOutputChannels[1][channel+i].data = p;
+ PaUtil_Set2ndOutputChannel( bp, channel + i, p, channelCount );
p += bp->bytesPerHostOutputSample;
- bp->hostOutputChannels[1][channel+i].stride = channelCount;
}
}
@@ -653,8 +660,7 @@ void PaUtil_Set2ndNonInterleavedOutputChannel( PaUtilBufferProcessor* bp,
{
assert( channel < bp->outputChannelCount );
- bp->hostOutputChannels[1][channel].data = data;
- bp->hostOutputChannels[1][channel].stride = 1;
+ PaUtil_Set2ndOutputChannel( bp, channel, data, 1 );
}
@@ -1180,6 +1186,7 @@ static void CopyTempOutputBuffersToHostOutputBuffers( PaUtilBufferProcessor *bp)
for( i=0; i<bp->outputChannelCount; ++i )
{
+ assert( hostOutputChannels[i].data != NULL );
bp->outputConverter( hostOutputChannels[i].data,
hostOutputChannels[i].stride,
srcBytePtr, srcSampleStrideSamples,
diff --git a/pd/portaudio/pa_common/pa_trace.c b/pd/portaudio/pa_common/pa_trace.c
index 83514a05..e36329fd 100644
--- a/pd/portaudio/pa_common/pa_trace.c
+++ b/pd/portaudio/pa_common/pa_trace.c
@@ -1,5 +1,5 @@
/*
- * $Id: pa_trace.c,v 1.1.1.1.2.3 2003/09/20 21:09:15 rossbencina Exp $
+ * $Id: pa_trace.c,v 1.1.1.1.2.4 2005/11/02 12:06:44 rossbencina Exp $
* Portable Audio I/O Library Trace Facility
* Store trace information in real-time for later printing.
*
@@ -42,8 +42,8 @@
#if PA_TRACE_REALTIME_EVENTS
-static char *traceTextArray[MAX_TRACE_RECORDS];
-static int traceIntArray[MAX_TRACE_RECORDS];
+static char *traceTextArray[PA_MAX_TRACE_RECORDS];
+static int traceIntArray[PA_MAX_TRACE_RECORDS];
static int traceIndex = 0;
static int traceBlock = 0;
@@ -65,7 +65,7 @@ void PaUtil_DumpTraceMessages()
printf("%3d: %s = 0x%08X\n",
i, traceTextArray[i], traceIntArray[i] );
}
- ResetTraceMessages();
+ PaUtil_ResetTraceMessages();
fflush(stdout);
}
diff --git a/pd/portaudio/pa_common/pa_util.h b/pd/portaudio/pa_common/pa_util.h
index 149fbca3..d20badd2 100644
--- a/pd/portaudio/pa_common/pa_util.h
+++ b/pd/portaudio/pa_common/pa_util.h
@@ -1,7 +1,7 @@
#ifndef PA_UTIL_H
#define PA_UTIL_H
/*
- * $Id: pa_util.h,v 1.1.2.12 2003/09/20 21:09:55 rossbencina Exp $
+ * $Id: pa_util.h,v 1.1.2.13 2005/11/09 06:31:42 aknudsen Exp $
* Portable Audio I/O Library implementation utilities header
* common implementation utilities and interfaces
*
@@ -114,7 +114,7 @@ void PaUtil_SetLastHostErrorInfo( PaHostApiTypeId hostApiType, long errorCode,
void PaUtil_DebugPrint( const char *format, ... );
-#if (0) /* set to 1 to print debug messages */
+#ifdef PA_ENABLE_DEBUG_OUTPUT
#define PA_DEBUG(x) PaUtil_DebugPrint x ;
#else
#define PA_DEBUG(x)
diff --git a/pd/portaudio/pa_common/portaudio.h b/pd/portaudio/pa_common/portaudio.h
index 341d92c9..c5967b0b 100644
--- a/pd/portaudio/pa_common/portaudio.h
+++ b/pd/portaudio/pa_common/portaudio.h
@@ -2,7 +2,7 @@
#ifndef PORTAUDIO_H
#define PORTAUDIO_H
/*
- * $Id: portaudio.h,v 1.5.2.50 2004/12/13 11:50:40 rossbencina Exp $
+ * $Id: portaudio.h,v 1.5.2.53 2006/03/20 17:49:38 aknudsen Exp $
* PortAudio Portable Real-Time Audio Library
* PortAudio API Header File
* Latest version available at: http://www.portaudio.com/
@@ -92,7 +92,8 @@ typedef enum PaErrorCode
paCanNotWriteToACallbackStream, /**< @todo review error code name */
paCanNotReadFromAnOutputOnlyStream, /**< @todo review error code name */
paCanNotWriteToAnInputOnlyStream, /**< @todo review error code name */
- paIncompatibleStreamHostApi
+ paIncompatibleStreamHostApi,
+ paBadBufferPtr
} PaErrorCode;
@@ -247,13 +248,13 @@ typedef struct PaHostApiInfo
*/
int deviceCount;
- /** The the default input device for this host API. The value will be a
+ /** The default input device for this host API. The value will be a
device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice
if no default input device is available.
*/
PaDeviceIndex defaultInputDevice;
- /** The the default output device for this host API. The value will be a
+ /** The default output device for this host API. The value will be a
device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice
if no default output device is available.
*/
@@ -496,8 +497,8 @@ typedef struct PaStreamParameters
configure their latency based on these parameters, otherwise they may
choose the closest viable latency instead. Unless the suggested latency
is greater than the absolute upper limit for the device implementations
- shouldround the suggestedLatency up to the next practial value - ie to
- provide an equal or higher latency than suggestedLatency whereever possibe.
+ should round the suggestedLatency up to the next practial value - ie to
+ provide an equal or higher latency than suggestedLatency wherever possibe.
Actual latency values for an open stream may be retrieved using the
inputLatency and outputLatency fields of the PaStreamInfo structure
returned by Pa_GetStreamInfo().