From: rossbencina Date: Fri, 26 Jul 2002 19:35:31 +0000 (+0000) Subject: removed proposal documentation and changed proposals.html to document new location... X-Git-Tag: v19-devel-pre-restructure~3 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=b0d6234ae0d543f93041801b11b8d81610447de5;p=portaudio removed proposal documentation and changed proposals.html to document new location for proposals --- diff --git a/docs/PaStreamStateDiagram.gif b/docs/PaStreamStateDiagram.gif deleted file mode 100644 index d1fcae0..0000000 Binary files a/docs/PaStreamStateDiagram.gif and /dev/null differ diff --git a/docs/pa_drivermodel.c.txt b/docs/pa_drivermodel.c.txt deleted file mode 100644 index 956f664..0000000 --- a/docs/pa_drivermodel.c.txt +++ /dev/null @@ -1,488 +0,0 @@ -/* - This file contains the host-neutral code for implementing multiple driver model - support in PortAudio. - - It has not been compiled, but it is supplied only for example purposes at this stage. - - TODO: use of CHECK_DRIVER_MODEL is bogus in some instances since some - of those functions don't return a PaError - - -*/ - -#include "pa_drivermodel.h.txt" - - -#ifndef PA_MULTIDRIVER -/* single driver support, most functions will stay in the implementation files */ - -PaDriverModelID Pa_CountDriverModels() -{ - return 1; -} - -/* -Perhaps all drivers should define this with this signature -const PaDriverModelInfo* Pa_GetDriverModelInfo( PaDriverModelID driverModelID ) -{ -} -*/ - -PaDeviceID Pa_DriverModelDefaultInputDeviceID( PaDriverModelID driverModelID ) -{ - return Pa_GetDefaultInputDeviceID(); -} - - -PaDeviceID Pa_DriverModelDefaultOutputDeviceID( PaDriverModelID driverModelID ) -{ - return Pa_GetDefaultInputDeviceID(); -} - -/* -Perhaps all drivers should define with this signature -int Pa_DriverModelMinNumBuffers( PaDriverModelID driverModelID, int framesPerBuffer, double sampleRate ) -{ - -} -*/ - -int Pa_DriverModelCountDevices( PaDriverModelID driverModelID ) -{ - return Pa_CountDevices(); -} - -PaDeviceID Pa_DriverModelGetDeviceID(PaDriverModelID driverModelID, int perDriverModelIndex ) -{ - return perDriverModelIndex; -} - - -#else -/* multidriver support */ - - -typedef PaError (*PaInitializeFunPtr)( PaDriverModelImplementation** ); - -/* - the initializers array is a static table of function pointers - to all the available driverModels on the current platform. - - the order of pointers in the array is important. the first - pointer is always considered to be the "default" driver model. -*/ - -static PaInitializeFunPtr driverModelInitializers[] = { -#ifdef WINDOWS - PaWin32WMME_MultiDriverInitialize, - PaWin32DS_MultiDriverInitialize, - PaASIO_MultiDriverInitialize -#endif -#ifdef MAC - PaMacSM_MultiDriverInitialize, - PaMacCA_MultiDriverInitialize, - PaASIO_MultiDriverInitialize -#endif -/* other platforms here */ - (PaInitializeFunPtr*)0 /* NULL terminate the list */ -}; - - -/* - the driverModels array is a dynamically created table of - currently available driverModels. -*/ -static PaDriverModelImplementation* driverModels = 0; -static int numDriverModels = 0; - - -#define PA_CHECK_INITIALIZED\ - if( driverModels == 0 ) - return paLibraryNotInitialised - -#define PA_CHECK_DRIVER_MODEL_ID( id ) - if( id < 0 || id >= numDriverModels ) - return paBadDriverModelID; - - -/* - ConvertPublicDeviceIdToImplementationDeviceId converts deviceId - from a public device id, to a device id for a particular - PortAudio implementation. On return impl will either point - to a valid implementation or will be NULL. -*/ -static void ConvertPublicDeviceIDToImplementationDeviceID( - PaDriverModelImplementation *impl, PaDeviceID deviceID ) -{ - int i, count; - - impl = NULL; - - for( i=0; i < numDriverModels; ++i ){ - count = driverModels[i]->countDevices(); - if( deviceID < count ){ - impl = driverModels[i]; - return NULL; - }else{ - deviceID -= count; - } - } -} - -static PaDeviceID ConvertImplementationDeviceIDToPublicDeviceID( - PaDriverModelID driverModelID, PaDeviceID deviceID ) -{ - int i; - - for( i=0; i < driverModelID; ++i ) - deviceID += driverModels[i]->countDevices(); -} - - -PaError Pa_Initialize( void ) -{ - PaError result = paNoError; - int i, initializerCount; - PaDriverModelImplementation *impl; - - if( driverModels != 0 ) - return paAlreadyInitialized; - - /* count the number of driverModels */ - initializerCount=0; - while( driverModelInitializers[initializerCount] != 0 ){ - ++initializerCount; - } - - driverModels = malloc( sizeof(PaDriverModelImplementation*) * initializerCount ); - if( driverModels == NULL ) - return paInsufficientMemory; - - numDriverModels = 0; - for( i=0; iterminate( driverModels[i] ); -} - - -long Pa_GetHostError( void ) -{ - PA_CHECK_INITIALIZED; - - under construction. depends on error text proposal. -} - - -const char *Pa_GetErrorText( PaError errnum ) -{ - PA_CHECK_INITIALIZED; - - under construction. may need to call driver model specific code - depending on how the error text proposal pans out. -} - - - -int Pa_CountDevices() -{ - int i, result; - - PA_CHECK_INITIALIZED; - - result = 0; - for( i=0; i < numDriverModels; ++i ) - result += driverModels[i]->countDevices(); - - return result; -} - - -PaDeviceID Pa_GetDefaultInputDeviceID( void ) -{ - PA_CHECK_INITIALIZED; - - return driverModels[0]->getDefaultInputDeviceID(); -} - -PaDeviceID Pa_GetDefaultOutputDeviceID( void ) -{ - PA_CHECK_INITIALIZED; - - return driverModels[0]->getDefaultInputDeviceID(); -} - - -const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceID deviceID ) -{ - PaDriverModelImplementation *impl; - - PA_CHECK_INITIALIZED; - - ConvertPublicDeviceIDToImplementationDeviceID( impl, deviceID ); - if( impl == NULL ) - return paInvalidDeviceID; - - return impl->getDeviceInfo( deviceID ); -} - -/* NEW MULTIPLE DRIVER MODEL FUNCTIONS ---------------------------------- */ - -PaDriverModelID Pa_CountDriverModels() -{ - PA_CHECK_INITIALIZED; - - return numDriverModels; -} - - -const PaDriverModelInfo* Pa_GetDriverModelInfo( PaDriverModelID driverModelID ) -{ - PA_CHECK_INITIALIZED; - PA_CHECK_DRIVER_MODEL_ID( driverModelID ); - - return driverModels[ driverModelID ]->getDriverModelInfo(); -} - - -PaDeviceID Pa_DriverModelDefaultInputDeviceID( PaDriverModelID driverModelID ) -{ - PA_CHECK_INITIALIZED; - PA_CHECK_DRIVER_MODEL_ID( driverModelID ); - - return ConvertImplementationDeviceIDToPublicDeviceID( driverModelID, - driverModels[ driverModelID ]->getDefaultInputDeviceID(); -} - - -PaDeviceID Pa_DriverModelDefaultOutputDeviceID( PaDriverModelID driverModelID ) -{ - PA_CHECK_INITIALIZED; - PA_CHECK_DRIVER_MODEL_ID( driverModelID ); - - return ConvertImplementationDeviceIDToPublicDeviceID( driverModelID, - driverModels[ driverModelID ]->getDefaultOutputDeviceID(); -} - - -int Pa_DriverModelMinNumBuffers( PaDriverModelID driverModelID, int framesPerBuffer, double sampleRate ) -{ - PA_CHECK_INITIALIZED; - PA_CHECK_DRIVER_MODEL_ID( driverModelID ); - - return driverModels[ driverModelID ]->getMinNumBuffers( int framesPerBuffer, double sampleRate ); -} - - -int Pa_DriverModelCountDevices( PaDriverModelID driverModelID ) -{ - PA_CHECK_INITIALIZED; - PA_CHECK_DRIVER_MODEL_ID( driverModelID ); - - return driverModels[ driverModelID ]->coundDevices(); -} - -PaDeviceID Pa_DriverModelGetDeviceID(PaDriverModelID driverModelID, int perDriverModelIndex ) -{ - PA_CHECK_INITIALIZED; - PA_CHECK_DRIVER_MODEL_ID( driverModelID ); - - return ConvertImplementationDeviceIDToPublicDeviceID( driverModelID, perDriverModelIndex ); -} - -/* END NEW MULTIPLE DRIVER MODEL FUNCTIONS ------------------------------ */ - - -PaError Pa_OpenStream( PortAudioStream** stream, - PaDeviceID inputDevice, - int numInputChannels, - PaSampleFormat inputSampleFormat, - void *inputDriverInfo, - PaDeviceID outputDevice, - int numOutputChannels, - PaSampleFormat outputSampleFormat, - void *outputDriverInfo, - double sampleRate, - unsigned long framesPerBuffer, - unsigned long numberOfBuffers, - PaStreamFlags streamFlags, - PortAudioCallback *callback, - void *userData ) -{ - PaError result; - PaDriverModelImplementation *inputImpl, *outputImpl, impl; - - PA_CHECK_INITIALIZED; - - if( inputDevice != paNoDevice ){ - ConvertPublicDeviceIDToImplementationDeviceID( inputImpl, inputDevice ); - if( inputImpl == NULL ) - return paInvalidDeviceID; - else - impl = inputImpl; - } - - if( outputDevice != paNoDevice ){ - ConvertPublicDeviceIDToImplementationDeviceID( outputImpl, outputDevice ); - if( outputImpl == NULL ) - return paInvalidDeviceID; - else - impl = outputImpl; - } - - if( inputDevice != paNoDevice && outputDevice != paNoDevice ){ - if( inputImpl != outputImpl ) - return paDevicesMustBelongToTheSameDriverModel; - } - - - result = impl->openStream( stream, inputDevice, numInputChannels, inputSampleFormat, inputDriverInfo, - outputDevice, numOutputChannels, outputSampleFormat, outputDriverInfo, - sampleRate, framesPerBuffer, numberOfBuffers, streamFlags, callback, userData ); - - - if( result == paNoError ) - ((PaStreamImplementation*)stream)->magic = PA_STREAM_MAGIC; - - return result; -} - - -PaError Pa_OpenDefaultStream( PortAudioStream** stream, - int numInputChannels, - int numOutputChannels, - PaSampleFormat sampleFormat, - double sampleRate, - unsigned long framesPerBuffer, - unsigned long numberOfBuffers, - PortAudioCallback *callback, - void *userData ) -{ - PaError result; - int inputDevice = driverModels[0]->getDefaultInputDeviceID; - int outputDevice = driverModels[0]->getDefaultOutputDeviceID; - - result = driverModels[0]->openStream( stream, inputDevice, numInputChannels, sampleFormat, 0, - outputDevice, numOutputChannels, sampleFormat, 0, - sampleRate, framesPerBuffer, numberOfBuffers, - streamFlags, callback, userData ); - - if( result == paNoError ) - ((PaStreamImplementation*)stream)->magic = PA_STREAM_MAGIC; - - return result; -} - - -PaError Pa_CloseStream( PortAudioStream* stream ) -{ - PA_CHECK_INITIALIZED; - - PaError result = ((PaStreamImplementation*)stream)->close(); - - if( result == PaNoError ) - ((PaStreamImplementation*)stream)->magic = 0; /* clear magic number */ - - return result; -} - - -PaError Pa_StartStream( PortAudioStream *stream ); -{ - PA_CHECK_INITIALIZED; - - return ((PaStreamImplementation*)stream)->start(); -} - - -PaError Pa_StopStream( PortAudioStream *stream ); -{ - PA_CHECK_INITIALIZED; - - return ((PaStreamImplementation*)stream)->stop(); -} - - -PaError Pa_AbortStream( PortAudioStream *stream ); -{ - PA_CHECK_INITIALIZED; - - return ((PaStreamImplementation*)stream)->abort(); -} - - -PaError Pa_StreamActive( PortAudioStream *stream ) -{ - PA_CHECK_INITIALIZED; - - return ((PaStreamImplementation*)stream)->active(); -} - -PaTimestamp Pa_StreamTime( PortAudioStream *stream ) -{ - PA_CHECK_INITIALIZED; - - return ((PaStreamImplementation*)stream)->time(); -} - - -double Pa_StreamCPULoad( PortAudioStream* stream ) -{ - PA_CHECK_INITIALIZED; - - return ((PaStreamImplementation*)stream)->cpuLoad(); -} - - - -int Pa_GetMinNumBuffers( PaDeviceID deviceID, int framesPerBuffer, double sampleRate ) -{ - PaDriverModelImplementation *impl; - PA_CHECK_INITIALIZED; - - ConvertPublicDeviceIDToImplementationDeviceID( impl, deviceID ); - if( impl == NULL ) - return paInvalidDeviceID; - - return impl->getMinNumBuffers( framesPerBuffer, sampleRate ); -} - - -void Pa_Sleep( long msec ) -{ - same as existing implementaion -} - - -PaError Pa_GetSampleSize( PaSampleFormat format ) -{ - same as existing implementation -} - -#endif /* PA_MULTIDRIVER */ - - diff --git a/docs/pa_drivermodel.h.txt b/docs/pa_drivermodel.h.txt deleted file mode 100644 index f3f2ca2..0000000 --- a/docs/pa_drivermodel.h.txt +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef PA_MULTIDRIVERMODEL_H -#define PA_MULTIDRIVERMODEL_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -/* - This file contains the host-neutral code for implementing multiple driver model - support in PortAudio. - - It has not been compiled, but it is supplied only for example purposes at this stage. -*/ - - -#include "portaudio.h" - - -#define PA_MULTIDRIVER // for multidriver support - - - -TODO: declare function pointer types for the following function pointers - -/* - Each driver model implementation needs to implement an initialize function - which is added to the driverModelInitializers array in pa_multidrivermodel.c - - the initializer function needs to return a pointer to a - PaDriverModelImplementation structure, or NULL if initiliazation failed. TODO: need error code instead - - the function pointer members of this structure point to funtions - which operate in exactly the same way as the corresponding functions - in the PortAudio API. -*/ - -struct{ - fptr terminate; /* takes the PaDriverModelImplementation* returned by initialize */ - fptr getDriverModelInfo; - fptr getHostError; - fptr getHostErrorText; - fptr countDevices; - fptr getDefaultInputDeviceID; - fptr getDefaultOutputDeviceID; - fptr getDeviceInfo; - fptr openStream; - fptr getMinNumBuffers; -} PaDriverModelImplementation; - -/* - whenever an implementaion's openstream method is called it should return a - PortAudioStream* whose first segment is actually the following structure. - - the functions pointer members of this structure point to funcitons - which operate in exactly the same way as the corresponding functions - in the PortAudio API. -*/ -struct{ - unsigned long magic; - fptr close; - fptr start; - fptr stop; - fptr abort; - fptr active; - fptr time; - fptr cpuLoad; -} PaStreamImplementation; - -/* - Implementations should set magic to PA_STREAM_MAGIC when opening - a stream _and_ clear it to zero when closing a stream. - All functions which operate on streams should check the validity - of magic. -*/ - -#define PA_STREAM_MAGIC 0x12345678 - -#define PA_CHECK_STREAM( stream )\ - if( ((PaStreamImplementation*)stream)->magic != PA_STREAM_MAGIC )\ - return paBadStreamPtr; - - -/* - PA_API allows the same implementation to be used for single - driver model and multi-driver model operation. If - PA_MULTIDRIVER not defined, PA_API will declare api - functions as global, otherwise they will be static, and include - the drivermodel code. - - Usage would be something like: - - int PA_API(CountDevices)(); - - The PA_MULTIDRIVER_SUPPORT macro declares the initialization and - termination functions required by the multidriver support. it also - allocates and deallocates the PaDriverModelImplementation structure. - - TODO: add macros for initializing PaStreamImplementation PortAudioStream - these would be PA_INITIALIZE_STREAM and PA_TERMINATE_STREAM - they would assign and clear the magic number and assign the - interface functions if neceassary. -*/ - -#ifdef PA_MULTIDRIVER - -#define PA_API( model, name ) static Pa ## model ## _ ## name - -#define PA_MULTIDRIVER_SUPPORT( model )\ -PaError Pa_ ## model ## _MultiDriverTerminate( PaStreamImplementation *impl )\ -{\ - free( impl );\ - return Pa ## model ## _Terminate();\ -}\ -PaError Pa ## model ## _MultiDriverInitialize( PaStreamImplementation** impl )\ -{\ - PaError result = Pa ## model ## _Initialize();\ -\ - if( result == paNoError ){\ - *impl = malloc( sizeof( PaDriverModelImplementation ) );\ - if( impl == NULL ){\ - // TODO: call terminate, return an error - }else{\ - (*impl)->terminate = Pa ## model ## _MultiDriverTerminate();\ - (*impl)->getDriverModelInfo = Pa ## model ## _GetDriverModelInfo();\ - (*impl)->getHostError = Pa ## model ## _GetHostError();\ - // TODO: assign the rest of the interface functions - }\ - }\ - return result;\ -} - -#else /* !PA_MULTIDRIVER */ - -#define PA_API( model, name ) Pa_ ## name - -#define PA_MULTIDRIVER_SUPPORT - -#endif /* PA_MULTIDRIVER */ - - - -#endif /* PA_MULTIDRIVERMODEL_H */ diff --git a/docs/proposals.html b/docs/proposals.html index 7c0dc4f..88dd2d0 100644 Binary files a/docs/proposals.html and b/docs/proposals.html differ