Navit SVN

/work/compile/navit/src/navit/support/espeak/portaudio19.h

Go to the documentation of this file.
00001 // NOTE: Copy this file to  portaudio.h  in order to compile with V19 portaudio
00002 
00003 #ifndef PORTAUDIO_H
00004 #define PORTAUDIO_H
00005 /*
00006  * $Id: portaudio.h 1061 2006-06-19 22:46:41Z lschwardt $
00007  * PortAudio Portable Real-Time Audio Library
00008  * PortAudio API Header File
00009  * Latest version available at: http://www.portaudio.com/
00010  *
00011  * Copyright (c) 1999-2002 Ross Bencina and Phil Burk
00012  *
00013  * Permission is hereby granted, free of charge, to any person obtaining
00014  * a copy of this software and associated documentation files
00015  * (the "Software"), to deal in the Software without restriction,
00016  * including without limitation the rights to use, copy, modify, merge,
00017  * publish, distribute, sublicense, and/or sell copies of the Software,
00018  * and to permit persons to whom the Software is furnished to do so,
00019  * subject to the following conditions:
00020  *
00021  * The above copyright notice and this permission notice shall be
00022  * included in all copies or substantial portions of the Software.
00023  *
00024  * Any person wishing to distribute modifications to the Software is
00025  * requested to send the modifications to the original developer so that
00026  * they can be incorporated into the canonical version.
00027  *
00028  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00031  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
00032  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00033  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  */
00036 
00042 #ifdef __cplusplus
00043 extern "C"
00044 {
00045 #endif /* __cplusplus */
00046 
00047  
00051 int Pa_GetVersion( void );
00052 
00053 
00057 const char* Pa_GetVersionText( void );
00058 
00059 
00064 typedef int PaError;
00065 typedef enum PaErrorCode
00066 {
00067     paNoError = 0,
00068 
00069     paNotInitialized = -10000,
00070     paUnanticipatedHostError,
00071     paInvalidChannelCount,
00072     paInvalidSampleRate,
00073     paInvalidDevice,
00074     paInvalidFlag,
00075     paSampleFormatNotSupported,
00076     paBadIODeviceCombination,
00077     paInsufficientMemory,
00078     paBufferTooBig,
00079     paBufferTooSmall,
00080     paNullCallback,
00081     paBadStreamPtr,
00082     paTimedOut,
00083     paInternalError,
00084     paDeviceUnavailable,
00085     paIncompatibleHostApiSpecificStreamInfo,
00086     paStreamIsStopped,
00087     paStreamIsNotStopped,
00088     paInputOverflowed,
00089     paOutputUnderflowed,
00090     paHostApiNotFound,
00091     paInvalidHostApi,
00092     paCanNotReadFromACallbackStream,      
00093     paCanNotWriteToACallbackStream,       
00094     paCanNotReadFromAnOutputOnlyStream,   
00095     paCanNotWriteToAnInputOnlyStream,     
00096     paIncompatibleStreamHostApi,
00097     paBadBufferPtr
00098 } PaErrorCode;
00099 
00100 
00104 const char *Pa_GetErrorText( PaError errorCode );
00105 
00106 
00125 PaError Pa_Initialize( void );
00126 
00127 
00144 PaError Pa_Terminate( void );
00145 
00146 
00147 
00154 typedef int PaDeviceIndex;
00155 
00156 
00162 #define paNoDevice ((PaDeviceIndex)-1)
00163 
00164 
00170 #define paUseHostApiSpecificDeviceSpecification ((PaDeviceIndex)-2)
00171 
00172 
00173 /* Host API enumeration mechanism */
00174 
00180 typedef int PaHostApiIndex;
00181 
00182 
00192 PaHostApiIndex Pa_GetHostApiCount( void );
00193 
00194 
00203 PaHostApiIndex Pa_GetDefaultHostApi( void );
00204 
00205 
00217 typedef enum PaHostApiTypeId
00218 {
00219     paInDevelopment=0, /* use while developing support for a new host API */
00220     paDirectSound=1,
00221     paMME=2,
00222     paASIO=3,
00223     paSoundManager=4,
00224     paCoreAudio=5,
00225     paOSS=7,
00226     paALSA=8,
00227     paAL=9,
00228     paBeOS=10,
00229     paWDMKS=11,
00230     paJACK=12,
00231     paWASAPI=13,
00232     paAudioScienceHPI=14
00233 } PaHostApiTypeId;
00234 
00235 
00238 typedef struct PaHostApiInfo
00239 {
00241     int structVersion;
00243     PaHostApiTypeId type;
00245     const char *name;
00246 
00252     int deviceCount;
00253 
00258     PaDeviceIndex defaultInputDevice;
00259 
00264     PaDeviceIndex defaultOutputDevice;
00265     
00266 } PaHostApiInfo;
00267 
00268 
00282 const PaHostApiInfo * Pa_GetHostApiInfo( PaHostApiIndex hostApi );
00283 
00284 
00300 PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type );
00301 
00302 
00324 PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex( PaHostApiIndex hostApi,
00325         int hostApiDeviceIndex );
00326 
00327 
00328 
00331 typedef struct PaHostErrorInfo{
00332     PaHostApiTypeId hostApiType;    
00333     long errorCode;                 
00334     const char *errorText;          
00335 }PaHostErrorInfo;
00336 
00337 
00351 const PaHostErrorInfo* Pa_GetLastHostErrorInfo( void );
00352 
00353 
00354 
00355 /* Device enumeration and capabilities */
00356 
00364 PaDeviceIndex Pa_GetDeviceCount( void );
00365 
00366 
00373 PaDeviceIndex Pa_GetDefaultInputDevice( void );
00374 
00375 
00391 PaDeviceIndex Pa_GetDefaultOutputDevice( void );
00392 
00393 
00400 typedef double PaTime;
00401 
00402 
00422 typedef unsigned long PaSampleFormat;
00423 
00424 
00425 #define paFloat32        ((PaSampleFormat) 0x00000001) 
00426 #define paInt32          ((PaSampleFormat) 0x00000002) 
00427 #define paInt24          ((PaSampleFormat) 0x00000004) 
00428 #define paInt16          ((PaSampleFormat) 0x00000008) 
00429 #define paInt8           ((PaSampleFormat) 0x00000010) 
00430 #define paUInt8          ((PaSampleFormat) 0x00000020) 
00431 #define paCustomFormat   ((PaSampleFormat) 0x00010000)
00433 #define paNonInterleaved ((PaSampleFormat) 0x80000000)
00434 
00438 typedef struct PaDeviceInfo
00439 {
00440     int structVersion;  /* this is struct version 2 */
00441     const char *name;
00442     PaHostApiIndex hostApi; /* note this is a host API index, not a type id*/
00443     
00444     int maxInputChannels;
00445     int maxOutputChannels;
00446 
00447     /* Default latency values for interactive performance. */
00448     PaTime defaultLowInputLatency;
00449     PaTime defaultLowOutputLatency;
00450     /* Default latency values for robust non-interactive applications (eg. playing sound files). */
00451     PaTime defaultHighInputLatency;
00452     PaTime defaultHighOutputLatency;
00453 
00454     double defaultSampleRate;
00455 } PaDeviceInfo;
00456 
00457 
00471 const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceIndex device );
00472 
00473 
00476 typedef struct PaStreamParameters
00477 {
00484     PaDeviceIndex device;
00485     
00491     int channelCount;
00492 
00497     PaSampleFormat sampleFormat;
00498 
00510     PaTime suggestedLatency;
00511 
00517     void *hostApiSpecificStreamInfo;
00518 
00519 } PaStreamParameters;
00520 
00521 
00523 #define paFormatIsSupported (0)
00524 
00547 PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters,
00548                               const PaStreamParameters *outputParameters,
00549                               double sampleRate );
00550 
00551 
00552 
00553 /* Streaming types and functions */
00554 
00555 
00573 typedef void PaStream;
00574 
00575 
00580 #define paFramesPerBufferUnspecified  (0)
00581 
00582 
00591 typedef unsigned long PaStreamFlags;
00592 
00594 #define   paNoFlag          ((PaStreamFlags) 0)
00595 
00599 #define   paClipOff         ((PaStreamFlags) 0x00000001)
00600 
00604 #define   paDitherOff       ((PaStreamFlags) 0x00000002)
00605 
00615 #define   paNeverDropInput  ((PaStreamFlags) 0x00000004)
00616 
00623 #define   paPrimeOutputBuffersUsingStreamCallback ((PaStreamFlags) 0x00000008)
00624 
00628 #define   paPlatformSpecificFlags ((PaStreamFlags)0xFFFF0000)
00629 
00633 typedef struct PaStreamCallbackTimeInfo{
00634     PaTime inputBufferAdcTime;
00635     PaTime currentTime;
00636     PaTime outputBufferDacTime;
00637 } PaStreamCallbackTimeInfo;
00638 
00639 
00646 typedef unsigned long PaStreamCallbackFlags;
00647 
00655 #define paInputUnderflow   ((PaStreamCallbackFlags) 0x00000001)
00656 
00664 #define paInputOverflow    ((PaStreamCallbackFlags) 0x00000002)
00665 
00670 #define paOutputUnderflow  ((PaStreamCallbackFlags) 0x00000004)
00671 
00675 #define paOutputOverflow   ((PaStreamCallbackFlags) 0x00000008)
00676 
00681 #define paPrimingOutput    ((PaStreamCallbackFlags) 0x00000010)
00682 
00687 typedef enum PaStreamCallbackResult
00688 {
00689     paContinue=0,
00690     paComplete=1,
00691     paAbort=2
00692 } PaStreamCallbackResult;
00693 
00694 
00739 typedef int PaStreamCallback(
00740     const void *input, void *output,
00741     unsigned long frameCount,
00742     const PaStreamCallbackTimeInfo* timeInfo,
00743     PaStreamCallbackFlags statusFlags,
00744     void *userData );
00745 
00746 
00801 PaError Pa_OpenStream( PaStream** stream,
00802                        const PaStreamParameters *inputParameters,
00803                        const PaStreamParameters *outputParameters,
00804                        double sampleRate,
00805                        unsigned long framesPerBuffer,
00806                        PaStreamFlags streamFlags,
00807                        PaStreamCallback *streamCallback,
00808                        void *userData );
00809 
00810 
00841 PaError Pa_OpenDefaultStream( PaStream** stream,
00842                               int numInputChannels,
00843                               int numOutputChannels,
00844                               PaSampleFormat sampleFormat,
00845                               double sampleRate,
00846                               unsigned long framesPerBuffer,
00847                               PaStreamCallback *streamCallback,
00848                               void *userData );
00849 
00850 
00854 PaError Pa_CloseStream( PaStream *stream );
00855 
00856 
00871 typedef void PaStreamFinishedCallback( void *userData );
00872 
00873 
00892 PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ); 
00893 
00894 
00897 PaError Pa_StartStream( PaStream *stream );
00898 
00899 
00903 PaError Pa_StopStream( PaStream *stream );
00904 
00905 
00909 PaError Pa_AbortStream( PaStream *stream );
00910 
00911 
00924 PaError Pa_IsStreamStopped( PaStream *stream );
00925 
00926 
00940 PaError Pa_IsStreamActive( PaStream *stream );
00941 
00942 
00943 
00948 typedef struct PaStreamInfo
00949 {
00951     int structVersion;
00952 
00959     PaTime inputLatency;
00960 
00967     PaTime outputLatency;
00968 
00976     double sampleRate;
00977     
00978 } PaStreamInfo;
00979 
00980 
00994 const PaStreamInfo* Pa_GetStreamInfo( PaStream *stream );
00995 
00996 
01005 PaTime Pa_GetStreamTime( PaStream *stream );
01006 
01007 
01024 double Pa_GetStreamCpuLoad( PaStream* stream );
01025 
01026 
01048 PaError Pa_ReadStream( PaStream* stream,
01049                        void *buffer,
01050                        unsigned long frames );
01051 
01052 
01075 PaError Pa_WriteStream( PaStream* stream,
01076                         const void *buffer,
01077                         unsigned long frames );
01078 
01079 
01088 signed long Pa_GetStreamReadAvailable( PaStream* stream );
01089 
01090 
01099 signed long Pa_GetStreamWriteAvailable( PaStream* stream );
01100 
01101 
01102 /* Miscellaneous utilities */
01103 
01104 
01110 PaError Pa_GetSampleSize( PaSampleFormat format );
01111 
01112 
01120 void Pa_Sleep( long msec );
01121 
01122 
01123 
01124 #ifdef __cplusplus
01125 }
01126 #endif /* __cplusplus */
01127 #endif /* PORTAUDIO_H */