1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: snd_PlayerHeap.h 4 5 Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Revision: 13145 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NW_SND_PLAYER_HEAP_H_ 17 #define NW_SND_PLAYER_HEAP_H_ 18 19 #include <nw/snd/snd_SoundMemoryAllocatable.h> 20 #include <nw/ut/ut_LinkList.h> 21 22 namespace nw { 23 namespace snd { 24 25 /* ======================================================================== 26 type declaration 27 ======================================================================== */ 28 29 class SoundPlayer; 30 31 namespace internal { 32 33 class BasicSound; 34 35 /* ======================================================================== 36 class defition 37 ======================================================================== */ 38 39 class PlayerHeap : public SoundMemoryAllocatable 40 { 41 public: 42 PlayerHeap(); 43 virtual ~PlayerHeap(); 44 AttachSoundPlayer(SoundPlayer * player)45 void AttachSoundPlayer( SoundPlayer* player ) { m_pPlayer = player; } 46 47 void AttachSound( BasicSound* sound ); 48 void DetachSound( BasicSound* sound ); 49 50 bool Create( void* startAddress, size_t size ); 51 void Destroy(); 52 53 // メモリブロックを確保する 54 virtual void* Alloc( size_t size ); 55 56 // 確保したメモリブロックを全て解放する 57 void Clear(); 58 59 // ヒープが有効かどうかを調べる IsValid()60 bool IsValid() const { return m_pAllocAddress != NULL; } 61 62 // ヒープの空き容量を取得する 63 size_t GetFreeSize() const; 64 65 private: 66 BasicSound* m_pSound; 67 SoundPlayer* m_pPlayer; 68 69 void* m_pStartAddress; 70 void* m_pEndAddress; 71 void* m_pAllocAddress; 72 73 public: 74 ut::LinkListNode m_Link; // NW_UT_INIT_LIST のためにpublic 75 }; 76 77 78 } // namespace nw::snd::internal 79 } // namespace nw::snd 80 } // namespace nw 81 82 83 #endif /* NW_SND_PLAYER_HEAP_H_ */ 84 85