/*---------------------------------------------------------------------------* Project: NintendoWare File: snd_StreamSoundFileReader.h Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. 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. The content herein is highly confidential and should be handled accordingly. $Revision: 31311 $ *---------------------------------------------------------------------------*/ #ifndef NW_SND_STREAM_SOUND_FILE_READER_H_ #define NW_SND_STREAM_SOUND_FILE_READER_H_ #include #include namespace nw { namespace snd { namespace internal { class StreamSoundFileReader { public: struct TrackInfo { u8 volume; u8 pan; u8 channelCount; u8 globalChannelIndex[ WAVE_CHANNEL_MAX ]; }; StreamSoundFileReader(); void Initialize( const void* streamSoundFile ); void Finalize(); bool IsAvailable() const { return m_pHeader != NULL; } bool IsValidFileHeader( const void* streamSoundFile ) const; bool ReadStreamSoundInfo( StreamSoundFile::StreamSoundInfo* strmInfo ) const; bool ReadStreamTrackInfo( TrackInfo* trackInfo, int trackIndex ) const; bool ReadDspAdpcmChannelInfo( DspAdpcmParam* param, DspAdpcmLoopParam* loopParam, int channelIndex ) const; NW_INLINE u32 GetChannelCount() const { NW_NULL_ASSERT( m_pInfoBlockBody ); return m_pInfoBlockBody->GetChannelInfoTable()->GetChannelCount(); } NW_INLINE u32 GetTrackCount() const { NW_NULL_ASSERT( m_pInfoBlockBody ); return m_pInfoBlockBody->GetTrackInfoTable()->GetTrackCount(); } NW_INLINE u32 GetSeekBlockOffset() const { if ( IsAvailable() ) { return m_pHeader->GetSeekBlockOffset(); } return 0; } NW_INLINE u32 GetDataBlockOffset() const { if ( IsAvailable() ) { return m_pHeader->GetDataBlockOffset(); } return 0; } private: const StreamSoundFile::FileHeader* m_pHeader; const StreamSoundFile::InfoBlockBody* m_pInfoBlockBody; }; } // namespace nw::snd::internal } // namespace nw::snd } // namespace nw #endif /* NW_SND_STREAM_SOUND_FILE_READER_H_ */