PortAudio 2.0
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 1339 2008-02-15 07:50:33Z 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-2008 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 
00050 #include "portaudio.h"
00051 
00052 #ifdef __cplusplus
00053 extern "C"
00054 {
00055 #endif /* __cplusplus */
00056 
00057 
00058 #define PA_STREAM_MAGIC (0x18273645)
00059 
00060 
00067 typedef struct {
00068     PaError (*Close)( PaStream* stream );
00069     PaError (*Start)( PaStream *stream );
00070     PaError (*Stop)( PaStream *stream );
00071     PaError (*Abort)( PaStream *stream );
00072     PaError (*IsStopped)( PaStream *stream );
00073     PaError (*IsActive)( PaStream *stream );
00074     PaTime (*GetTime)( PaStream *stream );
00075     double (*GetCpuLoad)( PaStream* stream );
00076     PaError (*Read)( PaStream* stream, void *buffer, unsigned long frames );
00077     PaError (*Write)( PaStream* stream, const void *buffer, unsigned long frames );
00078     signed long (*GetReadAvailable)( PaStream* stream );
00079     signed long (*GetWriteAvailable)( PaStream* stream );
00080 } PaUtilStreamInterface;
00081 
00082 
00085 void PaUtil_InitializeStreamInterface( PaUtilStreamInterface *streamInterface,
00086     PaError (*Close)( PaStream* ),
00087     PaError (*Start)( PaStream* ),
00088     PaError (*Stop)( PaStream* ),
00089     PaError (*Abort)( PaStream* ),
00090     PaError (*IsStopped)( PaStream* ),
00091     PaError (*IsActive)( PaStream* ),
00092     PaTime (*GetTime)( PaStream* ),
00093     double (*GetCpuLoad)( PaStream* ),
00094     PaError (*Read)( PaStream* stream, void *buffer, unsigned long frames ),
00095     PaError (*Write)( PaStream* stream, const void *buffer, unsigned long frames ),
00096     signed long (*GetReadAvailable)( PaStream* stream ),
00097     signed long (*GetWriteAvailable)( PaStream* stream ) );
00098 
00099 
00105 PaError PaUtil_DummyRead( PaStream* stream,
00106                        void *buffer,
00107                        unsigned long frames );
00108 
00109 
00115 PaError PaUtil_DummyWrite( PaStream* stream,
00116                        const void *buffer,
00117                        unsigned long frames );
00118 
00119 
00125 signed long PaUtil_DummyGetReadAvailable( PaStream* stream );
00126 
00127 
00133 signed long PaUtil_DummyGetWriteAvailable( PaStream* stream );
00134 
00135 
00136 
00141 double PaUtil_DummyGetCpuLoad( PaStream* stream );
00142 
00143 
00147 typedef struct PaUtilStreamRepresentation {
00148     unsigned long magic;    
00149     struct PaUtilStreamRepresentation *nextOpenStream; 
00150     PaUtilStreamInterface *streamInterface;
00151     PaStreamCallback *streamCallback;
00152     PaStreamFinishedCallback *streamFinishedCallback;
00153     void *userData;
00154     PaStreamInfo streamInfo;
00155 } PaUtilStreamRepresentation;
00156 
00157 
00162 void PaUtil_InitializeStreamRepresentation(
00163         PaUtilStreamRepresentation *streamRepresentation,
00164         PaUtilStreamInterface *streamInterface,
00165         PaStreamCallback *streamCallback,
00166         void *userData );
00167         
00168 
00174 void PaUtil_TerminateStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation );
00175 
00176 
00182 PaError PaUtil_ValidateStreamPointer( PaStream *stream );
00183 
00184 
00189 #define PA_STREAM_REP( stream )\
00190     ((PaUtilStreamRepresentation*) (stream) )
00191 
00192 
00197 #define PA_STREAM_INTERFACE( stream )\
00198     PA_STREAM_REP( (stream) )->streamInterface
00199 
00200 
00201     
00202 #ifdef __cplusplus
00203 }
00204 #endif /* __cplusplus */
00205 #endif /* PA_STREAM_H */

Generated for PortAudio by  doxygen1.7.4