2
* $Id: pa_stream.c,v 1.1 2006/06/10 21:30:55 dmazzoni Exp $
3
* Portable Audio I/O Library
6
* Based on the Open Source API proposed by Ross Bencina
7
* Copyright (c) 2002 Ross Bencina
9
* Permission is hereby granted, free of charge, to any person obtaining
10
* a copy of this software and associated documentation files
11
* (the "Software"), to deal in the Software without restriction,
12
* including without limitation the rights to use, copy, modify, merge,
13
* publish, distribute, sublicense, and/or sell copies of the Software,
14
* and to permit persons to whom the Software is furnished to do so,
15
* subject to the following conditions:
17
* The above copyright notice and this permission notice shall be
18
* included in all copies or substantial portions of the Software.
20
* Any person wishing to distribute modifications to the Software is
21
* requested to send the modifications to the original developer so that
22
* they can be incorporated into the canonical version.
24
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
28
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
29
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34
@brief Interface used by pa_front to virtualize functions which operate on
39
#include "pa_stream.h"
42
void PaUtil_InitializeStreamInterface( PaUtilStreamInterface *streamInterface,
43
PaError (*Close)( PaStream* ),
44
PaError (*Start)( PaStream* ),
45
PaError (*Stop)( PaStream* ),
46
PaError (*Abort)( PaStream* ),
47
PaError (*IsStopped)( PaStream* ),
48
PaError (*IsActive)( PaStream* ),
49
PaTime (*GetTime)( PaStream* ),
50
double (*GetCpuLoad)( PaStream* ),
51
PaError (*Read)( PaStream*, void *, unsigned long ),
52
PaError (*Write)( PaStream*, const void *, unsigned long ),
53
signed long (*GetReadAvailable)( PaStream* ),
54
signed long (*GetWriteAvailable)( PaStream* ) )
56
streamInterface->Close = Close;
57
streamInterface->Start = Start;
58
streamInterface->Stop = Stop;
59
streamInterface->Abort = Abort;
60
streamInterface->IsStopped = IsStopped;
61
streamInterface->IsActive = IsActive;
62
streamInterface->GetTime = GetTime;
63
streamInterface->GetCpuLoad = GetCpuLoad;
64
streamInterface->Read = Read;
65
streamInterface->Write = Write;
66
streamInterface->GetReadAvailable = GetReadAvailable;
67
streamInterface->GetWriteAvailable = GetWriteAvailable;
71
void PaUtil_InitializeStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation,
72
PaUtilStreamInterface *streamInterface,
73
PaStreamCallback *streamCallback,
76
streamRepresentation->magic = PA_STREAM_MAGIC;
77
streamRepresentation->nextOpenStream = 0;
78
streamRepresentation->streamInterface = streamInterface;
79
streamRepresentation->streamCallback = streamCallback;
80
streamRepresentation->streamFinishedCallback = 0;
82
streamRepresentation->userData = userData;
84
streamRepresentation->streamInfo.inputLatency = 0.;
85
streamRepresentation->streamInfo.outputLatency = 0.;
86
streamRepresentation->streamInfo.sampleRate = 0.;
90
void PaUtil_TerminateStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation )
92
streamRepresentation->magic = 0;
96
PaError PaUtil_DummyRead( PaStream* stream,
98
unsigned long frames )
100
(void)stream; /* unused parameter */
101
(void)buffer; /* unused parameter */
102
(void)frames; /* unused parameter */
104
return paCanNotReadFromACallbackStream;
108
PaError PaUtil_DummyWrite( PaStream* stream,
110
unsigned long frames )
112
(void)stream; /* unused parameter */
113
(void)buffer; /* unused parameter */
114
(void)frames; /* unused parameter */
116
return paCanNotWriteToACallbackStream;
120
signed long PaUtil_DummyGetReadAvailable( PaStream* stream )
122
(void)stream; /* unused parameter */
124
return paCanNotReadFromACallbackStream;
128
signed long PaUtil_DummyGetWriteAvailable( PaStream* stream )
130
(void)stream; /* unused parameter */
132
return paCanNotWriteToACallbackStream;
136
double PaUtil_DummyGetCpuLoad( PaStream* stream )
138
(void)stream; /* unused parameter */