1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: snd_WaveFile.cpp 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 #include "precompiled.h" 17 #include <nw/snd/snd_WaveFile.h> 18 #include <nw/snd/snd_ElementType.h> 19 20 #include <nw/ut/ut_Inlines.h> // ut::AddOffsetToPtr 21 22 namespace nw { 23 namespace snd { 24 namespace internal { 25 26 // 27 // WaveFile::FileHeader 28 // GetInfoBlock() const29const WaveFile::InfoBlock* WaveFile::FileHeader::GetInfoBlock() const 30 { 31 return reinterpret_cast<const InfoBlock*>( GetBlock( ElementType_WaveFile_InfoBlock ) ); 32 } 33 GetDataBlock() const34const WaveFile::DataBlock* WaveFile::FileHeader::GetDataBlock() const 35 { 36 return reinterpret_cast<const DataBlock*>( GetBlock( ElementType_WaveFile_DataBlock ) ); 37 } 38 39 40 // 41 // WaveFile::InfoBlockBody 42 // 43 const WaveFile::ChannelInfo& GetChannelInfo(s32 channelIndex) const44WaveFile::InfoBlockBody::GetChannelInfo( s32 channelIndex ) const 45 { 46 NW_ASSERT( channelIndex < GetChannelCount() ); 47 return *reinterpret_cast<const ChannelInfo*>( 48 channelInfoReferenceTable.GetReferedItem( channelIndex ) ); 49 } 50 51 52 // 53 // WaveFile::ChannelInfo 54 // 55 const void* GetSamplesAddress(const void * dataBlockBodyAddress) const56WaveFile::ChannelInfo::GetSamplesAddress( const void* dataBlockBodyAddress ) const 57 { 58 return reinterpret_cast<const void*>( 59 ut::AddOffsetToPtr( dataBlockBodyAddress, referToSamples.offset ) ); 60 } 61 62 const WaveFile::DspAdpcmInfo& GetDspAdpcmInfo() const63WaveFile::ChannelInfo::GetDspAdpcmInfo() const 64 { 65 return *reinterpret_cast<const DspAdpcmInfo*>( 66 ut::AddOffsetToPtr( this, referToAdpcmInfo.offset ) ); 67 } 68 69 70 } // namespace nw::snd::internal 71 } // namespace nw::snd 72 } // namespace nw 73