1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     snd_SequenceSoundFile.h
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 #ifndef NW_SND_SEQUENCE_SOUND_FILE_H_
17 #define NW_SND_SEQUENCE_SOUND_FILE_H_
18 
19 #include <nw/ut/ut_BinaryFileFormat.h>
20 #include <nw/snd/snd_Util.h>
21 
22 namespace nw {
23 namespace snd {
24 namespace internal {
25 
26 struct SequenceSoundFile
27 {
28     //-----------------------------------------------------------------
29     // ファイルヘッダー
30 
31     struct DataBlock;
32     struct LabelBlock;
33 
34     struct FileHeader : public Util::SoundFileHeader
35     {
36         const DataBlock* GetDataBlock() const;
37         const LabelBlock* GetLabelBlock() const;
38     };
39 
40     //-----------------------------------------------------------------
41     // データブロック
42 
43     struct DataBlockBody
44     {
45         u8 sequenceData[1];
GetSequenceDataSequenceSoundFile::DataBlockBody46         const void* GetSequenceData() const { return reinterpret_cast<const void*>(sequenceData); }
47     };
48 
49     struct DataBlock
50     {
51         ut::BinaryBlockHeader   header;
52         DataBlockBody           body;
53     };
54 
55     //-----------------------------------------------------------------
56     // ラベルブロック
57 
58     struct LabelInfo;
59     struct LabelBlockBody
60     {
61         // データ
62         Util::ReferenceTable labelInfoReferenceTable;
63 
64         // アクセサ
GetLabelCountSequenceSoundFile::LabelBlockBody65         inline int GetLabelCount() const { return labelInfoReferenceTable.count; }
66         const LabelInfo* GetLabelInfo( int index ) const;
67         const char* GetLabel( int index ) const;
68         const char* GetLabelByOffset( u32 offset ) const;
69         bool GetOffset( int index, u32* offsetPtr ) const;
70         bool GetOffsetByLabel( const char* label, u32* offsetPtr ) const;
71     };
72 
73     struct LabelBlock
74     {
75         ut::BinaryBlockHeader   header;
76         LabelBlockBody          body;           // ラベルデータ本体
77     };
78 
79     struct LabelInfo
80     {
81         Util::Reference referToSequenceData;    // DataBlockBody を基点とするリファレンス
82         ut::ResU32 labelStringLength;           // ラベル文字列の長さ
83         char label[1];
84     };
85 
86 };
87 
88 
89 } // namespace nw::snd::internal
90 } // namespace nw::snd
91 } // namespace nw
92 
93 
94 #endif /* NW_SND_SEQUENCE_SOUND_FILE_H_ */
95 
96