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