1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     snd_BankFileReader.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: 25221 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_SND_BANK_FILE_READER_H_
17 #define NW_SND_BANK_FILE_READER_H_
18 
19 #include <nw/snd/snd_Global.h>      // AdshrCurve
20 #include <nw/snd/snd_BankFile.h>
21 
22 namespace nw {
23 namespace snd {
24 namespace internal {
25 
26 struct VelocityRegionInfo
27 {
28     u32 waveArchiveId;      // 波形アーカイブ ID
29     u32 waveIndex;          // 波形アーカイブ内インデックス
30 
31     f32 pitch;              // NW4R では tune という名前だった
32     AdshrCurve adshrCurve;
33 
34     u8 originalKey;
35     u8 volume;
36     u8 pan;
37 #ifdef NW_PLATFORM_RVL
38     u8 surroundPan;
39 #endif /* NW_PLATFORM_RVL */
40     bool isIgnoreNoteOff;   // true: ノートオフを無視する (=パーカッションモード)
41     u8 keyGroup;
42     u8 interpolationType;
43 };
44 
45 class BankFileReader
46 {
47 public:
48     static const u32 SIGNATURE_FILE = NW_UT_MAKE_SIGWORD( 'C', 'B', 'N', 'K' );
49 
50     BankFileReader( const void* bankFile );
51 
52     bool ReadVelocityRegionInfo(
53             VelocityRegionInfo* info,
54             int programNo,
55             int key,
56             int velocity
57     ) const;
58 
59     const Util::WaveIdTable& GetWaveIdTable() const;
60 
61     // デバッグ用
GetInstrumentCount()62     int GetInstrumentCount() const { return m_pInfoBlockBody->GetInstrumentCount(); }
63 
64 private:
65     const BankFile::FileHeader*     m_pHeader;
66     const BankFile::InfoBlockBody*  m_pInfoBlockBody;
67 };
68 
69 } // namespace nw::snd::internal
70 } // namespace nw::snd
71 } // namespace nw
72 
73 
74 #endif /* NW_SND_BANK_FILE_READER_H_ */
75 
76