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