pa_stream.h

Go to the documentation of this file.
00001 #ifndef PA_STREAM_H
00002 #define PA_STREAM_H
00003 /*
00004  * $Id: pa_stream.h 1083 2006-08-23 07:30:49Z rossb $
00005  * Portable Audio I/O Library
00006  * stream interface
00007  *
00008  * Based on the Open Source API proposed by Ross Bencina
00009  * Copyright (c) 1999-2002 Ross Bencina, Phil Burk
00010  *
00011  * Permission is hereby granted, free of charge, to any person obtaining
00012  * a copy of this software and associated documentation files
00013  * (the "Software"), to deal in the Software without restriction,
00014  * including without limitation the rights to use, copy, modify, merge,
00015  * publish, distribute, sublicense, and/or sell copies of the Software,
00016  * and to permit persons to whom the Software is furnished to do so,
00017  * subject to the following conditions:
00018  *
00019  * The above copyright notice and this permission notice shall be
00020  * included in all copies or substantial portions of the Software.
00021  *
00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
00026  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00027  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00028  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00029  */
00030 
00031 /*
00032  * The text above constitutes the entire PortAudio license; however, 
00033  * the PortAudio community also makes the following non-binding requests:
00034  *
00035  * Any person wishing to distribute modifications to the Software is
00036  * requested to send the modifications to the original developer so that
00037  * they can be incorporated into the canonical version. It is also 
00038  * requested that these non-binding requests be included along with the 
00039  * license above.
00040  */
00041 
00048 #include "portaudio.h"
00049 
00050 #ifdef __cplusplus
00051 extern "C"
00052 {
00053 #endif /* __cplusplus */
00054 
00055 
00056 #define PA_STREAM_MAGIC (0x18273645)
00057 
00058 
00065 typedef struct {
00066     PaError (*Close)( PaStream* stream );
00067     PaError (*Start)( PaStream *stream );
00068     PaError (*Stop)( PaStream *stream );
00069     PaError (*Abort)( PaStream *stream );
00070     PaError (*IsStopped)( PaStream *stream );
00071     PaError (*IsActive)( PaStream *stream );
00072     PaTime (*GetTime)( PaStream *stream );
00073     double (*GetCpuLoad)( PaStream* stream );
00074     PaError (*Read)( PaStream* stream, void *buffer, unsigned long frames );
00075     PaError (*Write)( PaStream* stream, const void *buffer, unsigned long frames );
00076     signed long (*GetReadAvailable)( PaStream* stream );
00077     signed long (*GetWriteAvailable)( PaStream* stream );
00078 } PaUtilStreamInterface;
00079 
00080 
00083 void PaUtil_InitializeStreamInterface( PaUtilStreamInterface *streamInterface,
00084     PaError (*Close)( PaStream* ),
00085     PaError (*Start)( PaStream* ),
00086     PaError (*Stop)( PaStream* ),
00087     PaError (*Abort)( PaStream* ),
00088     PaError (*IsStopped)( PaStream* ),
00089     PaError (*IsActive)( PaStream* ),
00090     PaTime (*GetTime)( PaStream* ),
00091     double (*GetCpuLoad)( PaStream* ),
00092     PaError (*Read)( PaStream* stream, void *buffer, unsigned long frames ),
00093     PaError (*Write)( PaStream* stream, const void *buffer, unsigned long frames ),
00094     signed long (*GetReadAvailable)( PaStream* stream ),
00095     signed long (*GetWriteAvailable)( PaStream* stream ) );
00096 
00097 
00103 PaError PaUtil_DummyRead( PaStream* stream,
00104                        void *buffer,
00105                        unsigned long frames );
00106 
00107 
00113 PaError PaUtil_DummyWrite( PaStream* stream,
00114                        const void *buffer,
00115                        unsigned long frames );
00116 
00117 
00123 signed long PaUtil_DummyGetReadAvailable( PaStream* stream );
00124 
00125 
00131 signed long PaUtil_DummyGetWriteAvailable( PaStream* stream );
00132 
00133 
00134 
00139 double PaUtil_DummyGetCpuLoad( PaStream* stream );
00140 
00141 
00145 typedef struct PaUtilStreamRepresentation {
00146     unsigned long magic;    
00147     struct PaUtilStreamRepresentation *nextOpenStream; 
00148     PaUtilStreamInterface *streamInterface;
00149     PaStreamCallback *streamCallback;
00150     PaStreamFinishedCallback *streamFinishedCallback;
00151     void *userData;
00152     PaStreamInfo streamInfo;
00153 } PaUtilStreamRepresentation;
00154 
00155 
00160 void PaUtil_InitializeStreamRepresentation(
00161         PaUtilStreamRepresentation *streamRepresentation,
00162         PaUtilStreamInterface *streamInterface,
00163         PaStreamCallback *streamCallback,
00164         void *userData );
00165         
00166 
00172 void PaUtil_TerminateStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation );
00173 
00174 
00180 PaError PaUtil_ValidateStreamPointer( PaStream *stream );
00181 
00182 
00187 #define PA_STREAM_REP( stream )\
00188     ((PaUtilStreamRepresentation*) (stream) )
00189 
00190 
00195 #define PA_STREAM_INTERFACE( stream )\
00196     PA_STREAM_REP( (stream) )->streamInterface
00197 
00198 
00199     
00200 #ifdef __cplusplus
00201 }
00202 #endif /* __cplusplus */
00203 #endif /* PA_STREAM_H */

Generated on Fri Nov 17 07:08:00 2006 for PortAudio by  doxygen 1.5.1