1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: snd_AnimSoundFileReader.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_SOUND_FILE_READER_H_ 19 #define NW_SND_ANIM_SOUND_FILE_READER_H_ 20 21 #include <nw/snd/snd_AnimSoundFile.h> 22 23 namespace nw { 24 namespace snd { 25 namespace internal { 26 27 class AnimSoundFileReader 28 { 29 public: 30 static bool IsValidFileHeader( const void* bcasdFile ); 31 32 AnimSoundFileReader(); 33 bool Initialize( const void* bcasdFile ); 34 void Finalize(); IsAvailable()35 bool IsAvailable() const { return m_pAnimEventTable != NULL; } 36 GetFrameSize()37 u32 GetFrameSize() const 38 { 39 if ( IsAvailable() ) 40 { 41 return m_FrameSize; 42 } 43 return 0; 44 } 45 GetEventCount()46 u32 GetEventCount() const 47 { 48 if ( IsAvailable() ) 49 { 50 return m_pAnimEventTable->count; 51 } 52 return 0; 53 } 54 GetAnimEvent(u32 eventIndex)55 const AnimSoundFile::AnimEvent* GetAnimEvent( u32 eventIndex ) const 56 { 57 if ( IsAvailable() ) 58 { 59 if ( eventIndex >= m_FrameSize ) 60 { 61 return NULL; 62 } 63 return &m_pAnimEventTable->item[eventIndex]; 64 } 65 return NULL; 66 } 67 68 private: 69 const AnimSoundFile::AnimEventTable* m_pAnimEventTable; 70 u32 m_FrameSize; 71 }; 72 73 } // namespace nw::snd::internal 74 } // namespace nw::snd 75 } // namespace nw 76 77 78 #endif /* NW_SND_ANIM_SOUND_FILE_READER_H_ */ 79 80