xref: /haiku/headers/os/game/StreamingGameSound.h (revision e79e4e7c9e432c90415f79809b7160e864f79001)
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:
10 //
11 //	The above copyright notice and this permission notice shall be included in
12 //	all copies or substantial portions of the Software.
13 //
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.
21 //
22 //	File Name:		StreamingGameSound.h
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 //------------------------------------------------------------------------------
27 
28 
29 #ifndef _STREAMINGGAMESOUND_H
30 #define _STREAMINGGAMESOUND_H
31 
32 // Standard Includes -----------------------------------------------------------
33 
34 // System Includes -------------------------------------------------------------
35 #include <SupportDefs.h>
36 #include <GameSound.h>
37 #include <Locker.h>
38 
39 // Project Includes ------------------------------------------------------------
40 
41 // Local Includes --------------------------------------------------------------
42 
43 // Local Defines ---------------------------------------------------------------
44 
45 // Globals ---------------------------------------------------------------------
46 
47 class BStreamingGameSound : public BGameSound
48 {
49 public:
50 							BStreamingGameSound(size_t inBufferFrameCount,
51 												const gs_audio_format * format,
52 												size_t inBufferCount = 2,
53 												BGameSoundDevice * device = NULL);
54 
55 	virtual					~BStreamingGameSound();
56 
57 	virtual	BGameSound *	Clone() const;
58 
59 	virtual	status_t		SetStreamHook(void (*hook)(void * inCookie, void * inBuffer, size_t inByteCount, BStreamingGameSound * me),
60 										  void * cookie);
61 	virtual	void			FillBuffer(void * inBuffer,
62 										size_t inByteCount);
63 
64 	virtual	status_t		SetAttributes(gs_attribute * inAttributes,
65 										  size_t inAttributeCount);
66 
67 	virtual	status_t 		Perform(int32 selector, void * data);
68 
69 protected:
70 
71 							BStreamingGameSound(BGameSoundDevice * device);
72 
73 	virtual status_t		SetParameters(size_t inBufferFrameCount,
74 								 		  const gs_audio_format * format,
75 								 		  size_t inBufferCount);
76 
77 			bool			Lock();
78 			void			Unlock();
79 
80 private:
81 
82 		void				(*fStreamHook)(void * cookie, void * buffer, size_t bytes, BStreamingGameSound * sound);
83 		void *				fStreamCookie;
84 		BLocker				fLock;
85 
86 	/* leave these declarations private unless you plan on actually implementing and using them. */
87 	BStreamingGameSound();
88 	BStreamingGameSound(const BStreamingGameSound&);
89 	BStreamingGameSound& operator=(const BStreamingGameSound&);
90 
91 	/* fbc data and virtuals */
92 
93 	uint32 _reserved_BStreamingGameSound_[12];
94 
95 virtual	status_t _Reserved_BStreamingGameSound_0(int32 arg, ...);
96 virtual	status_t _Reserved_BStreamingGameSound_1(int32 arg, ...);
97 virtual	status_t _Reserved_BStreamingGameSound_2(int32 arg, ...);
98 virtual	status_t _Reserved_BStreamingGameSound_3(int32 arg, ...);
99 virtual	status_t _Reserved_BStreamingGameSound_4(int32 arg, ...);
100 virtual	status_t _Reserved_BStreamingGameSound_5(int32 arg, ...);
101 virtual	status_t _Reserved_BStreamingGameSound_6(int32 arg, ...);
102 virtual	status_t _Reserved_BStreamingGameSound_7(int32 arg, ...);
103 virtual	status_t _Reserved_BStreamingGameSound_8(int32 arg, ...);
104 virtual	status_t _Reserved_BStreamingGameSound_9(int32 arg, ...);
105 virtual	status_t _Reserved_BStreamingGameSound_10(int32 arg, ...);
106 virtual	status_t _Reserved_BStreamingGameSound_11(int32 arg, ...);
107 virtual	status_t _Reserved_BStreamingGameSound_12(int32 arg, ...);
108 virtual	status_t _Reserved_BStreamingGameSound_13(int32 arg, ...);
109 virtual	status_t _Reserved_BStreamingGameSound_14(int32 arg, ...);
110 virtual	status_t _Reserved_BStreamingGameSound_15(int32 arg, ...);
111 virtual	status_t _Reserved_BStreamingGameSound_16(int32 arg, ...);
112 virtual	status_t _Reserved_BStreamingGameSound_17(int32 arg, ...);
113 virtual	status_t _Reserved_BStreamingGameSound_18(int32 arg, ...);
114 virtual	status_t _Reserved_BStreamingGameSound_19(int32 arg, ...);
115 virtual	status_t _Reserved_BStreamingGameSound_20(int32 arg, ...);
116 virtual	status_t _Reserved_BStreamingGameSound_21(int32 arg, ...);
117 virtual	status_t _Reserved_BStreamingGameSound_22(int32 arg, ...);
118 virtual	status_t _Reserved_BStreamingGameSound_23(int32 arg, ...);
119 
120 };
121 
122 #endif	//	_STREAMING_GAME_SOUND_H
123