xref: /haiku/headers/os/game/FileGameSound.h (revision f0b6c6a24bd9627a688e74d80f91f9e637052840)
1f46308c9SAxel Dörfler /*
2*f0b6c6a2SPanagiotis Vasilopoulos  *  Copyright 2020, Haiku Inc. All Rights Reserved.
3f46308c9SAxel Dörfler  *  Distributed under the terms of the MIT License.
4f46308c9SAxel Dörfler  *
5f46308c9SAxel Dörfler  * Author:
6f46308c9SAxel Dörfler  *		Christopher ML Zumwalt May (zummy@users.sf.net)
7f46308c9SAxel Dörfler  */
8*f0b6c6a2SPanagiotis Vasilopoulos 
94703fb5dSbeveloper #ifndef _FILEGAMESOUND_H
104703fb5dSbeveloper #define _FILEGAMESOUND_H
114c2bc7e8Sbeveloper 
124703fb5dSbeveloper 
134c2bc7e8Sbeveloper #include <StreamingGameSound.h>
1469f814cdSAdrien Destugues #include <DataIO.h>
1569f814cdSAdrien Destugues 
16f46308c9SAxel Dörfler 
17f6e4cbb9SAxel Dörfler struct entry_ref;
184703fb5dSbeveloper struct _gs_media_tracker;
194703fb5dSbeveloper struct _gs_ramp;
204703fb5dSbeveloper 
21f6e4cbb9SAxel Dörfler 
22f6e4cbb9SAxel Dörfler class BFileGameSound : public BStreamingGameSound {
234c2bc7e8Sbeveloper public:
24*f0b6c6a2SPanagiotis Vasilopoulos 
254703fb5dSbeveloper 								BFileGameSound(const entry_ref* file,
264c2bc7e8Sbeveloper 									bool looping = true,
274c2bc7e8Sbeveloper 									BGameSoundDevice* device = NULL);
28*f0b6c6a2SPanagiotis Vasilopoulos 
294703fb5dSbeveloper 								BFileGameSound(const char* file,
304c2bc7e8Sbeveloper 									bool looping = true,
314c2bc7e8Sbeveloper 									BGameSoundDevice* device = NULL);
32*f0b6c6a2SPanagiotis Vasilopoulos 
3369f814cdSAdrien Destugues 								BFileGameSound(BDataIO* data,
3469f814cdSAdrien Destugues 									bool looping = true,
3569f814cdSAdrien Destugues 									BGameSoundDevice* device = NULL);
364c2bc7e8Sbeveloper 
374c2bc7e8Sbeveloper 	virtual						~BFileGameSound();
384c2bc7e8Sbeveloper 
394c2bc7e8Sbeveloper 	virtual	BGameSound*			Clone() const;
404c2bc7e8Sbeveloper 
414c2bc7e8Sbeveloper 	virtual	status_t			StartPlaying();
424c2bc7e8Sbeveloper 	virtual	status_t			StopPlaying();
43f46308c9SAxel Dörfler 	status_t					Preload();
444c2bc7e8Sbeveloper 
45f46308c9SAxel Dörfler 	virtual	void				FillBuffer(void* buffer, size_t byteCount);
464c2bc7e8Sbeveloper 	virtual	status_t 			Perform(int32 selector, void* data);
47f46308c9SAxel Dörfler 	virtual	status_t			SetPaused(bool isPaused, bigtime_t rampTime);
48f46308c9SAxel Dörfler 
494c2bc7e8Sbeveloper 			enum {
504c2bc7e8Sbeveloper 				B_NOT_PAUSED,
514c2bc7e8Sbeveloper 				B_PAUSE_IN_PROGRESS,
524c2bc7e8Sbeveloper 				B_PAUSED
534c2bc7e8Sbeveloper 			};
544c2bc7e8Sbeveloper 
55*f0b6c6a2SPanagiotis Vasilopoulos 			int32				IsPaused();
564c2bc7e8Sbeveloper private:
57f46308c9SAxel Dörfler 								BFileGameSound();
58f46308c9SAxel Dörfler 								BFileGameSound(const BFileGameSound& other);
59*f0b6c6a2SPanagiotis Vasilopoulos 
60f46308c9SAxel Dörfler 			BFileGameSound&		operator=(const BFileGameSound& other);
614703fb5dSbeveloper 
6269f814cdSAdrien Destugues 			status_t			Init(BDataIO* data);
634703fb5dSbeveloper 
644703fb5dSbeveloper 			bool				Load();
654703fb5dSbeveloper 			bool				Read(void* buffer, size_t bytes);
664c2bc7e8Sbeveloper 
67f46308c9SAxel Dörfler 			status_t			_Reserved_BFileGameSound_0(int32 arg, ...);
68f46308c9SAxel Dörfler 								// SetPaused(bool paused, bigtime_t ramp);
694c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_1(int32 arg, ...);
704c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_2(int32 arg, ...);
714c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_3(int32 arg, ...);
724c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_4(int32 arg, ...);
734c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_5(int32 arg, ...);
744c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_6(int32 arg, ...);
754c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_7(int32 arg, ...);
764c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_8(int32 arg, ...);
774c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_9(int32 arg, ...);
784c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_10(int32 arg, ...);
794c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_11(int32 arg, ...);
804c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_12(int32 arg, ...);
814c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_13(int32 arg, ...);
824c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_14(int32 arg, ...);
834c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_15(int32 arg, ...);
844c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_16(int32 arg, ...);
854c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_17(int32 arg, ...);
864c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_18(int32 arg, ...);
874c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_19(int32 arg, ...);
884c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_20(int32 arg, ...);
894c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_21(int32 arg, ...);
904c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_22(int32 arg, ...);
914c2bc7e8Sbeveloper 	virtual	status_t			_Reserved_BFileGameSound_23(int32 arg, ...);
92f46308c9SAxel Dörfler private:
93f46308c9SAxel Dörfler 			_gs_media_tracker*	fAudioStream;
94f46308c9SAxel Dörfler 
95f46308c9SAxel Dörfler 			bool				fStopping;
96f46308c9SAxel Dörfler 			bool				fLooping;
97f46308c9SAxel Dörfler 			char				fReserved;
98f46308c9SAxel Dörfler 			char*				fBuffer;
99f46308c9SAxel Dörfler 
100f46308c9SAxel Dörfler 			size_t				fFrameSize;
101f46308c9SAxel Dörfler 			size_t				fBufferSize;
102f46308c9SAxel Dörfler 			size_t				fPlayPosition;
103f46308c9SAxel Dörfler 
104f46308c9SAxel Dörfler 			_gs_ramp*			fPausing;
105f46308c9SAxel Dörfler 			bool				fPaused;
106f46308c9SAxel Dörfler 			float				fPauseGain;
107f46308c9SAxel Dörfler 
10869f814cdSAdrien Destugues 			BDataIO*			fDataSource;
10969f814cdSAdrien Destugues 
11069f814cdSAdrien Destugues #ifdef B_HAIKU_64_BIT
111f46308c9SAxel Dörfler 			uint32				_reserved[9];
11269f814cdSAdrien Destugues #else
11369f814cdSAdrien Destugues 			uint32				_reserved[10];
11469f814cdSAdrien Destugues #endif
1154c2bc7e8Sbeveloper };
1164c2bc7e8Sbeveloper 
117*f0b6c6a2SPanagiotis Vasilopoulos #endif
118