1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     snd_WaveSoundFileReader.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: 24221 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_SND_WAVE_SOUND_FILE_READER_H_
17 #define NW_SND_WAVE_SOUND_FILE_READER_H_
18 
19 #include <nw/snd/snd_WaveSoundFile.h>
20 #include <nw/snd/snd_Global.h>      // AUX_BUS_NUM
21 
22 namespace nw {
23 namespace snd {
24 namespace internal {
25 
26 struct WaveSoundInfo;
27 struct WaveSoundNoteInfo;
28 
29 class WaveSoundFileReader
30 {
31 public:
32     static const u32 SIGNATURE_FILE = NW_UT_MAKE_SIGWORD( 'C', 'W', 'S', 'D' );
33 
34     WaveSoundFileReader( const void* waveSoundFile );
IsAvailable()35     bool IsAvailable() const { return m_pHeader != NULL; }
36 
37     u32 GetWaveSoundCount() const;
38     u32 GetNoteInfoCount( u32 index ) const;
39     u32 GetTrackInfoCount( u32 index ) const;
40 
41     bool ReadWaveSoundInfo( WaveSoundInfo* dst, u32 index ) const;
42     bool ReadNoteInfo( WaveSoundNoteInfo* dst, u32 index, u32 noteIndex ) const;
43 
44 private:
45     const WaveSoundFile::FileHeader*    m_pHeader;
46     const WaveSoundFile::InfoBlockBody* m_pInfoBlockBody;
47 };
48 
49 struct WaveSoundInfo
50 {
51     f32 pitch;
52     AdshrCurve adshr;
53     u8 pan;
54     u8 surroundPan;
55     u8 mainSend;
56     u8 fxSend[ AUX_BUS_NUM ];
57 };
58 
59 struct WaveSoundNoteInfo
60 {
61     u32 waveArchiveId;
62     s32 waveIndex;
63     AdshrCurve adshr;
64     u8 originalKey;
65     u8 pan;
66     u8 surroundPan;
67     u8 volume;
68     f32 pitch;
69     // TODO: SendValue を入れる? (バイナリには入れれる)
70 };
71 
72 } // namespace nw::snd::internal
73 } // namespace nw::snd
74 } // namespace nw
75 
76 #endif /* NW_SND_WAVE_SOUND_FILE_READER_H_ */
77 
78