1/*
2 *  Copyright 2020, Haiku, Inc. All Rights Reserved.
3 *  Distributed under the terms of the MIT License.
4 */
5#ifndef _GAMESOUND_H
6#define _GAMESOUND_H
7
8
9#include <GameSoundDefs.h>
10#include <new>
11
12
13class BGameSoundDevice;
14
15class BGameSound {
16public:
17								BGameSound(BGameSoundDevice* device = NULL);
18	virtual						~BGameSound();
19
20	virtual	BGameSound*			Clone() const = 0;
21			status_t			InitCheck() const;
22
23			BGameSoundDevice*	Device() const;
24			gs_id				ID() const;
25	const	gs_audio_format&	Format() const;
26
27	virtual	status_t			StartPlaying();
28	virtual	bool				IsPlaying();
29	virtual	status_t			StopPlaying();
30
31			status_t			SetGain(float gain, bigtime_t duration = 0);
32			status_t			SetPan(float pan, bigtime_t duration = 0);
33
34			float				Gain();
35			float				Pan();
36
37	virtual	status_t			SetAttributes(gs_attribute* attributes,
38									size_t attributeCount);
39	virtual	status_t			GetAttributes(gs_attribute* attributes,
40									size_t attributeCount);
41
42			void* 				operator new(size_t size);
43			void*				operator new(size_t size,
44									const std::nothrow_t&) throw();
45			void				operator delete(void* ptr);
46			void				operator delete(void* ptr,
47									const std::nothrow_t&) throw();
48
49	static	status_t			SetMemoryPoolSize(size_t poolSize);
50	static	status_t			LockMemoryPool(bool lockInCore);
51	static	int32				SetMaxSoundCount(int32 maxCount);
52
53	virtual	status_t			Perform(int32 selector, void* data);
54
55protected:
56			status_t			SetInitError(status_t initError);
57			status_t			Init(gs_id handle);
58
59								BGameSound(const BGameSound& other);
60			BGameSound&			operator=(const BGameSound& other);
61
62private:
63								BGameSound();
64
65	virtual	status_t			_Reserved_BGameSound_0(int32 arg, ...);
66	virtual	status_t			_Reserved_BGameSound_1(int32 arg, ...);
67	virtual	status_t			_Reserved_BGameSound_2(int32 arg, ...);
68	virtual	status_t			_Reserved_BGameSound_3(int32 arg, ...);
69	virtual	status_t			_Reserved_BGameSound_4(int32 arg, ...);
70	virtual	status_t			_Reserved_BGameSound_5(int32 arg, ...);
71	virtual	status_t			_Reserved_BGameSound_6(int32 arg, ...);
72	virtual	status_t			_Reserved_BGameSound_7(int32 arg, ...);
73	virtual	status_t			_Reserved_BGameSound_8(int32 arg, ...);
74	virtual	status_t			_Reserved_BGameSound_9(int32 arg, ...);
75	virtual	status_t			_Reserved_BGameSound_10(int32 arg, ...);
76	virtual	status_t			_Reserved_BGameSound_11(int32 arg, ...);
77	virtual	status_t			_Reserved_BGameSound_12(int32 arg, ...);
78	virtual	status_t			_Reserved_BGameSound_13(int32 arg, ...);
79	virtual	status_t			_Reserved_BGameSound_14(int32 arg, ...);
80	virtual	status_t			_Reserved_BGameSound_15(int32 arg, ...);
81	virtual	status_t			_Reserved_BGameSound_16(int32 arg, ...);
82	virtual	status_t			_Reserved_BGameSound_17(int32 arg, ...);
83	virtual	status_t			_Reserved_BGameSound_18(int32 arg, ...);
84	virtual	status_t			_Reserved_BGameSound_19(int32 arg, ...);
85	virtual	status_t			_Reserved_BGameSound_20(int32 arg, ...);
86	virtual	status_t			_Reserved_BGameSound_21(int32 arg, ...);
87	virtual	status_t			_Reserved_BGameSound_22(int32 arg, ...);
88	virtual	status_t			_Reserved_BGameSound_23(int32 arg, ...);
89	virtual	status_t			_Reserved_BGameSound_24(int32 arg, ...);
90	virtual	status_t			_Reserved_BGameSound_25(int32 arg, ...);
91	virtual	status_t			_Reserved_BGameSound_26(int32 arg, ...);
92	virtual	status_t			_Reserved_BGameSound_27(int32 arg, ...);
93	virtual	status_t			_Reserved_BGameSound_28(int32 arg, ...);
94	virtual	status_t			_Reserved_BGameSound_29(int32 arg, ...);
95	virtual	status_t			_Reserved_BGameSound_30(int32 arg, ...);
96	virtual	status_t			_Reserved_BGameSound_31(int32 arg, ...);
97	virtual	status_t			_Reserved_BGameSound_32(int32 arg, ...);
98	virtual	status_t			_Reserved_BGameSound_33(int32 arg, ...);
99	virtual	status_t			_Reserved_BGameSound_34(int32 arg, ...);
100	virtual	status_t			_Reserved_BGameSound_35(int32 arg, ...);
101	virtual	status_t			_Reserved_BGameSound_36(int32 arg, ...);
102	virtual	status_t			_Reserved_BGameSound_37(int32 arg, ...);
103	virtual	status_t			_Reserved_BGameSound_38(int32 arg, ...);
104	virtual	status_t			_Reserved_BGameSound_39(int32 arg, ...);
105	virtual	status_t			_Reserved_BGameSound_40(int32 arg, ...);
106	virtual	status_t			_Reserved_BGameSound_41(int32 arg, ...);
107	virtual	status_t			_Reserved_BGameSound_42(int32 arg, ...);
108	virtual	status_t			_Reserved_BGameSound_43(int32 arg, ...);
109	virtual	status_t			_Reserved_BGameSound_44(int32 arg, ...);
110	virtual	status_t			_Reserved_BGameSound_45(int32 arg, ...);
111	virtual	status_t			_Reserved_BGameSound_46(int32 arg, ...);
112	virtual	status_t			_Reserved_BGameSound_47(int32 arg, ...);
113
114private:
115			BGameSoundDevice*	fDevice;
116			status_t			fInitError;
117
118			gs_audio_format		fFormat;
119			gs_id				fSound;
120
121			uint32				_reserved[16];
122};
123
124
125#endif
126