BFileGameSound: allow initializing from a BDataIO

There is no reason to not allow this, and it makes it possible to load
data from eg. a BResource instead of a file, which is very useful.

Remove some unused members in the class and dead code, and fix style
issues.

Change-Id: I94cbd0c13c469ea80f55028cf33dfde2de4365ef
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2001
Reviewed-by: Stephan Aßmus <[email protected]>
This commit is contained in:
Adrien Destugues
2019-12-09 12:00:17 +00:00
committed by Stephan Aßmus
parent 041bbff9b0
commit 69f814cded
2 changed files with 49 additions and 23 deletions
+12 -4
View File
@@ -11,6 +11,8 @@
#include <StreamingGameSound.h>
#include <DataIO.h>
struct entry_ref;
struct _gs_media_tracker;
@@ -25,6 +27,9 @@ public:
BFileGameSound(const char* file,
bool looping = true,
BGameSoundDevice* device = NULL);
BFileGameSound(BDataIO* data,
bool looping = true,
BGameSoundDevice* device = NULL);
virtual ~BFileGameSound();
@@ -52,7 +57,7 @@ private:
BFileGameSound& operator=(const BFileGameSound& other);
// not implemented
status_t Init(const entry_ref* file);
status_t Init(BDataIO* data);
bool Load();
bool Read(void* buffer, size_t bytes);
@@ -95,14 +100,17 @@ private:
size_t fBufferSize;
size_t fPlayPosition;
thread_id fReadThread;
port_id fPort;
_gs_ramp* fPausing;
bool fPaused;
float fPauseGain;
BDataIO* fDataSource;
#ifdef B_HAIKU_64_BIT
uint32 _reserved[9];
#else
uint32 _reserved[10];
#endif
};