tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / kits / game / StreamingGameSound.cpp
blob28d2d7b27c31611624a4f66914fb14fcdf7bdd72
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2001-2002, OpenBeOS
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a
5 // copy of this software and associated documentation files (the "Software"),
6 // to deal in the Software without restriction, including without limitation
7 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 // and/or sell copies of the Software, and to permit persons to whom the
9 // Software is furnished to do so, subject to the following conditions:
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 // DEALINGS IN THE SOFTWARE.
22 // File Name: StreamingGameSound.cpp
23 // Author: Christopher ML Zumwalt May (zummy@users.sf.net)
24 // Description: BStreamingGameSound is a class for all kinds of streaming
25 // (data not known beforehand) game sounds.
26 //------------------------------------------------------------------------------
29 #include "StreamingGameSound.h"
31 #include "GameSoundDevice.h"
34 BStreamingGameSound::BStreamingGameSound(size_t inBufferFrameCount,
35 const gs_audio_format *format, size_t inBufferCount,
36 BGameSoundDevice *device)
38 BGameSound(device),
39 fStreamHook(NULL),
40 fStreamCookie(NULL)
42 if (InitCheck() == B_OK) {
43 status_t error = SetParameters(inBufferFrameCount, format,
44 inBufferCount);
45 SetInitError(error);
50 BStreamingGameSound::BStreamingGameSound(BGameSoundDevice *device)
52 BGameSound(device),
53 fStreamHook(NULL),
54 fStreamCookie(NULL)
59 BStreamingGameSound::~BStreamingGameSound()
64 BGameSound *
65 BStreamingGameSound::Clone() const
67 return NULL;
71 status_t
72 BStreamingGameSound::SetStreamHook(void (*hook)(void* inCookie, void* inBuffer,
73 size_t inByteCount, BStreamingGameSound * me), void * cookie)
75 fStreamHook = hook;
76 fStreamCookie = cookie;
78 return B_OK;
82 void
83 BStreamingGameSound::FillBuffer(void *inBuffer,
84 size_t inByteCount)
86 if (fStreamHook)
87 (fStreamHook)(fStreamCookie, inBuffer, inByteCount, this);
91 status_t
92 BStreamingGameSound::Perform(int32 selector, void *data)
94 return B_ERROR;
98 status_t
99 BStreamingGameSound::SetAttributes(gs_attribute * inAttributes,
100 size_t inAttributeCount)
102 return BGameSound::SetAttributes(inAttributes, inAttributeCount);
106 status_t
107 BStreamingGameSound::SetParameters(size_t inBufferFrameCount,
108 const gs_audio_format *format, size_t inBufferCount)
110 gs_id sound;
111 status_t error = Device()->CreateBuffer(&sound, this, format,
112 inBufferFrameCount, inBufferCount);
113 if (error != B_OK) return error;
115 return BGameSound::Init(sound);
119 bool
120 BStreamingGameSound::Lock()
122 return fLock.Lock();
126 void
127 BStreamingGameSound::Unlock()
129 fLock.Unlock();
133 /* unimplemented for protection of the user:
135 * BStreamingGameSound::BStreamingGameSound()
136 * BStreamingGameSound::BStreamingGameSound(const BStreamingGameSound &)
137 * BStreamingGameSound &BStreamingGameSound::operator=(const BStreamingGameSound &)
141 status_t
142 BStreamingGameSound::_Reserved_BStreamingGameSound_0(int32 arg, ...)
144 return B_ERROR;
148 status_t
149 BStreamingGameSound::_Reserved_BStreamingGameSound_1(int32 arg, ...)
151 return B_ERROR;
155 status_t
156 BStreamingGameSound::_Reserved_BStreamingGameSound_2(int32 arg, ...)
158 return B_ERROR;
162 status_t
163 BStreamingGameSound::_Reserved_BStreamingGameSound_3(int32 arg, ...)
165 return B_ERROR;
169 status_t
170 BStreamingGameSound::_Reserved_BStreamingGameSound_4(int32 arg, ...)
172 return B_ERROR;
176 status_t
177 BStreamingGameSound::_Reserved_BStreamingGameSound_5(int32 arg, ...)
179 return B_ERROR;
183 status_t
184 BStreamingGameSound::_Reserved_BStreamingGameSound_6(int32 arg, ...)
186 return B_ERROR;
190 status_t
191 BStreamingGameSound::_Reserved_BStreamingGameSound_7(int32 arg, ...)
193 return B_ERROR;
197 status_t
198 BStreamingGameSound::_Reserved_BStreamingGameSound_8(int32 arg, ...)
200 return B_ERROR;
204 status_t
205 BStreamingGameSound::_Reserved_BStreamingGameSound_9(int32 arg, ...)
207 return B_ERROR;
211 status_t
212 BStreamingGameSound::_Reserved_BStreamingGameSound_10(int32 arg, ...)
214 return B_ERROR;
218 status_t
219 BStreamingGameSound::_Reserved_BStreamingGameSound_11(int32 arg, ...)
221 return B_ERROR;
225 status_t
226 BStreamingGameSound::_Reserved_BStreamingGameSound_12(int32 arg, ...)
228 return B_ERROR;
232 status_t
233 BStreamingGameSound::_Reserved_BStreamingGameSound_13(int32 arg, ...)
235 return B_ERROR;
239 status_t
240 BStreamingGameSound::_Reserved_BStreamingGameSound_14(int32 arg, ...)
242 return B_ERROR;
246 status_t
247 BStreamingGameSound::_Reserved_BStreamingGameSound_15(int32 arg, ...)
249 return B_ERROR;
253 status_t
254 BStreamingGameSound::_Reserved_BStreamingGameSound_16(int32 arg, ...)
256 return B_ERROR;
260 status_t
261 BStreamingGameSound::_Reserved_BStreamingGameSound_17(int32 arg, ...)
263 return B_ERROR;
267 status_t
268 BStreamingGameSound::_Reserved_BStreamingGameSound_18(int32 arg, ...)
270 return B_ERROR;
274 status_t
275 BStreamingGameSound::_Reserved_BStreamingGameSound_19(int32 arg, ...)
277 return B_ERROR;
281 status_t
282 BStreamingGameSound::_Reserved_BStreamingGameSound_20(int32 arg, ...)
284 return B_ERROR;
288 status_t
289 BStreamingGameSound::_Reserved_BStreamingGameSound_21(int32 arg, ...)
291 return B_ERROR;
295 status_t
296 BStreamingGameSound::_Reserved_BStreamingGameSound_22(int32 arg, ...)
298 return B_ERROR;
302 status_t
303 BStreamingGameSound::_Reserved_BStreamingGameSound_23(int32 arg, ...)
305 return B_ERROR;