1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: snd_WaveArchiveFile.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: 31311 $ 16 *---------------------------------------------------------------------------*/ 17 18 #ifndef NW_SND_WAVE_ARCHIVE_FILE_H_ 19 #define NW_SND_WAVE_ARCHIVE_FILE_H_ 20 21 #include <nw/ut/ut_BinaryFileFormat.h> 22 #include <nw/snd/snd_Util.h> 23 24 namespace nw { 25 namespace snd { 26 namespace internal { 27 28 // 29 // MEMO: WaveArchiveFile (.bxwar = 波形アーカイブファイル) 30 // * ヘッダ、INFO ブロックは最初に読む 31 // * FILE ブロックをまるごと読むこともある 32 // * FILE ブロックのうち、必要な波形ファイルのみ読むことも鳴る 33 // 34 35 struct WaveArchiveFile 36 { 37 // 38 // ヘッダー 39 // 40 struct InfoBlock; 41 struct FileBlock; 42 43 static const int BLOCK_SIZE = 2; 44 45 // メモ : WaveArchiveFile::FileHeader はヘッダだけ個別にロードするので、 46 // Util::SoundFileHeader を継承できない。 47 struct FileHeader : public ut::BinaryFileHeader 48 { 49 // データ 50 Util::ReferenceWithSize toBlocks[ BLOCK_SIZE ]; 51 52 // アクセサ (一括ロードの場合に有効) 53 const InfoBlock* GetInfoBlock() const; 54 const FileBlock* GetFileBlock() const; 55 56 // アクセサ (個別ロードのときに利用される) 57 u32 GetInfoBlockSize() const; 58 u32 GetFileBlockSize() const; 59 u32 GetInfoBlockOffset() const; 60 u32 GetFileBlockOffset() const; 61 62 private: 63 const Util::ReferenceWithSize* GetReferenceBy( u16 typeId ) const; 64 }; 65 66 // 67 // INFO ブロック 68 // 69 struct InfoBlockBody 70 { 71 // データ 72 Util::Table<Util::ReferenceWithSize> table; 73 74 // アクセサ GetWaveFileCountWaveArchiveFile::InfoBlockBody75 inline u32 GetWaveFileCount() const { return table.count; } GetSizeWaveArchiveFile::InfoBlockBody76 u32 GetSize( u32 index ) const 77 { 78 NW_ASSERT( index < GetWaveFileCount() ); 79 return table.item[ index ].size; 80 } GetOffsetFromFileBlockBodyWaveArchiveFile::InfoBlockBody81 u32 GetOffsetFromFileBlockBody( u32 index ) const 82 { 83 NW_ASSERT( index < GetWaveFileCount() ); 84 return table.item[ index ].offset; 85 } 86 87 static const u32 INVALID_OFFSET = 0xffffffff; 88 89 }; 90 struct InfoBlock 91 { 92 ut::BinaryBlockHeader header; 93 InfoBlockBody body; 94 }; 95 96 // 97 // FILE ブロック 98 // 99 struct FileBlockBody 100 { 101 }; 102 struct FileBlock 103 { 104 ut::BinaryBlockHeader header; 105 FileBlockBody body; 106 }; 107 }; 108 109 } // namespace nw::snd::internal 110 } // namespace nw::snd 111 } // namespace nw 112 113 114 #endif /* NW_SND_WAVE_ARCHIVE_FILE_H_ */ 115 116