?? portaudio.h
字號(hào):
#ifndef PORT_AUDIO_H#define PORT_AUDIO_H#ifdef __cplusplusextern "C"{#endif /* __cplusplus *//* * $Id: portaudio.h,v 1.5 2002/03/26 18:04:22 philburk Exp $ * PortAudio Portable Real-Time Audio Library * PortAudio API Header File * Latest version available at: http://www.audiomulch.com/portaudio/ * * Copyright (c) 1999-2000 Ross Bencina and Phil Burk * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */typedef int PaError;typedef enum { paNoError = 0, paHostError = -10000, paInvalidChannelCount, paInvalidSampleRate, paInvalidDeviceId, paInvalidFlag, paSampleFormatNotSupported, paBadIODeviceCombination, paInsufficientMemory, paBufferTooBig, paBufferTooSmall, paNullCallback, paBadStreamPtr, paTimedOut, paInternalError, paDeviceUnavailable} PaErrorNum;/* Pa_Initialize() is the library initialisation function - call this before using the library.*/PaError Pa_Initialize( void );/* Pa_Terminate() is the library termination function - call this after using the library.*/PaError Pa_Terminate( void );/* Pa_GetHostError() returns a host specific error code. This can be called after receiving a PortAudio error code of paHostError.*/long Pa_GetHostError( void );/* Pa_GetErrorText() translates the supplied PortAudio error number into a human readable message. */const char *Pa_GetErrorText( PaError errnum );/* Sample formats These are formats used to pass sound data between the callback and the stream. Each device has a "native" format which may be used when optimum efficiency or control over conversion is required. Formats marked "always available" are supported (emulated) by all PortAudio implementations. The floating point representation (paFloat32) uses +1.0 and -1.0 as the maximum and minimum respectively. paUInt8 is an unsigned 8 bit format where 128 is considered "ground"*/typedef unsigned long PaSampleFormat;#define paFloat32 ((PaSampleFormat) (1<<0)) /*always available*/#define paInt16 ((PaSampleFormat) (1<<1)) /*always available*/#define paInt32 ((PaSampleFormat) (1<<2)) /*always available*/#define paInt24 ((PaSampleFormat) (1<<3))#define paPackedInt24 ((PaSampleFormat) (1<<4))#define paInt8 ((PaSampleFormat) (1<<5))#define paUInt8 ((PaSampleFormat) (1<<6))#define paCustomFormat ((PaSampleFormat) (1<<16))/* Device enumeration mechanism. Device ids range from 0 to Pa_CountDevices()-1. Devices may support input, output or both.*/typedef int PaDeviceID;#define paNoDevice -1int Pa_CountDevices( void );typedef struct{ int structVersion; const char *name; int maxInputChannels; int maxOutputChannels; /* Number of discrete rates, or -1 if range supported. */ int numSampleRates; /* Array of supported sample rates, or {min,max} if range supported. */ const double *sampleRates; PaSampleFormat nativeSampleFormats;}PaDeviceInfo;/* Pa_GetDefaultInputDeviceID(), Pa_GetDefaultOutputDeviceID() return the default device ids for input and output respectively, or paNoDevice if no device is available. The result can be passed to Pa_OpenStream(). On the PC, the user can specify a default device by setting an environment variable. For example, to use device #1. set PA_RECOMMENDED_OUTPUT_DEVICE=1 The user should first determine the available device ids by using the supplied application "pa_devs".*/PaDeviceID Pa_GetDefaultInputDeviceID( void );PaDeviceID Pa_GetDefaultOutputDeviceID( void );/* Pa_GetDeviceInfo() returns a pointer to an immutable PaDeviceInfo structure for the device specified. If the device parameter is out of range the function returns NULL. PortAudio manages the memory referenced by the returned pointer, the client must not manipulate or free the memory. The pointer is only guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate().*/const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceID device );/* PaTimestamp is used to represent a continuous sample clock with arbitrary start time that can be used for syncronization. The type is used for the outTime argument to the PortAudioCallback and as the result of Pa_StreamTime()*/typedef double PaTimestamp;/* PortAudioCallback is implemented by PortAudio clients. inputBuffer and outputBuffer are arrays of interleaved samples, the format, packing and number of channels used by the buffers are determined by parameters to Pa_OpenStream() (see below). framesPerBuffer is the number of sample frames to be processed by the callback. outTime is the time in samples when the buffer(s) processed by this callback will begin being played at the audio output. See also Pa_StreamTime() userData is the value of a user supplied pointer passed to Pa_OpenStream() intended for storing synthesis data etc. return value: The callback can return a non-zero value to stop the stream. This may be useful in applications such as soundfile players where a specific duration of output is required. However, it is not necessary to utilise this mechanism as StopStream() will also terminate the stream. A callback returning a non-zero value must fill the entire outputBuffer. NOTE: None of the other stream functions may be called from within the callback function except for Pa_GetCPULoad().*/typedef int (PortAudioCallback)( void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, PaTimestamp outTime, void *userData );/* Stream flags These flags may be supplied (ored together) in the streamFlags argument to the Pa_OpenStream() function.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -