/*---------------------------------------------------------------------------* Project: NintendoWare File: snd_VoiceManager.h Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 25412 $ *---------------------------------------------------------------------------*/ #ifndef NW_SND_VOICE_MANAGER_H_ #define NW_SND_VOICE_MANAGER_H_ #include #include namespace nw { namespace snd { namespace internal { namespace driver { /* ======================================================================== class definition ======================================================================== */ class VoiceManager { friend class Voice; public: typedef ut::LinkList< Voice, offsetof(Voice,m_LinkNode)> VoiceList; public: static VoiceManager& GetInstance(); size_t GetRequiredMemSize( int voiceCount ); void Initialize( void* mem, size_t memSize ); void Finalize(); // ------------------------------------------------------------------------ // ボイス管理 Voice* AllocVoice( int voiceChannelCount, int priority, Voice::VoiceCallback callback, void* callbackData ); void FreeVoice( Voice* voice ); void StopAllVoices(); void UpdateAllVoices(); void UpdateAllVoicesSync( u32 syncFlag ); int GetVoiceCount() const; unsigned long GetActiveCount() const; unsigned long GetFreeCount() const; const VoiceList& GetVoiceList() const; private: VoiceManager(); void ChangeVoicePriority( Voice* voice ); int DropLowestPriorityVoice( int priority ); void UpdateEachVoicePriority( const VoiceList::Iterator& beginItr, const VoiceList::Iterator& endItr ); void AppendVoiceList( Voice* voice ); void RemoveVoiceList( Voice* voice ); bool m_Initialized; VoiceList m_PrioVoiceList; // lower priority order VoiceList m_FreeVoiceList; }; } // namespace nw::snd::internal::driver } // namespace nw::snd::internal } // namespace nw::snd } // namespace nw #endif /* NW_SND_VOICE_MANAGER_H_ */