1 /*---------------------------------------------------------------------------*
2   Project:  Wavetable definitions for AX synthesizer
3   File:     wt.h
4 
5   Copyright 1998, 1999, 2000 Nintendo. 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   $Log: wt.h,v $
14   Revision 1.1.1.1  2005/12/29 06:53:27  hiratsu
15   Initial import.
16 
17   Revision 1.1.1.1  2005/05/12 02:41:07  yasuh-to
18   Ported from dolphin source tree.
19 
20 
21     3     2003/04/08 2:39p Akagi
22     Revised comments.
23 
24     2     2002/08/21 6:32p Akagi
25     Set #pragma warn_padding off around the WTSAMPLE{} definition.
26 
27     1     2001/05/09 1:28p Billyjack
28     Created
29 
30   $NoKeywords: $
31  *---------------------------------------------------------------------------*/
32 
33 #ifndef __WT_H__
34 #define __WT_H__
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 typedef struct WTART    // Translated DLS articulation block
41 {
42     // LFO
43     s32 lfoFreq;
44     s32 lfoDelay;
45     s32 lfoAtten;
46     s32 lfoPitch;
47     s32 lfoMod2Atten;
48     s32 lfoMod2Pitch;
49 
50     // EG1
51     s32 eg1Attack;
52     s32 eg1Decay;
53     s32 eg1Sustain;
54     s32 eg1Release;
55     s32 eg1Vel2Attack;
56     s32 eg1Key2Decay;
57 
58     // EG2
59     s32 eg2Attack;
60     s32 eg2Decay;
61     s32 eg2Sustain;
62     s32 eg2Release;
63     s32 eg2Vel2Attack;
64     s32 eg2Key2Decay;
65     s32 eg2Pitch;
66 
67     // Pan
68     s32 pan;
69 
70 } WTART;
71 
72 typedef struct WTREGION
73 {
74     u8  unityNote;
75     u8  keyGroup;
76 
77     s16 fineTune;
78     s32 attn;
79 
80     u32 loopStart;
81     u32 loopLength;
82 
83     u32 articulationIndex;  // Articulation index to reference
84     u32 sampleIndex;        // Sample index to reference
85 
86 } WTREGION;
87 
88 #ifdef  __MWERKS__
89 #pragma warn_padding off
90 #endif
91 
92 typedef struct WTSAMPLE
93 {
94     u16 format;     // ADPCM, PCM16, PCM8
95     u16 sampleRate; // Hz
96     u32 offset;     // Offset in samples from beginning of PCM file
97     u32 length;     // Length of sample in samples
98     u16 adpcmIndex; // ADPCM index to reference if in ADPCM mode
99 
100 } WTSAMPLE;
101 
102 #ifdef  __MWERKS__
103 #pragma warn_padding reset
104 #endif
105 
106 #define WT_FORMAT_ADPCM 0
107 #define WT_FORMAT_PCM16 1
108 #define WT_FORMAT_PCM8  2
109 
110 typedef struct WTADPCM
111 {
112 
113     // Values to program at start
114     u16     a[8][2];            //  coef table a1[0],a2[0],a1[1],a2[1]....
115     u16     gain;               //  Gain to be applied (0 for ADPCM, 0x0800 for PCM8/16)
116     u16     pred_scale;         //  Predictor / scale combination (nibbles, as in hardware)
117     u16     yn1;                //  y[n - 1]
118     u16     yn2;                //  y[n - 2]
119 
120     // Loop context
121     u16     loop_pred_scale;    //  Predictor / scale combination (nibbles, as in hardware)
122     u16     loop_yn1;           //  y[n - 1]
123     u16     loop_yn2;           //  y[n - 2]
124 
125 } WTADPCM;
126 
127 typedef struct WTINST   // Instrument
128 {
129 
130     u16 keyRegion[128];
131 
132 } WTINST;
133 
134 typedef struct WTFILEHEADER   // FILE
135 {
136 
137     u32 offsetPercussiveInst;
138     u32 offsetMelodicInst;
139     u32 offsetRegions;
140     u32 offsetArticulations;
141     u32 offsetSamples;
142     u32 offsetAdpcmContext;
143 
144     // Data
145 
146 } WTFILEHEADER;
147 
148 
149 #ifdef __cplusplus
150 }
151 #endif
152 
153 #endif // __WT_H__
154