00001 #ifndef PA_HOST_H
00002 #define PA_HOST_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include "portaudio.h"
00041
00042 #ifdef __cplusplus
00043 extern "C"
00044 {
00045 #endif
00046
00047 #ifndef SUPPORT_AUDIO_CAPTURE
00048 #define SUPPORT_AUDIO_CAPTURE (1)
00049 #endif
00050
00051 #ifndef int32
00052 typedef long int32;
00053 #endif
00054 #ifndef uint32
00055 typedef unsigned long uint32;
00056 #endif
00057 #ifndef int16
00058 typedef short int16;
00059 #endif
00060 #ifndef uint16
00061 typedef unsigned short uint16;
00062 #endif
00063
00064
00065 typedef void (PortAudioConverter)(
00066 void *inputBuffer, int inputStride,
00067 void *outputBuffer, int outputStride,
00068 int numSamples );
00069
00070 #define PA_MAGIC (0x18273645)
00071
00072
00073
00074
00075
00076 typedef struct internalPortAudioStream
00077 {
00078 uint32 past_Magic;
00079
00080 uint32 past_FramesPerUserBuffer;
00081 uint32 past_NumUserBuffers;
00082 double past_SampleRate;
00083 int past_NumInputChannels;
00084 int past_NumOutputChannels;
00085 PaDeviceID past_InputDeviceID;
00086 PaDeviceID past_OutputDeviceID;
00087 PaSampleFormat past_NativeInputSampleFormat;
00088 PaSampleFormat past_InputSampleFormat;
00089 PaSampleFormat past_NativeOutputSampleFormat;
00090 PaSampleFormat past_OutputSampleFormat;
00091 void *past_DeviceData;
00092 PortAudioCallback *past_Callback;
00093 void *past_UserData;
00094 uint32 past_Flags;
00095
00096 volatile int past_IsActive;
00097 volatile int past_StopSoon;
00098 volatile int past_StopNow;
00099
00100 void *past_InputBuffer;
00101 uint32 past_InputBufferSize;
00102 void *past_OutputBuffer;
00103 uint32 past_OutputBufferSize;
00104
00105 uint32 past_NumCallbacks;
00106 PaTimestamp past_FrameCount;
00107
00108 double past_AverageInsideCount;
00109 double past_AverageTotalCount;
00110 double past_Usage;
00111 int past_IfLastExitValid;
00112
00113
00114 PortAudioConverter *past_InputConversionProc;
00115 int past_InputConversionSourceStride;
00116 int past_InputConversionTargetStride;
00117 PortAudioConverter *past_OutputConversionProc;
00118 int past_OutputConversionSourceStride;
00119 int past_OutputConversionTargetStride;
00120 }
00121 internalPortAudioStream;
00122
00123
00124
00125
00126
00127 PaError PaHost_Init( void );
00128 PaError PaHost_Term( void );
00129
00130 PaError PaHost_OpenStream( internalPortAudioStream *past );
00131 PaError PaHost_CloseStream( internalPortAudioStream *past );
00132
00133 PaError PaHost_StartOutput( internalPortAudioStream *past );
00134 PaError PaHost_StopOutput( internalPortAudioStream *past, int abort );
00135 PaError PaHost_StartInput( internalPortAudioStream *past );
00136 PaError PaHost_StopInput( internalPortAudioStream *past, int abort );
00137 PaError PaHost_StartEngine( internalPortAudioStream *past );
00138 PaError PaHost_StopEngine( internalPortAudioStream *past, int abort );
00139 PaError PaHost_StreamActive( internalPortAudioStream *past );
00140
00141 void *PaHost_AllocateFastMemory( long numBytes );
00142 void PaHost_FreeFastMemory( void *addr, long numBytes );
00143
00144
00145 PaError PaHost_ValidateSampleRate( PaDeviceID id, double requestedFrameRate,
00146 double *closestFrameRatePtr );
00147
00148
00149
00150
00151
00152
00153 int PaHost_IsInitialized( void );
00154
00155 internalPortAudioStream* PaHost_GetStreamRepresentation( PortAudioStream *stream );
00156
00157 int PaHost_FindClosestTableEntry( double allowableError, const double *rateTable,
00158 int numRates, double frameRate );
00159
00160 long Pa_CallConvertInt16( internalPortAudioStream *past,
00161 short *nativeInputBuffer,
00162 short *nativeOutputBuffer );
00163
00164
00165
00166
00167
00168 #define PA_DITHER_BITS (15)
00169 #define PA_DITHER_SCALE (1.0f / ((1<<PA_DITHER_BITS)-1))
00170 long PaConvert_TriangularDither( void );
00171
00172 PaError PaConvert_SetupInput( internalPortAudioStream *past,
00173 PaSampleFormat nativeInputSampleFormat );
00174
00175 PaError PaConvert_SetupOutput( internalPortAudioStream *past,
00176 PaSampleFormat nativeOutputSampleFormat );
00177
00178 long PaConvert_Process( internalPortAudioStream *past,
00179 void *nativeInputBuffer,
00180 void *nativeOutputBuffer );
00181
00182 #ifdef __cplusplus
00183 }
00184 #endif
00185 #endif