xref: /haiku/headers/os/game/FileGameSound.h (revision f0b6c6a24bd9627a688e74d80f91f9e637052840)
1 /*
2  *  Copyright 2020, 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 
9 #ifndef _FILEGAMESOUND_H
10 #define _FILEGAMESOUND_H
11 
12 
13 #include <StreamingGameSound.h>
14 #include <DataIO.h>
15 
16 
17 struct entry_ref;
18 struct _gs_media_tracker;
19 struct _gs_ramp;
20 
21 
22 class BFileGameSound : public BStreamingGameSound {
23 public:
24 
25 								BFileGameSound(const entry_ref* file,
26 									bool looping = true,
27 									BGameSoundDevice* device = NULL);
28 
29 								BFileGameSound(const char* file,
30 									bool looping = true,
31 									BGameSoundDevice* device = NULL);
32 
33 								BFileGameSound(BDataIO* data,
34 									bool looping = true,
35 									BGameSoundDevice* device = NULL);
36 
37 	virtual						~BFileGameSound();
38 
39 	virtual	BGameSound*			Clone() const;
40 
41 	virtual	status_t			StartPlaying();
42 	virtual	status_t			StopPlaying();
43 	status_t					Preload();
44 
45 	virtual	void				FillBuffer(void* buffer, size_t byteCount);
46 	virtual	status_t 			Perform(int32 selector, void* data);
47 	virtual	status_t			SetPaused(bool isPaused, bigtime_t rampTime);
48 
49 			enum {
50 				B_NOT_PAUSED,
51 				B_PAUSE_IN_PROGRESS,
52 				B_PAUSED
53 			};
54 
55 			int32				IsPaused();
56 private:
57 								BFileGameSound();
58 								BFileGameSound(const BFileGameSound& other);
59 
60 			BFileGameSound&		operator=(const BFileGameSound& other);
61 
62 			status_t			Init(BDataIO* data);
63 
64 			bool				Load();
65 			bool				Read(void* buffer, size_t bytes);
66 
67 			status_t			_Reserved_BFileGameSound_0(int32 arg, ...);
68 								// SetPaused(bool paused, bigtime_t ramp);
69 	virtual	status_t			_Reserved_BFileGameSound_1(int32 arg, ...);
70 	virtual	status_t			_Reserved_BFileGameSound_2(int32 arg, ...);
71 	virtual	status_t			_Reserved_BFileGameSound_3(int32 arg, ...);
72 	virtual	status_t			_Reserved_BFileGameSound_4(int32 arg, ...);
73 	virtual	status_t			_Reserved_BFileGameSound_5(int32 arg, ...);
74 	virtual	status_t			_Reserved_BFileGameSound_6(int32 arg, ...);
75 	virtual	status_t			_Reserved_BFileGameSound_7(int32 arg, ...);
76 	virtual	status_t			_Reserved_BFileGameSound_8(int32 arg, ...);
77 	virtual	status_t			_Reserved_BFileGameSound_9(int32 arg, ...);
78 	virtual	status_t			_Reserved_BFileGameSound_10(int32 arg, ...);
79 	virtual	status_t			_Reserved_BFileGameSound_11(int32 arg, ...);
80 	virtual	status_t			_Reserved_BFileGameSound_12(int32 arg, ...);
81 	virtual	status_t			_Reserved_BFileGameSound_13(int32 arg, ...);
82 	virtual	status_t			_Reserved_BFileGameSound_14(int32 arg, ...);
83 	virtual	status_t			_Reserved_BFileGameSound_15(int32 arg, ...);
84 	virtual	status_t			_Reserved_BFileGameSound_16(int32 arg, ...);
85 	virtual	status_t			_Reserved_BFileGameSound_17(int32 arg, ...);
86 	virtual	status_t			_Reserved_BFileGameSound_18(int32 arg, ...);
87 	virtual	status_t			_Reserved_BFileGameSound_19(int32 arg, ...);
88 	virtual	status_t			_Reserved_BFileGameSound_20(int32 arg, ...);
89 	virtual	status_t			_Reserved_BFileGameSound_21(int32 arg, ...);
90 	virtual	status_t			_Reserved_BFileGameSound_22(int32 arg, ...);
91 	virtual	status_t			_Reserved_BFileGameSound_23(int32 arg, ...);
92 private:
93 			_gs_media_tracker*	fAudioStream;
94 
95 			bool				fStopping;
96 			bool				fLooping;
97 			char				fReserved;
98 			char*				fBuffer;
99 
100 			size_t				fFrameSize;
101 			size_t				fBufferSize;
102 			size_t				fPlayPosition;
103 
104 			_gs_ramp*			fPausing;
105 			bool				fPaused;
106 			float				fPauseGain;
107 
108 			BDataIO*			fDataSource;
109 
110 #ifdef B_HAIKU_64_BIT
111 			uint32				_reserved[9];
112 #else
113 			uint32				_reserved[10];
114 #endif
115 };
116 
117 #endif
118