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