1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: snd_AnimEventPlayer.h 4 5 Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain proprietary 8 information of Nintendo and/or its licensed developers and are protected by 9 national and international copyright laws. They may not be disclosed to third 10 parties or copied or duplicated in any form, in whole or in part, without the 11 prior written consent of Nintendo. 12 13 The content herein is highly confidential and should be handled accordingly. 14 15 $Revision: $ 16 *---------------------------------------------------------------------------*/ 17 18 #ifndef NW_SND_ANIM_EVENT_PLAYER_H_ 19 #define NW_SND_ANIM_EVENT_PLAYER_H_ 20 21 #include <nn/types.h> 22 #include <nw/snd/snd_AnimSoundFile.h> 23 #include <nw/snd/snd_SoundHandle.h> 24 25 namespace nw { 26 namespace snd { 27 28 class SoundStartable; 29 30 namespace internal { 31 32 class AnimEventPlayer 33 { 34 public: 35 AnimEventPlayer(); 36 ~AnimEventPlayer(); 37 38 void Initialize(); 39 void Finalize(); 40 IsPlaying(const AnimSoundFile::EventInfo & eventInfo)41 bool IsPlaying( const AnimSoundFile::EventInfo& eventInfo ) const 42 { 43 return &eventInfo == m_pEventInfo; 44 } IsAttachedSound()45 bool IsAttachedSound() const { return m_Handle.IsAttachedSound(); } GetPlayingSoundPriority()46 int GetPlayingSoundPriority() const 47 { 48 if ( ! IsAttachedSound() ) 49 { 50 return 0; 51 } 52 return m_Handle.detail_GetAttachedSound()->GetPlayerPriority(); 53 } 54 55 void UpdateFrame(); 56 57 bool StartEvent( 58 const AnimSoundFile::EventInfo& eventInfo, 59 SoundStartable& starter, 60 bool isStopWhenFinalize ); 61 bool HoldEvent( 62 const AnimSoundFile::EventInfo& eventInfo, 63 SoundStartable& starter, 64 bool isStopWhenFinalize ); StopEvent(const AnimSoundFile::EventInfo & eventInfo)65 void StopEvent( const AnimSoundFile::EventInfo& eventInfo ) 66 { 67 if ( m_pEventInfo == &eventInfo ) 68 { 69 ForceStop(); 70 } 71 } 72 73 void ForceStop(); 74 void WritePlaySpeedToSequenceVariable( u8 sequenceVariableNo, f32 speed ); 75 76 private: 77 void InitParam( const AnimSoundFile::EventInfo& eventInfo, bool isStopWhenFinalize ); 78 79 SoundHandle m_Handle; 80 const AnimSoundFile::EventInfo* m_pEventInfo; 81 bool m_IsStopWhenFinalize; 82 }; 83 84 } // namespace nw::snd::internal 85 } // namespace nw::snd 86 } // namespace nw 87 88 89 #endif /* NW_SND_ANIM_EVENT_PLAYER_H_ */ 90 91