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 _PUSHGAMESOUND_H 9 #define _PUSHGAMESOUND_H 10 11 12 #include <StreamingGameSound.h> 13 14 class BList; 15 16 class BPushGameSound : public BStreamingGameSound { 17 public: 18 BPushGameSound(size_t inBufferFrameCount, 19 const gs_audio_format* format, 20 size_t inBufferCount = 2, 21 BGameSoundDevice* device = NULL); 22 23 virtual ~BPushGameSound(); 24 25 enum lock_status { 26 lock_failed = -1, // not yet time to do more 27 lock_ok = 0, // do more 28 lock_ok_frames_dropped // you may have missed some buffers 29 }; 30 31 virtual lock_status LockNextPage(void** _pagePtr, 32 size_t* _pageSize); 33 virtual status_t UnlockPage(void* pagePtr); 34 35 virtual lock_status LockForCyclic(void** _basePtr, size_t* _size); 36 virtual status_t UnlockCyclic(); 37 virtual size_t CurrentPosition(); 38 39 virtual BGameSound* Clone() const; 40 41 virtual status_t Perform(int32 selector, void* data); 42 43 protected: 44 BPushGameSound(BGameSoundDevice* device); 45 46 virtual status_t SetParameters(size_t bufferFrameCount, 47 const gs_audio_format* format, 48 size_t bufferCount); 49 50 virtual status_t SetStreamHook(void (*hook)(void* inCookie, 51 void* buffer, size_t byteCount, 52 BStreamingGameSound* me), 53 void* cookie); 54 55 virtual void FillBuffer(void* buffer, size_t byteCount); 56 57 private: 58 BPushGameSound(); 59 BPushGameSound(const BPushGameSound& other); 60 BPushGameSound& operator=(const BPushGameSound& other); 61 // not implemented 62 63 bool BytesReady(size_t* bytes); 64 65 virtual status_t _Reserved_BPushGameSound_0(int32 arg, ...); 66 virtual status_t _Reserved_BPushGameSound_1(int32 arg, ...); 67 virtual status_t _Reserved_BPushGameSound_2(int32 arg, ...); 68 virtual status_t _Reserved_BPushGameSound_3(int32 arg, ...); 69 virtual status_t _Reserved_BPushGameSound_4(int32 arg, ...); 70 virtual status_t _Reserved_BPushGameSound_5(int32 arg, ...); 71 virtual status_t _Reserved_BPushGameSound_6(int32 arg, ...); 72 virtual status_t _Reserved_BPushGameSound_7(int32 arg, ...); 73 virtual status_t _Reserved_BPushGameSound_8(int32 arg, ...); 74 virtual status_t _Reserved_BPushGameSound_9(int32 arg, ...); 75 virtual status_t _Reserved_BPushGameSound_10(int32 arg, ...); 76 virtual status_t _Reserved_BPushGameSound_11(int32 arg, ...); 77 virtual status_t _Reserved_BPushGameSound_12(int32 arg, ...); 78 virtual status_t _Reserved_BPushGameSound_13(int32 arg, ...); 79 virtual status_t _Reserved_BPushGameSound_14(int32 arg, ...); 80 virtual status_t _Reserved_BPushGameSound_15(int32 arg, ...); 81 virtual status_t _Reserved_BPushGameSound_16(int32 arg, ...); 82 virtual status_t _Reserved_BPushGameSound_17(int32 arg, ...); 83 virtual status_t _Reserved_BPushGameSound_18(int32 arg, ...); 84 virtual status_t _Reserved_BPushGameSound_19(int32 arg, ...); 85 virtual status_t _Reserved_BPushGameSound_20(int32 arg, ...); 86 virtual status_t _Reserved_BPushGameSound_21(int32 arg, ...); 87 virtual status_t _Reserved_BPushGameSound_22(int32 arg, ...); 88 virtual status_t _Reserved_BPushGameSound_23(int32 arg, ...); 89 90 private: 91 sem_id fLock; 92 BList* fPageLocked; 93 94 size_t fLockPos; 95 size_t fPlayPos; 96 97 char* fBuffer; 98 size_t fPageSize; 99 int32 fPageCount; 100 size_t fBufferSize; 101 102 uint32 _reserved[12]; 103 }; 104 105 106 #endif // _PUSH_GAME_SOUND_H 107