Debian Codegraph @

3rdparty/iaxclient/lib/portaudio/src/common/pa_stream.c

raw symbols SCIP
1 /*
2 * $Id: pa_stream.c,v 1.1 2006/06/10 21:30:55 dmazzoni Exp $
3 * Portable Audio I/O Library
4 *
5 *
6 * Based on the Open Source API proposed by Ross Bencina
7 * Copyright (c) 2002 Ross Bencina
8 *
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:
16 *
17 * The above copyright notice and this permission notice shall be
18 * included in all copies or substantial portions of the Software.
19 *
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.
23 *
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.
31 */
32
33 /** @file
34 @brief Interface used by pa_front to virtualize functions which operate on
35 streams.
36 */
37
38
39 #include "pa_stream.h"
40
41
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* ) )
55 {
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;
68 }
69
70
71 void PaUtil_InitializeStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation,
72 PaUtilStreamInterface *streamInterface,
73 PaStreamCallback *streamCallback,
74 void *userData )
75 {
76 streamRepresentation->magic = PA_STREAM_MAGIC;
77 streamRepresentation->nextOpenStream = 0;
78 streamRepresentation->streamInterface = streamInterface;
79 streamRepresentation->streamCallback = streamCallback;
80 streamRepresentation->streamFinishedCallback = 0;
81
82 streamRepresentation->userData = userData;
83
84 streamRepresentation->streamInfo.inputLatency = 0.;
85 streamRepresentation->streamInfo.outputLatency = 0.;
86 streamRepresentation->streamInfo.sampleRate = 0.;
87 }
88
89
90 void PaUtil_TerminateStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation )
91 {
92 streamRepresentation->magic = 0;
93 }
94
95
96 PaError PaUtil_DummyRead( PaStream* stream,
97 void *buffer,
98 unsigned long frames )
99 {
100 (void)stream; /* unused parameter */
101 (void)buffer; /* unused parameter */
102 (void)frames; /* unused parameter */
103
104 return paCanNotReadFromACallbackStream;
105 }
106
107
108 PaError PaUtil_DummyWrite( PaStream* stream,
109 const void *buffer,
110 unsigned long frames )
111 {
112 (void)stream; /* unused parameter */
113 (void)buffer; /* unused parameter */
114 (void)frames; /* unused parameter */
115
116 return paCanNotWriteToACallbackStream;
117 }
118
119
120 signed long PaUtil_DummyGetReadAvailable( PaStream* stream )
121 {
122 (void)stream; /* unused parameter */
123
124 return paCanNotReadFromACallbackStream;
125 }
126
127
128 signed long PaUtil_DummyGetWriteAvailable( PaStream* stream )
129 {
130 (void)stream; /* unused parameter */
131
132 return paCanNotWriteToACallbackStream;
133 }
134
135
136 double PaUtil_DummyGetCpuLoad( PaStream* stream )
137 {
138 (void)stream; /* unused parameter */
139
140 return 0.0;
141 }