/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta/3rdparty/portaudio/src/common/pa_stream.c
ViewVC logotype

Contents of /branch/r3113_0.9.7_beta/3rdparty/portaudio/src/common/pa_stream.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Tue Sep 7 03:29:01 2010 UTC (9 years, 5 months ago) by william
File MIME type: text/plain
File size: 5357 byte(s)
branching from upstream revision (http://pcsx2.googlecode.com/svn/trunk
): r3113 to
https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/r3113_0.9.7_beta
1 /*
2 * $Id: pa_stream.c 1339 2008-02-15 07:50:33Z rossb $
3 * Portable Audio I/O Library
4 * stream interface
5 *
6 * Based on the Open Source API proposed by Ross Bencina
7 * Copyright (c) 2008 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
24 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
25 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 */
28
29 /*
30 * The text above constitutes the entire PortAudio license; however,
31 * the PortAudio community also makes the following non-binding requests:
32 *
33 * Any person wishing to distribute modifications to the Software is
34 * requested to send the modifications to the original developer so that
35 * they can be incorporated into the canonical version. It is also
36 * requested that these non-binding requests be included along with the
37 * license above.
38 */
39
40 /** @file
41 @ingroup common_src
42
43 @brief Stream interfaces, representation structures and helper functions
44 used to interface between pa_front.c host API implementations.
45 */
46
47
48 #include "pa_stream.h"
49
50
51 void PaUtil_InitializeStreamInterface( PaUtilStreamInterface *streamInterface,
52 PaError (*Close)( PaStream* ),
53 PaError (*Start)( PaStream* ),
54 PaError (*Stop)( PaStream* ),
55 PaError (*Abort)( PaStream* ),
56 PaError (*IsStopped)( PaStream* ),
57 PaError (*IsActive)( PaStream* ),
58 PaTime (*GetTime)( PaStream* ),
59 double (*GetCpuLoad)( PaStream* ),
60 PaError (*Read)( PaStream*, void *, unsigned long ),
61 PaError (*Write)( PaStream*, const void *, unsigned long ),
62 signed long (*GetReadAvailable)( PaStream* ),
63 signed long (*GetWriteAvailable)( PaStream* ) )
64 {
65 streamInterface->Close = Close;
66 streamInterface->Start = Start;
67 streamInterface->Stop = Stop;
68 streamInterface->Abort = Abort;
69 streamInterface->IsStopped = IsStopped;
70 streamInterface->IsActive = IsActive;
71 streamInterface->GetTime = GetTime;
72 streamInterface->GetCpuLoad = GetCpuLoad;
73 streamInterface->Read = Read;
74 streamInterface->Write = Write;
75 streamInterface->GetReadAvailable = GetReadAvailable;
76 streamInterface->GetWriteAvailable = GetWriteAvailable;
77 }
78
79
80 void PaUtil_InitializeStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation,
81 PaUtilStreamInterface *streamInterface,
82 PaStreamCallback *streamCallback,
83 void *userData )
84 {
85 streamRepresentation->magic = PA_STREAM_MAGIC;
86 streamRepresentation->nextOpenStream = 0;
87 streamRepresentation->streamInterface = streamInterface;
88 streamRepresentation->streamCallback = streamCallback;
89 streamRepresentation->streamFinishedCallback = 0;
90
91 streamRepresentation->userData = userData;
92
93 streamRepresentation->streamInfo.inputLatency = 0.;
94 streamRepresentation->streamInfo.outputLatency = 0.;
95 streamRepresentation->streamInfo.sampleRate = 0.;
96 }
97
98
99 void PaUtil_TerminateStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation )
100 {
101 streamRepresentation->magic = 0;
102 }
103
104
105 PaError PaUtil_DummyRead( PaStream* stream,
106 void *buffer,
107 unsigned long frames )
108 {
109 (void)stream; /* unused parameter */
110 (void)buffer; /* unused parameter */
111 (void)frames; /* unused parameter */
112
113 return paCanNotReadFromACallbackStream;
114 }
115
116
117 PaError PaUtil_DummyWrite( PaStream* stream,
118 const void *buffer,
119 unsigned long frames )
120 {
121 (void)stream; /* unused parameter */
122 (void)buffer; /* unused parameter */
123 (void)frames; /* unused parameter */
124
125 return paCanNotWriteToACallbackStream;
126 }
127
128
129 signed long PaUtil_DummyGetReadAvailable( PaStream* stream )
130 {
131 (void)stream; /* unused parameter */
132
133 return paCanNotReadFromACallbackStream;
134 }
135
136
137 signed long PaUtil_DummyGetWriteAvailable( PaStream* stream )
138 {
139 (void)stream; /* unused parameter */
140
141 return paCanNotWriteToACallbackStream;
142 }
143
144
145 double PaUtil_DummyGetCpuLoad( PaStream* stream )
146 {
147 (void)stream; /* unused parameter */
148
149 return 0.0;
150 }

  ViewVC Help
Powered by ViewVC 1.1.22