replace header files with BeOS R5 header files taken from headers-src.tgz from ftp.be.com

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@691 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper
2002-08-10 22:38:37 +00:00
parent e7d9c8df6b
commit 4c2bc7e83c
8 changed files with 1076 additions and 0 deletions
+173
View File
@@ -0,0 +1,173 @@
/*******************************************************************************
//
// File: DirectWindow.h
//
// Description: Client window class for direct screen access.
//
// Copyright 1998, Be Incorporated, All Rights Reserved.
//
*******************************************************************************/
#ifndef _DIRECT_WINDOW_H
#define _DIRECT_WINDOW_H
#include <Region.h>
#include <Window.h>
class BDirectDriver;
/* State of the direct access when called back through DirectConnected */
enum direct_buffer_state {
B_DIRECT_MODE_MASK = 15,
B_DIRECT_START = 0,
B_DIRECT_STOP = 1,
B_DIRECT_MODIFY = 2,
B_CLIPPING_MODIFIED = 16,
B_BUFFER_RESIZED = 32,
B_BUFFER_MOVED = 64,
B_BUFFER_RESET = 128
};
/* State of the direct driver and its hooks functions */
enum direct_driver_state {
B_DRIVER_CHANGED = 0x0001,
B_MODE_CHANGED = 0x0002
};
/* Integer rect used to define a cliping rectangle. All bounds are included */
/* Moved to Region.h */
/* Frame buffer access descriptor */
typedef struct {
direct_buffer_state buffer_state;
direct_driver_state driver_state;
void *bits;
void *pci_bits;
int32 bytes_per_row;
uint32 bits_per_pixel;
color_space pixel_format;
buffer_layout layout;
buffer_orientation orientation;
uint32 _reserved[9];
uint32 _dd_type_;
uint32 _dd_token_;
uint32 clip_list_count;
clipping_rect window_bounds;
clipping_rect clip_bounds;
clipping_rect clip_list[1];
} direct_buffer_info;
/* BDirectWindow class */
class BDirectWindow : public BWindow {
public:
BDirectWindow( BRect frame,
const char *title,
window_type type,
uint32 flags,
uint32 workspace = B_CURRENT_WORKSPACE);
BDirectWindow( BRect frame,
const char *title,
window_look look,
window_feel feel,
uint32 flags,
uint32 workspace = B_CURRENT_WORKSPACE);
virtual ~BDirectWindow();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
/* defined for future extension (fragile base class). Identical to BWindow */
virtual void Quit(void);
virtual void DispatchMessage(BMessage *message, BHandler *handler);
virtual void MessageReceived(BMessage *message);
virtual void FrameMoved(BPoint new_position);
virtual void WorkspacesChanged(uint32 old_ws, uint32 new_ws);
virtual void WorkspaceActivated(int32 ws, bool state);
virtual void FrameResized(float new_width, float new_height);
virtual void Minimize(bool minimize);
virtual void Zoom( BPoint rec_position,
float rec_width,
float rec_height);
virtual void ScreenChanged(BRect screen_size, color_space depth);
virtual void MenusBeginning();
virtual void MenusEnded();
virtual void WindowActivated(bool state);
virtual void Show();
virtual void Hide();
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual status_t Perform(perform_code d, void *arg);
private:
virtual void task_looper();
virtual BMessage *ConvertToMessage(void *raw, int32 code);
/* new APIs */
public:
virtual void DirectConnected(direct_buffer_info *info);
status_t GetClippingRegion(BRegion *region, BPoint *origin = NULL) const;
status_t SetFullScreen(bool enable);
bool IsFullScreen() const;
static bool SupportsWindowMode(screen_id = B_MAIN_SCREEN_ID);
/* private */
private:
typedef BWindow inherited;
virtual void _ReservedDirectWindow1();
virtual void _ReservedDirectWindow2();
virtual void _ReservedDirectWindow3();
virtual void _ReservedDirectWindow4();
BDirectWindow();
BDirectWindow(BDirectWindow &);
BDirectWindow &operator=(BDirectWindow &);
bool deamon_killer;
bool connection_enable;
bool full_screen_enable;
bool direct_driver_ready;
bool in_direct_connect;
int32 direct_lock;
sem_id direct_sem;
uint32 direct_lock_count;
thread_id direct_lock_owner;
char *direct_lock_stack;
sem_id disable_sem;
sem_id disable_sem_ack;
uint32 dw_init_status;
uint32 info_area_size;
uint32 direct_driver_type;
uint32 direct_driver_token;
area_id cloned_clipping_area;
area_id source_clipping_area;
thread_id direct_deamon_id;
direct_buffer_info *buffer_desc;
BDirectDriver *direct_driver;
struct priv_ext *extension;
uint32 _reserved_[15];
static int32 DirectDeamonFunc(void *arg);
bool LockDirect() const;
void UnlockDirect() const;
void InitData();
void DisposeData();
status_t DriverSetup() const;
};
#endif
+128
View File
@@ -0,0 +1,128 @@
/*******************************************************************************
/
/ File: FileGameSound.h
/
/ Description: BFileGameSound is a class that streams data out of a file.
/
/ Copyright 1999, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_FILE_GAME_SOUND_H)
#define _FILE_GAME_SOUND_H
#include <StreamingGameSound.h>
class BMediaFile;
namespace BPrivate {
class BTrackReader;
}
class BFileGameSound : public BStreamingGameSound
{
public:
BFileGameSound(
const entry_ref * file,
bool looping = true,
BGameSoundDevice * device = NULL);
BFileGameSound(
const char * file,
bool looping = true,
BGameSoundDevice * device = NULL);
virtual ~BFileGameSound();
virtual BGameSound * Clone() const;
virtual status_t StartPlaying();
virtual status_t StopPlaying();
status_t Preload(); // if you have stopped and want to start quickly again
virtual void FillBuffer(
void * inBuffer,
size_t inByteCount);
virtual status_t Perform(int32 selector, void * data);
virtual status_t SetPaused(
bool isPaused,
bigtime_t rampTime);
enum {
B_NOT_PAUSED,
B_PAUSE_IN_PROGRESS,
B_PAUSED
};
int32 IsPaused();
private:
BMediaFile * _m_soundFile;
BPrivate::BTrackReader * _m_trackReader;
bool _m_looping;
bool _m_stopping;
uchar _m_zero;
uchar _m_reserved_u;
// cruft for read-ahead goes here
thread_id _m_streamThread;
port_id _m_streamPort;
enum {
cmdStartPlaying = 1,
cmdStopPlaying,
cmdUsedBytes,
cmdPreload
};
int32 _m_loopCount;
char * _m_buffer;
size_t _m_bufferSize;
int32 _m_stopCount;
int32 _m_pauseState;
float _m_pauseGain;
float _m_pausePan;
static status_t stream_thread(
void * that);
void LoadFunc();
size_t Load(
size_t & offset,
size_t bytes);
void read_data(
char * dest,
size_t bytes);
/* leave these declarations private unless you plan on actually implementing and using them. */
BFileGameSound();
BFileGameSound(const BFileGameSound&);
BFileGameSound& operator=(const BFileGameSound&);
/* fbc data and virtuals */
uint32 _reserved_BFileGameSound_[8];
status_t _Reserved_BFileGameSound_0(int32 arg, ...); /* SetPaused(bool paused, bigtime_t ramp); */
virtual status_t _Reserved_BFileGameSound_1(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_2(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_3(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_4(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_5(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_6(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_7(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_8(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_9(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_10(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_11(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_12(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_13(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_14(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_15(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_16(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_17(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_18(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_19(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_20(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_21(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_22(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_23(int32 arg, ...);
};
#endif
+167
View File
@@ -0,0 +1,167 @@
/*******************************************************************************
/
/ File: GameGameSound.h
/
/ Description: BGameSound is an abstract base class for all sounds being
/ played using the gamesound kit. Use one of the concrete
/ subclasses for actually playing sound.
/
/ Copyright 1999, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_GAME_SOUND_H)
#define _GAME_SOUND_H
#include <GameSoundDefs.h>
#include <new>
struct gs_audio_format;
class BGameSoundDevice;
namespace BPrivate {
class PrivGameSound;
}
class BGameSound
{
public:
BGameSound(
BGameSoundDevice * device = NULL);
virtual ~BGameSound();
virtual BGameSound * Clone() const = 0;
status_t InitCheck() const;
BGameSoundDevice * Device() const;
gs_id ID() const;
const gs_audio_format &
Format() const; // only valid after Init()
virtual status_t StartPlaying();
virtual bool IsPlaying();
virtual status_t StopPlaying();
status_t SetGain(
float gain,
bigtime_t duration = 0); // ramp duration in seconds
status_t SetPan(
float pan,
bigtime_t duration = 0); // ramp duration in seconds
float Gain();
float Pan();
virtual status_t SetAttributes(
gs_attribute * inAttributes,
size_t inAttributeCount);
virtual status_t GetAttributes(
gs_attribute * outAttributes,
size_t inAttributeCount);
virtual status_t Perform(int32 selector, void * data);
void * operator new(
size_t size);
void * operator new(
size_t size,
const nothrow_t &) throw();
void operator delete(
void * ptr);
#if !__MWERKS__
// there's a bug in MWCC under R4.1 and earlier
void operator delete(
void * ptr,
const nothrow_t &) throw();
#endif
static status_t SetMemoryPoolSize( // implemented in PrivGameSound.cpp
size_t in_poolSize);
static status_t LockMemoryPool( // implemented in PrivGameSound.cpp
bool in_lockInCore);
static int32 SetMaxSoundCount( // implemented in PrivGameSound.cpp
int32 in_maxCount);
protected:
status_t SetInitError(
status_t in_initError);
status_t Init(
gs_id handle);
BGameSound(
const BGameSound & other);
BGameSound & operator=(
const BGameSound & other);
private:
friend class BPrivate::PrivGameSound;
gs_id _m_handle;
BGameSoundDevice * _m_device;
gs_audio_format
_m_format;
status_t _m_initError;
/* leave these declarations private unless you plan on actually implementing and using them. */
BGameSound();
/* fbc data and virtuals */
uint32 _reserved_BGameSound_[16];
virtual status_t _Reserved_BGameSound_0(int32 arg, ...);
virtual status_t _Reserved_BGameSound_1(int32 arg, ...);
virtual status_t _Reserved_BGameSound_2(int32 arg, ...);
virtual status_t _Reserved_BGameSound_3(int32 arg, ...);
virtual status_t _Reserved_BGameSound_4(int32 arg, ...);
virtual status_t _Reserved_BGameSound_5(int32 arg, ...);
virtual status_t _Reserved_BGameSound_6(int32 arg, ...);
virtual status_t _Reserved_BGameSound_7(int32 arg, ...);
virtual status_t _Reserved_BGameSound_8(int32 arg, ...);
virtual status_t _Reserved_BGameSound_9(int32 arg, ...);
virtual status_t _Reserved_BGameSound_10(int32 arg, ...);
virtual status_t _Reserved_BGameSound_11(int32 arg, ...);
virtual status_t _Reserved_BGameSound_12(int32 arg, ...);
virtual status_t _Reserved_BGameSound_13(int32 arg, ...);
virtual status_t _Reserved_BGameSound_14(int32 arg, ...);
virtual status_t _Reserved_BGameSound_15(int32 arg, ...);
virtual status_t _Reserved_BGameSound_16(int32 arg, ...);
virtual status_t _Reserved_BGameSound_17(int32 arg, ...);
virtual status_t _Reserved_BGameSound_18(int32 arg, ...);
virtual status_t _Reserved_BGameSound_19(int32 arg, ...);
virtual status_t _Reserved_BGameSound_20(int32 arg, ...);
virtual status_t _Reserved_BGameSound_21(int32 arg, ...);
virtual status_t _Reserved_BGameSound_22(int32 arg, ...);
virtual status_t _Reserved_BGameSound_23(int32 arg, ...);
virtual status_t _Reserved_BGameSound_24(int32 arg, ...);
virtual status_t _Reserved_BGameSound_25(int32 arg, ...);
virtual status_t _Reserved_BGameSound_26(int32 arg, ...);
virtual status_t _Reserved_BGameSound_27(int32 arg, ...);
virtual status_t _Reserved_BGameSound_28(int32 arg, ...);
virtual status_t _Reserved_BGameSound_29(int32 arg, ...);
virtual status_t _Reserved_BGameSound_30(int32 arg, ...);
virtual status_t _Reserved_BGameSound_31(int32 arg, ...);
virtual status_t _Reserved_BGameSound_32(int32 arg, ...);
virtual status_t _Reserved_BGameSound_33(int32 arg, ...);
virtual status_t _Reserved_BGameSound_34(int32 arg, ...);
virtual status_t _Reserved_BGameSound_35(int32 arg, ...);
virtual status_t _Reserved_BGameSound_36(int32 arg, ...);
virtual status_t _Reserved_BGameSound_37(int32 arg, ...);
virtual status_t _Reserved_BGameSound_38(int32 arg, ...);
virtual status_t _Reserved_BGameSound_39(int32 arg, ...);
virtual status_t _Reserved_BGameSound_40(int32 arg, ...);
virtual status_t _Reserved_BGameSound_41(int32 arg, ...);
virtual status_t _Reserved_BGameSound_42(int32 arg, ...);
virtual status_t _Reserved_BGameSound_43(int32 arg, ...);
virtual status_t _Reserved_BGameSound_44(int32 arg, ...);
virtual status_t _Reserved_BGameSound_45(int32 arg, ...);
virtual status_t _Reserved_BGameSound_46(int32 arg, ...);
virtual status_t _Reserved_BGameSound_47(int32 arg, ...);
};
#endif // _GAME_SOUND_H
+84
View File
@@ -0,0 +1,84 @@
/*******************************************************************************
/
/ File: GameSoundDefs.h
/
/ Description: Definitions of common types and constants for the gamesound kit.
/
/ Copyright 1999, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_GAME_SOUND_DEFS_H)
#define _GAME_SOUND_DEFS_H
#include <SupportDefs.h>
typedef int32 gs_id;
#define B_GS_CUR_API_VERSION B_BEOS_VERSION
#define B_GS_MIN_API_VERSION 0x100
// invalid sound handle
#define B_GS_INVALID_SOUND ((gs_id)-1)
// gs_id for the main mix buffer
#define B_GS_MAIN_SOUND ((gs_id)-2)
enum //fixme renumber to real error messages
{
B_GS_BAD_HANDLE = -99999,
B_GS_NO_SOUNDS,
B_GS_NO_HARDWARE,
B_GS_ALREADY_COMMITTED,
B_GS_READ_ONLY_VALUE
};
struct gs_audio_format
{ /* same as media_raw_audio_format */
enum format { /* for "format" */
B_GS_U8 = 0x11, /* 128 == mid, 1 == bottom, 255 == top */
B_GS_S16 = 0x2, /* 0 == mid, -32767 == bottom, +32767 == top */
B_GS_F = 0x24, /* 0 == mid, -1.0 == bottom, 1.0 == top */
B_GS_S32 = 0x4 /* 0 == mid, 0x80000001 == bottom, 0x7fffffff == top */
};
float frame_rate;
uint32 channel_count; /* 1 or 2, mostly */
uint32 format; /* for compressed formats, go to media_encoded_audio_format */
uint32 byte_order; /* 2 for little endian, 1 for big endian */
size_t buffer_size; /* size of each buffer -- NOT GUARANTEED */
};
//
enum gs_attributes
{
B_GS_NO_ATTRIBUTE = 0, // when there is no attribute
B_GS_MAIN_GAIN = 1, // 0 == 0 dB, -6.0 == -6 dB (gs_id ignored)
B_GS_CD_THROUGH_GAIN, // 0 == 0 dB, -12.0 == -12 dB (gs_id ignored)
// but which CD?
B_GS_GAIN = 128, // 0 == 0 dB, -1.0 == -1 dB, +10.0 == +10 dB
B_GS_PAN, // 0 == middle, -1.0 == left, +1.0 == right
B_GS_SAMPLING_RATE, // 44100.0 == 44.1 kHz
B_GS_LOOPING, // 0 == no
B_GS_FIRST_PRIVATE_ATTRIBUTE = 90000,
B_GS_FIRST_USER_ATTRIBUTE = 100000
};
struct gs_attribute
{
int32 attribute; // which attribute
bigtime_t duration; // how long of time to ramp over for the change
float value; // where the value stops changing
uint32 flags; // whatever flags are for the attribute
};
struct gs_attribute_info
{
int32 attribute;
float granularity;
float minimum;
float maximum;
};
#endif // _GAME_SOUND_DEFS_H
+113
View File
@@ -0,0 +1,113 @@
/*******************************************************************************
/
/ File: PushGameSound.h
/
/ Description: BPushGameSound is a class for games that want to push data
/ at the system, rather than have a callback get called.
/
/ Copyright 1999, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_PUSH_GAME_SOUND_H)
#define _PUSH_GAME_SOUND_H
#include <StreamingGameSound.h>
class BPushGameSound : public BStreamingGameSound
{
public:
BPushGameSound(
size_t inBufferFrameCount,
const gs_audio_format * format,
size_t inBufferCount = 2,
BGameSoundDevice * device = NULL);
virtual ~BPushGameSound();
enum lock_status {
lock_failed = -1, // not yet time to do more
lock_ok = 0, // do more
lock_ok_frames_dropped // you may have missed some buffers
};
virtual lock_status LockNextPage(
void ** out_pagePtr,
size_t * out_pageSize);
virtual status_t UnlockPage(
void * in_pagePtr);
virtual lock_status LockForCyclic(
void ** out_basePtr,
size_t * out_size);
virtual status_t UnlockCyclic();
virtual size_t CurrentPosition();
virtual BGameSound * Clone() const;
virtual status_t Perform(int32 selector, void * data);
protected:
virtual status_t SetParameters( // will allocate handle and call Init()
size_t inBufferFrameCount,
const gs_audio_format * format,
size_t inBufferCount);
virtual status_t SetStreamHook(
void (*hook)(void * inCookie, void * inBuffer, size_t inByteCount, BStreamingGameSound * me),
void * cookie);
virtual void FillBuffer( // default is to call stream hook, if any
void * inBuffer,
size_t inByteCount);
private:
/* leave these declarations private unless you plan on actually implementing and using them. */
BPushGameSound();
BPushGameSound(const BPushGameSound&);
BPushGameSound& operator=(const BPushGameSound&);
int32 _m_benCount;
sem_id _m_benSem;
char * _m_lockedPtr;
char * _m_playedPtr;
size_t _m_pageSize;
int32 _m_pageCount;
size_t _m_bufSize;
char * _m_buffer;
/* fbc data and virtuals */
uint32 _reserved_BPushGameSound_[12];
virtual status_t _Reserved_BPushGameSound_0(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_1(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_2(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_3(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_4(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_5(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_6(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_7(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_8(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_9(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_10(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_11(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_12(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_13(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_14(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_15(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_16(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_17(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_18(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_19(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_20(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_21(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_22(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_23(int32 arg, ...);
};
#endif // _PUSH_GAME_SOUND_H
+83
View File
@@ -0,0 +1,83 @@
/* SimpleGameSound.h */
/*******************************************************************************
/
/ File: SimpleGameSound.h
/
/ Description: BSimpleGameSound is a class for sound effects that are
/ short, and consists of non-changing samples in memory.
/
/ Copyright 1999, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_SIMPLE_GAME_SOUND_H)
#define _SIMPLE_GAME_SOUND_H
#include <GameSound.h>
class BSimpleGameSound : public BGameSound
{
public:
BSimpleGameSound(
const entry_ref * inFile,
BGameSoundDevice * device = NULL);
BSimpleGameSound(
const char * inFile,
BGameSoundDevice * device = NULL);
BSimpleGameSound(
const void * inData,
size_t inFrameCount,
const gs_audio_format * format,
BGameSoundDevice * device = NULL);
BSimpleGameSound(
const BSimpleGameSound & other);
virtual ~BSimpleGameSound();
virtual BGameSound * Clone() const;
virtual status_t Perform(int32 selector, void * data);
status_t SetIsLooping(
bool looping); // whether to go back to beginning
bool IsLooping() const;
private:
/* leave these declarations private unless you plan on actually implementing and using them. */
BSimpleGameSound();
BSimpleGameSound& operator=(const BSimpleGameSound&);
/* fbc data and virtuals */
uint32 _reserved_BSimpleGameSound_[12];
virtual status_t _Reserved_BSimpleGameSound_0(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_1(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_2(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_3(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_4(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_5(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_6(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_7(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_8(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_9(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_10(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_11(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_12(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_13(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_14(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_15(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_16(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_17(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_18(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_19(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_20(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_21(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_22(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_23(int32 arg, ...);
};
#endif // _SIMPLE_GAME_SOUND_H
+102
View File
@@ -0,0 +1,102 @@
/*******************************************************************************
/
/ File: StreamingGameSound.h
/
/ Description: BStreamingGameSound is a class for all kinds of streaming
/ (data not known beforehand) game sounds.
/
/ Copyright 1999, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_STREAMING_GAME_SOUND_H)
#define _STREAMING_GAME_SOUND_H
#include <SupportDefs.h>
#include <GameSound.h>
#include <Locker.h>
class BStreamingGameSound : public BGameSound
{
public:
BStreamingGameSound(
size_t inBufferFrameCount,
const gs_audio_format * format,
size_t inBufferCount = 2,
BGameSoundDevice * device = NULL);
virtual ~BStreamingGameSound();
virtual BGameSound * Clone() const;
virtual status_t SetStreamHook(
void (*hook)(void * inCookie, void * inBuffer, size_t inByteCount, BStreamingGameSound * me),
void * cookie);
virtual void FillBuffer( // default is to call stream hook, if any
void * inBuffer,
size_t inByteCount);
virtual status_t SetAttributes(
gs_attribute * inAttributes,
size_t inAttributeCount);
virtual status_t Perform(int32 selector, void * data);
protected:
BStreamingGameSound(
BGameSoundDevice * device);
virtual status_t SetParameters( // will allocate handle and call Init()
size_t inBufferFrameCount,
const gs_audio_format * format,
size_t inBufferCount);
bool Lock();
void Unlock();
private:
void (*_m_streamHook)(void * cookie, void * buffer, size_t bytes, BStreamingGameSound * sound);
void * _m_streamCookie;
BLocker _m_lock;
static void stream_callback(void * cookie, gs_id handle, void * buffer, int32 offset, int32 size, size_t bufSize);
/* leave these declarations private unless you plan on actually implementing and using them. */
BStreamingGameSound();
BStreamingGameSound(const BStreamingGameSound&);
BStreamingGameSound& operator=(const BStreamingGameSound&);
/* fbc data and virtuals */
uint32 _reserved_BStreamingGameSound_[12];
virtual status_t _Reserved_BStreamingGameSound_0(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_1(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_2(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_3(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_4(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_5(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_6(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_7(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_8(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_9(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_10(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_11(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_12(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_13(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_14(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_15(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_16(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_17(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_18(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_19(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_20(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_21(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_22(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_23(int32 arg, ...);
};
#endif // _STREAMING_GAME_SOUND_H
+226
View File
@@ -0,0 +1,226 @@
/*******************************************************************************
/
/ File: WindowScreen.h
/
/ Description: Client window class for direct screen access.
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
#ifndef _WINDOW_SCREEN_H
#define _WINDOW_SCREEN_H
#include <BeBuild.h>
#include <Window.h>
#include <SupportDefs.h>
#include <OS.h>
#include <kernel/image.h>
#include <GraphicsCard.h>
#include <Accelerant.h>
/* private struct */
typedef struct {
area_id memory_area;
area_id io_area;
char addon_path[64+B_FILE_NAME_LENGTH];
} _direct_screen_info_;
/* private typedef */
typedef int32 (*_add_on_control_)(uint32,void *);
/* Global function, allowing to move the position of the mouse when the GameKit is in
control of the screen. */
_IMPEXP_GAME
void set_mouse_position(int32 x, int32 y);
/********************** WARNING - WARNING - WARNING ***********************************
This is the current version of WindowScreen. The main purpose of this object is to
establish a direct connexion between application and graphic driver, to increase
efficiency and abilities. The graphic driver architecture will overcome serious
changes in the next release, consequently this could only be a preview version of
the real WindowScreen API.
Nevertheless, compatibility will be insure in future releases FOR MOST OF THE API,
through the use of a compatibility library (the new game library having a name
different from "libgame.so"), or a compatibility class (the new WindowScreen class
using a different name). Part of the API for which compatibility will not be insure
after the Preview Release are specifically pointed out in the following declarations.
****************************************************************************************/
enum {
B_ENABLE_VIEW_DRAWING = 0x0001,
B_ENABLE_DEBUGGER = 0x0002
};
class BWindowScreen : public BWindow {
public:
BWindowScreen(const char *title,
uint32 space,
status_t *error,
bool debug_enable = false);
BWindowScreen(const char *title,
uint32 space,
uint32 attributes,
status_t *error);
virtual ~BWindowScreen();
virtual void Quit(void);
virtual void ScreenConnected(bool active);
void Disconnect();
virtual void WindowActivated(bool active);
virtual void WorkspaceActivated(int32 ws, bool state);
virtual void ScreenChanged(BRect screen_size, color_space depth);
virtual void Hide();
virtual void Show();
void SetColorList(rgb_color *list,int32 first_index = 0,int32 last_index = 255);
status_t SetSpace(uint32 space);
bool CanControlFrameBuffer();
status_t SetFrameBuffer(int32 width, int32 height);
status_t MoveDisplayArea(int32 x, int32 y);
/* IOBase will not be support in future compatibility version of WindowScreen. Its
features should be replaced by other functions of the new API. */
void *IOBase();
rgb_color *ColorList();
frame_buffer_info *FrameBufferInfo();
graphics_card_hook CardHookAt(int32 index);
graphics_card_info *CardInfo();
/******************************* Debugger API Notice ********************************
Those three calls, and the debug_enable flag in the constructor, have been added to
help debugging a WindowScreen application without a cross-developement platform or
the use of serial debug output.
To use them, you need to :
- enable the debug mode by setting the debug_enable flag of the constructor to "true".
- register all threads that could be accessing the screen directly at any time. To do
that, call RegisterThread after spawning the new thread and before resuming
it (you should never draw from the Window thread itself, neither register it).
- launch your application from Terminal. The GameKit will first swicth to another
workspace before opening the WindowScreen. If you launch from workspace 0 [Alt-F1],
it will choose the workspace 1 [Alt-F2]. For any other workspace, it will choose
the previous one (for example, for workspace 3 (Alt-F4), it will choose workspace 2
[Alt-F3]).
Then :
- You can use printf(...) anywhere to display informations that will be logged in the
Terminal window. You can go back to the Terminal Window at any time (using the
correct Alt-F?? key). Switching workspace will automatically suspend all the thread
you registered and save the graphic context. Switching back to the WindowScreen
workspace will restore everything and resume your application.
- If you need to save and restore more states when your application is suspended and
resumed, you can overwrite the ForceSwitchForDebug() method. This function is called
with active == true just after suspending your app, and active == false just before
resuming it.
- You can suspend your application by calling the Debugger() method. This will also
switch to the Terminal workspace. Then you can resume by just switchng back to the
WindowScreen workspace (using the good Alt-F?? key). It's better not to call Debugger()
with the WindowScreen locked.
In case of crash :
- Use the safety short-cut : All the left modifiers (Ctrl, Shift, Option, Command, Alt
or equivalents) of your keyboard and F12. That should send you back to 640x480, and
the debugger terminal should be visible (and usable) if any.
- Then, you can also switch to your Terminal workspace to check the last printf infos.
- After you got (we hope) more information about your (or our :-) bug, quit the debugger
window. Then you should be able to change your code and run your application again.
In any case, check the Error() function immediately after the WindowScreen constructor.
A bad error code will mean that the GameKit is in a inconsistent state, and then you
have better to reboot your machine. If you don't wnat to reboot, you can also try to
run your application in a different workspace.
It's far to be perfect, but we hope it will still help.
The Debug API will not be support after the Preview Release (replaced by the debug
API in the new WindowScreen class).
***************************************************************************************/
void RegisterThread(thread_id id);
virtual void SuspensionHook(bool active);
void Suspend(char *label);
virtual status_t Perform(perform_code d, void *arg);
private:
typedef BWindow inherited;
virtual void _ReservedWindowScreen1();
virtual void _ReservedWindowScreen2();
virtual void _ReservedWindowScreen3();
virtual void _ReservedWindowScreen4();
BWindowScreen();
BWindowScreen(BWindowScreen &);
BWindowScreen &operator=(BWindowScreen &);
char addon_state;
char space_mode;
void *io_buffer;
bool direct_enable;
bool work_state;
bool window_state;
bool activate_state;
int32 lock_state;
int32 screen_index;
int32 memory_area, io_area;
display_mode *old_space;
display_mode *new_space;
uint32 space0;
sem_id activate_sem;
sem_id debug_sem;
image_id addon_image;
rgb_color colorList[256];
GetAccelerantHook m_gah;
graphics_card_info card_info;
graphics_card_hook hooks[B_HOOK_COUNT];
_direct_screen_info_ info;
frame_buffer_info format_info;
char *debug_buffer;
bool debug_state;
bool debug_first;
int32 debug_list_count;
int32 debug_workspace;
thread_id *debug_list;
uint32 _attributes;
uint32 mode_count;
display_mode *mode_list;
engine_token *et;
wait_engine_idle m_wei;
acquire_engine m_ae;
release_engine m_re;
fill_rectangle fill_rect;
screen_to_screen_blit blit_rect;
screen_to_screen_transparent_blit trans_blit_rect;
screen_to_screen_scaled_filtered_blit scaled_filtered_blit_rect;
uint32 _reserved_[21];
static BRect CalcFrame(int32 index, int32 space, display_mode *dmode);
int32 SetFullscreen(int32 enable);
status_t InitData(uint32 space, uint32 attributes);
status_t SetActiveState(int32 state);
status_t SetLockState(int32 state);
void GetCardInfo();
void Suspend();
void Resume();
status_t GetModeFromSpace(uint32 space, display_mode *dmode);
status_t InitClone();
status_t AssertDisplayMode(display_mode *dmode);
};
#endif