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