1 //------------------------------------------------------------------------------
2 // Copyright (c) 2001-2002, OpenBeOS
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
)
42 if (InitCheck() == B_OK
) {
43 status_t error
= SetParameters(inBufferFrameCount
, format
,
50 BStreamingGameSound::BStreamingGameSound(BGameSoundDevice
*device
)
59 BStreamingGameSound::~BStreamingGameSound()
65 BStreamingGameSound::Clone() const
72 BStreamingGameSound::SetStreamHook(void (*hook
)(void* inCookie
, void* inBuffer
,
73 size_t inByteCount
, BStreamingGameSound
* me
), void * cookie
)
76 fStreamCookie
= cookie
;
83 BStreamingGameSound::FillBuffer(void *inBuffer
,
87 (fStreamHook
)(fStreamCookie
, inBuffer
, inByteCount
, this);
92 BStreamingGameSound::Perform(int32 selector
, void *data
)
99 BStreamingGameSound::SetAttributes(gs_attribute
* inAttributes
,
100 size_t inAttributeCount
)
102 return BGameSound::SetAttributes(inAttributes
, inAttributeCount
);
107 BStreamingGameSound::SetParameters(size_t inBufferFrameCount
,
108 const gs_audio_format
*format
, size_t inBufferCount
)
111 status_t error
= Device()->CreateBuffer(&sound
, this, format
,
112 inBufferFrameCount
, inBufferCount
);
113 if (error
!= B_OK
) return error
;
115 return BGameSound::Init(sound
);
120 BStreamingGameSound::Lock()
127 BStreamingGameSound::Unlock()
133 /* unimplemented for protection of the user:
135 * BStreamingGameSound::BStreamingGameSound()
136 * BStreamingGameSound::BStreamingGameSound(const BStreamingGameSound &)
137 * BStreamingGameSound &BStreamingGameSound::operator=(const BStreamingGameSound &)
142 BStreamingGameSound::_Reserved_BStreamingGameSound_0(int32 arg
, ...)
149 BStreamingGameSound::_Reserved_BStreamingGameSound_1(int32 arg
, ...)
156 BStreamingGameSound::_Reserved_BStreamingGameSound_2(int32 arg
, ...)
163 BStreamingGameSound::_Reserved_BStreamingGameSound_3(int32 arg
, ...)
170 BStreamingGameSound::_Reserved_BStreamingGameSound_4(int32 arg
, ...)
177 BStreamingGameSound::_Reserved_BStreamingGameSound_5(int32 arg
, ...)
184 BStreamingGameSound::_Reserved_BStreamingGameSound_6(int32 arg
, ...)
191 BStreamingGameSound::_Reserved_BStreamingGameSound_7(int32 arg
, ...)
198 BStreamingGameSound::_Reserved_BStreamingGameSound_8(int32 arg
, ...)
205 BStreamingGameSound::_Reserved_BStreamingGameSound_9(int32 arg
, ...)
212 BStreamingGameSound::_Reserved_BStreamingGameSound_10(int32 arg
, ...)
219 BStreamingGameSound::_Reserved_BStreamingGameSound_11(int32 arg
, ...)
226 BStreamingGameSound::_Reserved_BStreamingGameSound_12(int32 arg
, ...)
233 BStreamingGameSound::_Reserved_BStreamingGameSound_13(int32 arg
, ...)
240 BStreamingGameSound::_Reserved_BStreamingGameSound_14(int32 arg
, ...)
247 BStreamingGameSound::_Reserved_BStreamingGameSound_15(int32 arg
, ...)
254 BStreamingGameSound::_Reserved_BStreamingGameSound_16(int32 arg
, ...)
261 BStreamingGameSound::_Reserved_BStreamingGameSound_17(int32 arg
, ...)
268 BStreamingGameSound::_Reserved_BStreamingGameSound_18(int32 arg
, ...)
275 BStreamingGameSound::_Reserved_BStreamingGameSound_19(int32 arg
, ...)
282 BStreamingGameSound::_Reserved_BStreamingGameSound_20(int32 arg
, ...)
289 BStreamingGameSound::_Reserved_BStreamingGameSound_21(int32 arg
, ...)
296 BStreamingGameSound::_Reserved_BStreamingGameSound_22(int32 arg
, ...)
303 BStreamingGameSound::_Reserved_BStreamingGameSound_23(int32 arg
, ...)