1 /* 2 * Copyright 2020 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 9 #ifndef _STREAMINGGAMESOUND_H 10 #define _STREAMINGGAMESOUND_H 11 12 13 #include <GameSound.h> 14 #include <Locker.h> 15 #include <SupportDefs.h> 16 17 18 class BStreamingGameSound : public BGameSound 19 { 20 public: 21 BStreamingGameSound(size_t bufferFrameCount, 22 const gs_audio_format* format, 23 size_t bufferCount = 2, 24 BGameSoundDevice* device = NULL); 25 26 virtual ~BStreamingGameSound(); 27 28 virtual BGameSound* Clone() const; 29 30 typedef void (*hook)(void* cookie, void* buffer, size_t byteCount, 31 BStreamingGameSound* me); 32 33 virtual status_t SetStreamHook(hook h, void* cookie); 34 35 virtual void FillBuffer(void* buffer, size_t byteCount); 36 37 virtual status_t SetAttributes(gs_attribute* attributes, 38 size_t attributeCount); 39 40 virtual status_t Perform(int32 selector, void* data); 41 42 protected: 43 BStreamingGameSound(BGameSoundDevice* device); 44 45 virtual status_t SetParameters(size_t bufferFrameCount, 46 const gs_audio_format* format, 47 size_t bufferCount); 48 49 bool Lock(); 50 void Unlock(); 51 52 private: 53 BStreamingGameSound(); 54 BStreamingGameSound(const BStreamingGameSound& other); 55 BStreamingGameSound& 56 operator=(const BStreamingGameSound& other); 57 58 virtual status_t _Reserved_BStreamingGameSound_0(int32 arg, ...); 59 virtual status_t _Reserved_BStreamingGameSound_1(int32 arg, ...); 60 virtual status_t _Reserved_BStreamingGameSound_2(int32 arg, ...); 61 virtual status_t _Reserved_BStreamingGameSound_3(int32 arg, ...); 62 virtual status_t _Reserved_BStreamingGameSound_4(int32 arg, ...); 63 virtual status_t _Reserved_BStreamingGameSound_5(int32 arg, ...); 64 virtual status_t _Reserved_BStreamingGameSound_6(int32 arg, ...); 65 virtual status_t _Reserved_BStreamingGameSound_7(int32 arg, ...); 66 virtual status_t _Reserved_BStreamingGameSound_8(int32 arg, ...); 67 virtual status_t _Reserved_BStreamingGameSound_9(int32 arg, ...); 68 virtual status_t _Reserved_BStreamingGameSound_10(int32 arg, ...); 69 virtual status_t _Reserved_BStreamingGameSound_11(int32 arg, ...); 70 virtual status_t _Reserved_BStreamingGameSound_12(int32 arg, ...); 71 virtual status_t _Reserved_BStreamingGameSound_13(int32 arg, ...); 72 virtual status_t _Reserved_BStreamingGameSound_14(int32 arg, ...); 73 virtual status_t _Reserved_BStreamingGameSound_15(int32 arg, ...); 74 virtual status_t _Reserved_BStreamingGameSound_16(int32 arg, ...); 75 virtual status_t _Reserved_BStreamingGameSound_17(int32 arg, ...); 76 virtual status_t _Reserved_BStreamingGameSound_18(int32 arg, ...); 77 virtual status_t _Reserved_BStreamingGameSound_19(int32 arg, ...); 78 virtual status_t _Reserved_BStreamingGameSound_20(int32 arg, ...); 79 virtual status_t _Reserved_BStreamingGameSound_21(int32 arg, ...); 80 virtual status_t _Reserved_BStreamingGameSound_22(int32 arg, ...); 81 virtual status_t _Reserved_BStreamingGameSound_23(int32 arg, ...); 82 83 private: 84 hook fStreamHook; 85 void* fStreamCookie; 86 BLocker fLock; 87 88 uint32 _reserved[12]; 89 }; 90 91 #endif 92