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