Game Kit: rewrite PushGameSound and WindowScreen headers

Part of #1576

Change-Id: Iafdc88bcf13e9c07fa148cb7980b54f5ee98be50
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2086
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Raheem Idowu
2020-01-11 02:26:06 +00:00
committed by waddlesplash
parent ef046e3b14
commit e8faedae57
2 changed files with 143 additions and 169 deletions
+10 -17
View File
@@ -1,9 +1,6 @@
/* /*
* 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:
* Christopher ML Zumwalt May ([email protected])
*/ */
#ifndef _PUSHGAMESOUND_H #ifndef _PUSHGAMESOUND_H
#define _PUSHGAMESOUND_H #define _PUSHGAMESOUND_H
@@ -11,6 +8,7 @@
#include <StreamingGameSound.h> #include <StreamingGameSound.h>
class BList; class BList;
class BPushGameSound : public BStreamingGameSound { class BPushGameSound : public BStreamingGameSound {
@@ -19,17 +17,15 @@ public:
const gs_audio_format* format, const gs_audio_format* format,
size_t inBufferCount = 2, size_t inBufferCount = 2,
BGameSoundDevice* device = NULL); BGameSoundDevice* device = NULL);
virtual ~BPushGameSound(); virtual ~BPushGameSound();
enum lock_status { enum lock_status {
lock_failed = -1, // not yet time to do more lock_failed = -1,
lock_ok = 0, // do more lock_ok = 0,
lock_ok_frames_dropped // you may have missed some buffers lock_ok_frames_dropped
}; };
virtual lock_status LockNextPage(void** _pagePtr, virtual lock_status LockNextPage(void** _pagePtr, size_t* _pageSize);
size_t* _pageSize);
virtual status_t UnlockPage(void* pagePtr); virtual status_t UnlockPage(void* pagePtr);
virtual lock_status LockForCyclic(void** _basePtr, size_t* _size); virtual lock_status LockForCyclic(void** _basePtr, size_t* _size);
@@ -44,8 +40,7 @@ protected:
BPushGameSound(BGameSoundDevice* device); BPushGameSound(BGameSoundDevice* device);
virtual status_t SetParameters(size_t bufferFrameCount, virtual status_t SetParameters(size_t bufferFrameCount,
const gs_audio_format* format, const gs_audio_format* format, size_t bufferCount);
size_t bufferCount);
virtual status_t SetStreamHook(void (*hook)(void* inCookie, virtual status_t SetStreamHook(void (*hook)(void* inCookie,
void* buffer, size_t byteCount, void* buffer, size_t byteCount,
@@ -58,7 +53,6 @@ private:
BPushGameSound(); BPushGameSound();
BPushGameSound(const BPushGameSound& other); BPushGameSound(const BPushGameSound& other);
BPushGameSound& operator=(const BPushGameSound& other); BPushGameSound& operator=(const BPushGameSound& other);
// not implemented
bool BytesReady(size_t* bytes); bool BytesReady(size_t* bytes);
@@ -90,11 +84,11 @@ private:
private: private:
sem_id fLock; sem_id fLock;
BList* fPageLocked; BList* fPageLocked;
size_t fLockPos; size_t fLockPos;
size_t fPlayPos;
size_t fPlayPos;
char* fBuffer; char* fBuffer;
size_t fPageSize; size_t fPageSize;
int32 fPageCount; int32 fPageCount;
size_t fBufferSize; size_t fBufferSize;
@@ -102,5 +96,4 @@ private:
uint32 _reserved[12]; uint32 _reserved[12];
}; };
#endif
#endif // _PUSH_GAME_SOUND_H
+3 -22
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2006-2007, 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.
*/ */
#ifndef _WINDOW_SCREEN_H #ifndef _WINDOW_SCREEN_H
@@ -15,8 +15,6 @@
void set_mouse_position(int32 x, int32 y); void set_mouse_position(int32 x, int32 y);
// Controls the mouse cursor position on screen
enum { enum {
B_ENABLE_VIEW_DRAWING = 0x0001, B_ENABLE_VIEW_DRAWING = 0x0001,
@@ -49,44 +47,27 @@ class BWindowScreen : public BWindow {
bool CanControlFrameBuffer(); bool CanControlFrameBuffer();
status_t SetFrameBuffer(int32 width, int32 height); status_t SetFrameBuffer(int32 width, int32 height);
status_t MoveDisplayArea(int32 x, int32 y); status_t MoveDisplayArea(int32 x, int32 y);
rgb_color* ColorList(); rgb_color* ColorList();
frame_buffer_info* FrameBufferInfo(); frame_buffer_info* FrameBufferInfo();
graphics_card_hook CardHookAt(int32 index); graphics_card_hook CardHookAt(int32 index);
graphics_card_info* CardInfo(); graphics_card_info* CardInfo();
void RegisterThread(thread_id thread); void RegisterThread(thread_id thread);
virtual void SuspensionHook(bool active); virtual void SuspensionHook(bool active);
void Suspend(char* label); void Suspend(char* label);
private: private:
virtual status_t Perform(perform_code d, void* arg); virtual status_t Perform(perform_code d, void* arg);
#if 0
void* IOBase();
// deprecated API, always returns NULL
#endif
virtual void _ReservedWindowScreen1(); virtual void _ReservedWindowScreen1();
virtual void _ReservedWindowScreen2(); virtual void _ReservedWindowScreen2();
virtual void _ReservedWindowScreen3(); virtual void _ReservedWindowScreen3();
virtual void _ReservedWindowScreen4(); virtual void _ReservedWindowScreen4();
// not implemented:
BWindowScreen();
BWindowScreen(BWindowScreen& other);
BWindowScreen &operator=(BWindowScreen& other);
status_t _InitData(uint32 space, uint32 attributes); status_t _InitData(uint32 space, uint32 attributes);
void _DisposeData(); void _DisposeData();
status_t _LockScreen(bool lock); status_t _LockScreen(bool lock);
status_t _Activate(); status_t _Activate();
status_t _Deactivate(); status_t _Deactivate();
status_t _SetupAccelerantHooks(); status_t _SetupAccelerantHooks();
void _ResetAccelerantHooks(); void _ResetAccelerantHooks();
status_t _GetCardInfo(); status_t _GetCardInfo();
void _Suspend(); void _Suspend();
void _Resume(); void _Resume();
@@ -94,6 +75,7 @@ class BWindowScreen : public BWindow {
status_t _InitClone(); status_t _InitClone();
status_t _AssertDisplayMode(display_mode* mode); status_t _AssertDisplayMode(display_mode* mode);
private:
uint16 _reserved0; uint16 _reserved0;
bool _reserved1; bool _reserved1;
bool fWorkState; bool fWorkState;
@@ -119,7 +101,6 @@ class BWindowScreen : public BWindow {
int32 fDebugWorkspace; int32 fDebugWorkspace;
int32 fDebugThreadCount; int32 fDebugThreadCount;
thread_id* fDebugThreads; thread_id* fDebugThreads;
uint32 fModeCount; uint32 fModeCount;
display_mode* fModeList; display_mode* fModeList;
@@ -129,4 +110,4 @@ class BWindowScreen : public BWindow {
uint32 _reserved[163]; uint32 _reserved[163];
}; };
#endif // _WINDOW_SCREEN_H #endif