Game Kit: rewrite StreamingGameSound.h

Change-Id: Ibd5d77236dc14ca605b0925c1177e64ca9e5a5d3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2113
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Ra-V2
2020-01-25 11:42:41 +00:00
committed by Adrien Destugues
parent d623ab8459
commit e9d6c3150e
+15 -15
View File
@@ -1,20 +1,22 @@
/* /*
* Copyright 2001-2002, Haiku Inc. All Rights Reserved. * Copyright 2020 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Author: * Author:
* Christopher ML Zumwalt May ([email protected]) * Christopher ML Zumwalt May ([email protected])
*/ */
#ifndef _STREAMINGGAMESOUND_H #ifndef _STREAMINGGAMESOUND_H
#define _STREAMINGGAMESOUND_H #define _STREAMINGGAMESOUND_H
#include <SupportDefs.h>
#include <GameSound.h> #include <GameSound.h>
#include <Locker.h> #include <Locker.h>
#include <SupportDefs.h>
class BStreamingGameSound : public BGameSound { class BStreamingGameSound : public BGameSound
{
public: public:
BStreamingGameSound(size_t bufferFrameCount, BStreamingGameSound(size_t bufferFrameCount,
const gs_audio_format* format, const gs_audio_format* format,
@@ -25,10 +27,8 @@ public:
virtual BGameSound* Clone() const; virtual BGameSound* Clone() const;
virtual status_t SetStreamHook(void (*hook)(void* cookie, virtual status_t SetStreamHook(hook h, void* cookie);
void* buffer, size_t byteCount,
BStreamingGameSound* me),
void* cookie);
virtual void FillBuffer(void* buffer, size_t byteCount); virtual void FillBuffer(void* buffer, size_t byteCount);
virtual status_t SetAttributes(gs_attribute* attributes, virtual status_t SetAttributes(gs_attribute* attributes,
@@ -36,6 +36,9 @@ public:
virtual status_t Perform(int32 selector, void* data); virtual status_t Perform(int32 selector, void* data);
typedef void (*hook)(void* cookie, void* buffer, size_t byteCount,
BStreamingGameSound* me);
protected: protected:
BStreamingGameSound(BGameSoundDevice* device); BStreamingGameSound(BGameSoundDevice* device);
@@ -48,10 +51,9 @@ protected:
private: private:
BStreamingGameSound(); BStreamingGameSound();
BStreamingGameSound( BStreamingGameSound(const BStreamingGameSound& other);
const BStreamingGameSound& other); BStreamingGameSound&
BStreamingGameSound& operator=(const BStreamingGameSound& other); operator=(const BStreamingGameSound& other);
// not implemented
virtual status_t _Reserved_BStreamingGameSound_0(int32 arg, ...); virtual status_t _Reserved_BStreamingGameSound_0(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_1(int32 arg, ...); virtual status_t _Reserved_BStreamingGameSound_1(int32 arg, ...);
@@ -79,13 +81,11 @@ private:
virtual status_t _Reserved_BStreamingGameSound_23(int32 arg, ...); virtual status_t _Reserved_BStreamingGameSound_23(int32 arg, ...);
private: private:
void (*fStreamHook)(void* cookie, void* buffer, hook fStreamHook;
size_t bytes, BStreamingGameSound* sound);
void* fStreamCookie; void* fStreamCookie;
BLocker fLock; BLocker fLock;
uint32 _reserved[12]; uint32 _reserved[12];
}; };
#endif
#endif // _STREAMING_GAME_SOUND_H