1@***********************************************************
2@ File:         ARM_synth_constants.inc
3@ Processor:    ARM
4@ Description:  Contains constants and defines, most of which
5@               are mirrored in synth.h
6@
7@ Copyright Sonic Network Inc. 2004
8@****************************************************************
9@ Revision Control:
10@   $Revision: 741 $
11@   $Date: 2007-06-22 16:39:21 -0700 (Fri, 22 Jun 2007) $
12@****************************************************************
13
14
15    .ifdef  SAMPLE_RATE_8000
16    .equ    SYNTH_UPDATE_PERIOD_IN_BITS, 5
17    .equ    BUFFER_SIZE_IN_MONO_SAMPLES, 32
18    .endif
19
20    .ifdef  SAMPLE_RATE_16000
21    .equ    SYNTH_UPDATE_PERIOD_IN_BITS, 6
22    .equ    BUFFER_SIZE_IN_MONO_SAMPLES, 64
23    .endif
24
25    .ifdef  SAMPLE_RATE_20000
26    .equ    SYNTH_UPDATE_PERIOD_IN_BITS, 7
27    .equ    BUFFER_SIZE_IN_MONO_SAMPLES, 128
28    .endif
29
30    .ifdef  SAMPLE_RATE_22050
31    .equ    SYNTH_UPDATE_PERIOD_IN_BITS, 7
32    .equ    BUFFER_SIZE_IN_MONO_SAMPLES, 128
33    .endif
34
35    .ifdef  SAMPLE_RATE_24000
36    .equ    SYNTH_UPDATE_PERIOD_IN_BITS, 7
37    .equ    BUFFER_SIZE_IN_MONO_SAMPLES, 128
38    .endif
39
40    .ifdef  SAMPLE_RATE_32000
41    .equ    SYNTH_UPDATE_PERIOD_IN_BITS, 7
42    .equ    BUFFER_SIZE_IN_MONO_SAMPLES, 128
43    .endif
44
45    .ifdef  SAMPLE_RATE_44100
46    .equ    SYNTH_UPDATE_PERIOD_IN_BITS, 8
47    .equ    BUFFER_SIZE_IN_MONO_SAMPLES, 256
48    .endif
49
50    .ifdef  SAMPLE_RATE_48000
51    .equ    SYNTH_UPDATE_PERIOD_IN_BITS, 8
52    .equ    BUFFER_SIZE_IN_MONO_SAMPLES, 256
53    .endif
54
55
56@ if the OUTPUT PCM sample is 16-bits, then when using indexed addressing,
57@ the next sample is this many bytes away
58    .equ    NEXT_OUTPUT_PCM, 2
59
60@****************************************************************************
61@/* macros for fractional phase accumulator */
62    .equ    NUM_PHASE_FRAC_BITS, 15
63
64    .equ    PHASE_FRAC_MASK, 0x7FFF
65
66@ shift for phase accumulator when fraction carries over
67    .ifdef  SAMPLES_8_BIT
68    .equ    NEXT_INPUT_PCM_SHIFT, 0
69    .endif
70
71    .ifdef  SAMPLES_16_BIT
72    .equ    NEXT_INPUT_PCM_SHIFT, 1
73    .endif
74
75@****************************************************************************
76    .equ    NUM_MIXER_GUARD_BITS, 4
77
78@****************************************************************************
79@/* Envelope 1 (EG1) calculation macros */
80    .equ    NUM_EG1_FRAC_BITS, 15
81
82@****************************************************************************
83
84    .equ    NUM_ENHANCER_FILTER_COEF_FRAC_BITS, 5
85
86@****************************************************************************
87
88@
89@ I've temporarily given up on the idea of getting ADS/RV and gcc to
90@ handle a struct in a compatible fashion. Switching to old fashion EQU
91@
92
93    .if FILTER_ENABLED
94@**************************************
95@ typedef struct s_filter_tag
96    .equ    m_z1, 0
97    .equ    m_z2, 2
98    .endif
99
100@**************************************
101@ typedef struct s_wt_frame_tag
102    .equ    m_gainTarget, 0
103    .equ    m_phaseIncrement, 4
104
105    .if FILTER_ENABLED
106    .equ    m_k, 8
107    .equ    m_b1, 12
108    .equ    m_b2, 16
109    .equ    m_pAudioBuffer, 20
110    .equ    m_pMixBuffer, 24
111    .equ    m_numSamples, 28
112    .equ    m_prevGain, 32
113    .else
114    .equ    m_pAudioBuffer, 8
115    .equ    m_pMixBuffer, 12
116    .equ    m_numSamples, 16
117    .equ    m_prevGain, 20
118    .endif
119
120
121@**************************************
122@ typedef struct s_wt_voice_tag
123    .equ    m_pLoopEnd, 0   @ /* points to last PCM sample (not 1 beyond last) */
124    .equ    m_pLoopStart, 4 @ /* points to first sample at start of loop */
125    .equ    m_pPhaseAccum, 8    @ /* points to first sample at start of loop */
126    .equ    m_phaseFrac, 12 @ /* points to first sample at start of loop */
127
128    .if STEREO_OUTPUT
129    .equ    m_gainLeft, 16  @ /* current gain, left ch  */
130    .equ    m_gainRight, 18 @ /* current gain, right ch */
131    .endif
132
133
134@****************************************************************************
135@ enhancer
136    .equ    m_nEnhancerFeedForward1, 0
137    .equ    m_nEnhancerFeedback1, 1
138    .equ    m_nDriveCoef, 2
139    .equ    m_nEnhancerFeedback2, 3
140    .equ    m_nWet, 4
141    .equ    m_nDry, 5
142
143    .equ    m_zF0L, 6   @ filter 1 zero state var, left
144    .equ    m_zF1L, 8   @ filter 1 pole state var, left
145    .equ    m_zF2L, 10  @ filter 2 zero state var, left
146    .equ    m_zF0R, 12  @ filter 1 zero state var, right
147    .equ    m_zF1R, 14  @ filter 1 pole state var, right
148    .equ    m_zF2R, 16  @ filter 2 zero state var, right
149
150@****************************************************************************
151
152
153
154