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 _GAMESOUND_H 9 #define _GAMESOUND_H 10 11 12 #include <GameSoundDefs.h> 13 14 #include <new> 15 16 17 class BGameSoundDevice; 18 19 20 class BGameSound { 21 public: 22 BGameSound(BGameSoundDevice* device = NULL); 23 virtual ~BGameSound(); 24 25 virtual BGameSound* Clone() const = 0; 26 status_t InitCheck() const; 27 28 // BGameSound attributes 29 BGameSoundDevice* Device() const; 30 gs_id ID() const; 31 const gs_audio_format& Format() const; 32 // only valid after Init() 33 34 // Playing sounds 35 virtual status_t StartPlaying(); 36 virtual bool IsPlaying(); 37 virtual status_t StopPlaying(); 38 39 // Modifing the playback 40 status_t SetGain(float gain, bigtime_t duration = 0); 41 // ramp duration in seconds 42 status_t SetPan(float pan, bigtime_t duration = 0); 43 // ramp duration in seconds 44 45 float Gain(); 46 float Pan(); 47 48 virtual status_t SetAttributes(gs_attribute* attributes, 49 size_t attributeCount); 50 virtual status_t GetAttributes(gs_attribute* attributes, 51 size_t attributeCount); 52 53 void* operator new(size_t size); 54 void* operator new(size_t size, 55 const std::nothrow_t&) throw(); 56 void operator delete(void* ptr); 57 void operator delete(void* ptr, 58 const std::nothrow_t&) throw(); 59 60 static status_t SetMemoryPoolSize(size_t poolSize); 61 static status_t LockMemoryPool(bool lockInCore); 62 static int32 SetMaxSoundCount(int32 maxCount); 63 64 virtual status_t Perform(int32 selector, void* data); 65 66 protected: 67 status_t SetInitError(status_t initError); 68 status_t Init(gs_id handle); 69 70 BGameSound(const BGameSound& other); 71 BGameSound& operator=(const BGameSound& other); 72 73 private: 74 BGameSound(); 75 // not implemented 76 77 virtual status_t _Reserved_BGameSound_0(int32 arg, ...); 78 virtual status_t _Reserved_BGameSound_1(int32 arg, ...); 79 virtual status_t _Reserved_BGameSound_2(int32 arg, ...); 80 virtual status_t _Reserved_BGameSound_3(int32 arg, ...); 81 virtual status_t _Reserved_BGameSound_4(int32 arg, ...); 82 virtual status_t _Reserved_BGameSound_5(int32 arg, ...); 83 virtual status_t _Reserved_BGameSound_6(int32 arg, ...); 84 virtual status_t _Reserved_BGameSound_7(int32 arg, ...); 85 virtual status_t _Reserved_BGameSound_8(int32 arg, ...); 86 virtual status_t _Reserved_BGameSound_9(int32 arg, ...); 87 virtual status_t _Reserved_BGameSound_10(int32 arg, ...); 88 virtual status_t _Reserved_BGameSound_11(int32 arg, ...); 89 virtual status_t _Reserved_BGameSound_12(int32 arg, ...); 90 virtual status_t _Reserved_BGameSound_13(int32 arg, ...); 91 virtual status_t _Reserved_BGameSound_14(int32 arg, ...); 92 virtual status_t _Reserved_BGameSound_15(int32 arg, ...); 93 virtual status_t _Reserved_BGameSound_16(int32 arg, ...); 94 virtual status_t _Reserved_BGameSound_17(int32 arg, ...); 95 virtual status_t _Reserved_BGameSound_18(int32 arg, ...); 96 virtual status_t _Reserved_BGameSound_19(int32 arg, ...); 97 virtual status_t _Reserved_BGameSound_20(int32 arg, ...); 98 virtual status_t _Reserved_BGameSound_21(int32 arg, ...); 99 virtual status_t _Reserved_BGameSound_22(int32 arg, ...); 100 virtual status_t _Reserved_BGameSound_23(int32 arg, ...); 101 virtual status_t _Reserved_BGameSound_24(int32 arg, ...); 102 virtual status_t _Reserved_BGameSound_25(int32 arg, ...); 103 virtual status_t _Reserved_BGameSound_26(int32 arg, ...); 104 virtual status_t _Reserved_BGameSound_27(int32 arg, ...); 105 virtual status_t _Reserved_BGameSound_28(int32 arg, ...); 106 virtual status_t _Reserved_BGameSound_29(int32 arg, ...); 107 virtual status_t _Reserved_BGameSound_30(int32 arg, ...); 108 virtual status_t _Reserved_BGameSound_31(int32 arg, ...); 109 virtual status_t _Reserved_BGameSound_32(int32 arg, ...); 110 virtual status_t _Reserved_BGameSound_33(int32 arg, ...); 111 virtual status_t _Reserved_BGameSound_34(int32 arg, ...); 112 virtual status_t _Reserved_BGameSound_35(int32 arg, ...); 113 virtual status_t _Reserved_BGameSound_36(int32 arg, ...); 114 virtual status_t _Reserved_BGameSound_37(int32 arg, ...); 115 virtual status_t _Reserved_BGameSound_38(int32 arg, ...); 116 virtual status_t _Reserved_BGameSound_39(int32 arg, ...); 117 virtual status_t _Reserved_BGameSound_40(int32 arg, ...); 118 virtual status_t _Reserved_BGameSound_41(int32 arg, ...); 119 virtual status_t _Reserved_BGameSound_42(int32 arg, ...); 120 virtual status_t _Reserved_BGameSound_43(int32 arg, ...); 121 virtual status_t _Reserved_BGameSound_44(int32 arg, ...); 122 virtual status_t _Reserved_BGameSound_45(int32 arg, ...); 123 virtual status_t _Reserved_BGameSound_46(int32 arg, ...); 124 virtual status_t _Reserved_BGameSound_47(int32 arg, ...); 125 126 private: 127 BGameSoundDevice* fDevice; 128 status_t fInitError; 129 130 gs_audio_format fFormat; 131 gs_id fSound; 132 133 uint32 _reserved[16]; 134 }; 135 136 137 #endif // _GAME_SOUND_H 138