xref: /haiku/headers/os/game/PushGameSound.h (revision c90684742e7361651849be4116d0e5de3a817194)
1 /*
2  *  Copyright 2001-2002, Haiku Inc. All Rights Reserved.
3  *  Distributed under the terms of the MIT License.
4  *
5  * Author:
6  *		Christopher ML Zumwalt May (zummy@users.sf.net)
7  */
8 #ifndef _PUSHGAMESOUND_H
9 #define _PUSHGAMESOUND_H
10 
11 
12 #include <StreamingGameSound.h>
13 
14 
15 class BPushGameSound : public BStreamingGameSound {
16 public:
17 								BPushGameSound(size_t inBufferFrameCount,
18 									const gs_audio_format* format,
19 									size_t inBufferCount = 2,
20 									BGameSoundDevice* device = NULL);
21 
22 	virtual						~BPushGameSound();
23 
24 			enum lock_status {
25 				lock_failed = -1,		//	not yet time to do more
26 				lock_ok = 0,			//	do more
27 				lock_ok_frames_dropped	//	you may have missed some buffers
28 			};
29 
30 	virtual	lock_status			LockNextPage(void** _pagePtr,
31 									size_t* _pageSize);
32 	virtual	status_t			UnlockPage(void* pagePtr);
33 
34 	virtual	lock_status			LockForCyclic(void** _basePtr, size_t* _size);
35 	virtual	status_t			UnlockCyclic();
36 	virtual	size_t				CurrentPosition();
37 
38 	virtual	BGameSound*			Clone() const;
39 
40 	virtual	status_t 			Perform(int32 selector, void* data);
41 
42 protected:
43 								BPushGameSound(BGameSoundDevice* device);
44 
45 	virtual	status_t			SetParameters(size_t bufferFrameCount,
46 									const gs_audio_format* format,
47 									size_t bufferCount);
48 
49 	virtual	status_t			SetStreamHook(void (*hook)(void* inCookie,
50 										void* buffer, size_t byteCount,
51 										BStreamingGameSound* me),
52 									void* cookie);
53 
54 	virtual	void				FillBuffer(void* buffer, size_t byteCount);
55 
56 private:
57 								BPushGameSound();
58 								BPushGameSound(const BPushGameSound& other);
59 			BPushGameSound&		operator=(const BPushGameSound& other);
60 									// not implemented
61 
62 			bool				BytesReady(size_t* bytes);
63 
64 	virtual	status_t			_Reserved_BPushGameSound_0(int32 arg, ...);
65 	virtual	status_t			_Reserved_BPushGameSound_1(int32 arg, ...);
66 	virtual	status_t			_Reserved_BPushGameSound_2(int32 arg, ...);
67 	virtual	status_t			_Reserved_BPushGameSound_3(int32 arg, ...);
68 	virtual	status_t			_Reserved_BPushGameSound_4(int32 arg, ...);
69 	virtual	status_t			_Reserved_BPushGameSound_5(int32 arg, ...);
70 	virtual	status_t			_Reserved_BPushGameSound_6(int32 arg, ...);
71 	virtual	status_t			_Reserved_BPushGameSound_7(int32 arg, ...);
72 	virtual	status_t			_Reserved_BPushGameSound_8(int32 arg, ...);
73 	virtual	status_t			_Reserved_BPushGameSound_9(int32 arg, ...);
74 	virtual	status_t			_Reserved_BPushGameSound_10(int32 arg, ...);
75 	virtual	status_t			_Reserved_BPushGameSound_11(int32 arg, ...);
76 	virtual	status_t			_Reserved_BPushGameSound_12(int32 arg, ...);
77 	virtual	status_t			_Reserved_BPushGameSound_13(int32 arg, ...);
78 	virtual	status_t			_Reserved_BPushGameSound_14(int32 arg, ...);
79 	virtual	status_t			_Reserved_BPushGameSound_15(int32 arg, ...);
80 	virtual	status_t			_Reserved_BPushGameSound_16(int32 arg, ...);
81 	virtual	status_t			_Reserved_BPushGameSound_17(int32 arg, ...);
82 	virtual	status_t			_Reserved_BPushGameSound_18(int32 arg, ...);
83 	virtual	status_t			_Reserved_BPushGameSound_19(int32 arg, ...);
84 	virtual	status_t			_Reserved_BPushGameSound_20(int32 arg, ...);
85 	virtual	status_t			_Reserved_BPushGameSound_21(int32 arg, ...);
86 	virtual	status_t			_Reserved_BPushGameSound_22(int32 arg, ...);
87 	virtual	status_t			_Reserved_BPushGameSound_23(int32 arg, ...);
88 
89 private:
90 			sem_id				fLock;
91 			BList*				fPageLocked;
92 
93 			size_t				fLockPos;
94 			size_t				fPlayPos;
95 
96 			char*				fBuffer;
97 			size_t				fPageSize;
98 			int32				fPageCount;
99 			size_t				fBufferSize;
100 
101 			uint32				_reserved[12];
102 };
103 
104 
105 #endif	//	_PUSH_GAME_SOUND_H
106