1 /*---------------------------------------------------------------------------*
2   Project:  Mixer application for AX
3   File:     mix.h
4 
5   Copyright (C)1998-2006 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: mix.h,v $
14   Revision 1.7  07/24/2006 10:34:56  aka
15   Removed unused definitions.
16 
17   Revision 1.6  07/24/2006 10:14:45  aka
18   Removed test functions.
19 
20   Revision 1.5  07/24/2006 09:14:17  aka
21   Changed in ration to modification of AX lib.
22 
23   Revision 1.4  07/19/2006 07:50:33  aka
24   Modified to support controller speakers.
25 
26   Revision 1.3  02/09/2006 04:47:54  aka
27   Changed copyright.
28 
29   Revision 1.2  11/07/2005 06:47:18  aka
30   Changed for Revolution's audio spec.
31 
32   Revision 1.1.1.1  2005/05/12 02:41:06  yasuh-to
33   Imported from Dolphin tree.
34 
35     3     1/08/02 6:42p Billyjack
36     - Added DPL2 support
37 
38     2     5/30/01 3:09p Billyjack
39     added definitions for MIXSetSoundMode modes (stereo / mono)
40 
41     1     5/09/01 1:28p Billyjack
42     created
43 
44   $NoKeywords: $
45  *---------------------------------------------------------------------------*/
46 
47 #ifndef __MIX_H__
48 #define __MIX_H__
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 
55 /*---------------------------------------------------------------------------*
56     mixer sound mode definitions
57  *---------------------------------------------------------------------------*/
58 #define MIX_SOUND_MODE_MONO         OS_SOUND_MODE_MONO
59 #define MIX_SOUND_MODE_STEREO       OS_SOUND_MODE_STEREO
60 #define MIX_SOUND_MODE_SURROUND     2
61 #define MIX_SOUND_MODE_DPL2         3
62 
63 /*---------------------------------------------------------------------------*
64     mixer channel mode definitions
65  *---------------------------------------------------------------------------*/
66 #define MIX_MODE_AUXA_PREFADER      0x00000001
67 #define MIX_MODE_AUXB_PREFADER      0x00000002
68 #define MIX_MODE_AUXC_PREFADER      0x00000004
69 #define MIX_MODE_MUTE               0x00000008
70 
71 #define MIX_MODE_UPDATE_INPUT       0x10000000
72 #define MIX_MODE_UPDATE_INPUT1      0x20000000
73 #define MIX_MODE_UPDATE_MIX         0x40000000
74 #define MIX_MODE_UPDATE_MIX1        0x80000000
75 
76 /*---------------------------------------------------------------------------*
77     mixer channel mode definitions for remote speakers
78  *---------------------------------------------------------------------------*/
79 #define MIX_MODE_AUX0_PREFADER      0x00000001
80 #define MIX_MODE_AUX1_PREFADER      0x00000002
81 #define MIX_MODE_AUX2_PREFADER      0x00000004
82 #define MIX_MODE_AUX3_PREFADER      0x00000008
83 
84 /*---------------------------------------------------------------------------*
85  *---------------------------------------------------------------------------*/
86 typedef struct MIXChannel
87 {
88     AXVPB   *axvpb;
89 
90     u32     mode;
91 
92     int     input;
93     int     auxA;               // AUX send A
94     int     auxB;               // AUX send B
95     int     auxC;               // AUX send C
96     int     pan;                // 0 - 127 Left - Right
97     int     span;               // 0 - 127 Front - Back
98     int     fader;              // fader
99 
100     int     l;                  // left
101     int     r;                  // right
102     int     f;                  // front
103     int     b;                  // back
104     int     l1;                 // DPL2 left rear
105     int     r1;                 // DPL2 right rear
106 
107     u16     v;
108     u16     v1;
109     u16     vL;
110     u16     vL1;
111     u16     vR;
112     u16     vR1;
113     u16     vS;
114     u16     vS1;
115     u16     vAL;
116     u16     vAL1;
117     u16     vAR;
118     u16     vAR1;
119     u16     vAS;
120     u16     vAS1;
121     u16     vBL;
122     u16     vBL1;
123     u16     vBR;
124     u16     vBR1;
125     u16     vBS;
126     u16     vBS1;
127     u16     vCL;
128     u16     vCL1;
129     u16     vCR;
130     u16     vCR1;
131     u16     vCS;
132     u16     vCS1;
133 
134 } MIXChannel;
135 
136 typedef struct MIXRmtChannel
137 {
138     u32     mode;
139 
140     int     fader0;
141     int     fader1;
142     int     fader2;
143     int     fader3;
144 
145     int     aux0;
146     int     aux1;
147     int     aux2;
148     int     aux3;
149 
150     u16     vMain0;
151     u16     vMain0_1;
152     u16     vAux0;
153     u16     vAux0_1;
154 
155     u16     vMain1;
156     u16     vMain1_1;
157     u16     vAux1;
158     u16     vAux1_1;
159 
160     u16     vMain2;
161     u16     vMain2_1;
162     u16     vAux2;
163     u16     vAux2_1;
164 
165     u16     vMain3;
166     u16     vMain3_1;
167     u16     vAux3;
168     u16     vAux3_1;
169 
170 } MIXRmtChannel;
171 
172 
173 /*---------------------------------------------------------------------------*
174     Exposed function prototypes
175  *---------------------------------------------------------------------------*/
176 void    MIXInit             (void);
177 void    MIXQuit             (void);
178 void    MIXSetSoundMode     (u32 mode);
179 u32     MIXGetSoundMode     (void);
180 
181 void    MIXInitChannel      (
182                              AXVPB *p,      // pointer to voice
183                              u32 mode,      // initial aux A, B, mute modes
184                              int input,     // initial input atten / gain
185                              int auxA,      // initial aux A atten / gain
186                              int auxB,      // initial aux B atten / gain
187                              int auxC,      // initial aux C atten / gain
188                              int pan,       // initial pan
189                              int span,      // initial span
190                              int fader      // initial fader atten / gain
191                              );
192 
193 void    MIXReleaseChannel   (AXVPB *p);
194 
195 void    MIXResetControls    (AXVPB *p);
196 
197 void    MIXSetInput         (AXVPB *p, int dB);
198 void    MIXAdjustInput      (AXVPB *p, int dB);
199 int     MIXGetInput         (AXVPB *p);
200 
201 void    MIXAuxAPostFader    (AXVPB *p);
202 void    MIXAuxAPreFader     (AXVPB *p);
203 BOOL    MIXAuxAIsPostFader  (AXVPB *p);
204 void    MIXSetAuxA          (AXVPB *p, int dB);
205 void    MIXAdjustAuxA       (AXVPB *p, int dB);
206 int     MIXGetAuxA          (AXVPB *p);
207 
208 void    MIXAuxBPostFader    (AXVPB *p);
209 void    MIXAuxBPreFader     (AXVPB *p);
210 BOOL    MIXAuxBIsPostFader  (AXVPB *p);
211 void    MIXSetAuxB          (AXVPB *p, int dB);
212 void    MIXAdjustAuxB       (AXVPB *p, int dB);
213 int     MIXGetAuxB          (AXVPB *p);
214 
215 void    MIXAuxCPostFader    (AXVPB *p);
216 void    MIXAuxCPreFader     (AXVPB *p);
217 BOOL    MIXAuxCIsPostFader  (AXVPB *p);
218 void    MIXSetAuxC          (AXVPB *p, int dB);
219 void    MIXAdjustAuxC       (AXVPB *p, int dB);
220 int     MIXGetAuxC          (AXVPB *p);
221 
222 void    MIXSetPan           (AXVPB *p, int pan);
223 void    MIXAdjustPan        (AXVPB *p, int pan);
224 int     MIXGetPan           (AXVPB *p);
225 
226 void    MIXSetSPan          (AXVPB *p, int span);
227 void    MIXAdjustSPan       (AXVPB *p, int span);
228 int     MIXGetSPan          (AXVPB *p);
229 
230 void    MIXMute             (AXVPB *p);
231 void    MIXUnMute           (AXVPB *p);
232 BOOL    MIXIsMute           (AXVPB *p);
233 
234 void    MIXSetFader         (AXVPB *p, int dB);
235 void    MIXAdjustFader      (AXVPB *p, int dB);
236 int     MIXGetFader         (AXVPB *p);
237 
238 void    MIXUpdateSettings   (void);
239 
240 void    MIXRmtSetVolumes    (
241                              AXVPB *axvpb,   // pointer to voice
242                              u32    mode,    // aux0,1,2,3 modes
243                              int    fader0,  // initial fader0 atten / gain
244                              int    fader1,  // initial fader1 atten / gain
245                              int    fader2,  // initial fader2 atten / gain
246                              int    fader3,  // initial fader3 atten / gain
247                              int    aux0,    // initial aux0   atten / gain
248                              int    aux1,    // initial aux1   atten / gain
249                              int    aux2,    // initial aux2   atten / gain
250                              int    aux3     // initial aux3   atten / gain
251                             );
252 
253 void    MIXRmtAuxPostFader  (AXVPB *p, int num);
254 void    MIXRmtAuxPreFader   (AXVPB *p, int num);
255 BOOL    MIXRmtAuxIsPostFader(AXVPB *p, int num);
256 
257 void    MIXRmtSetAux        (AXVPB *p, int num, int dB);
258 void    MIXRmtAdjustAux     (AXVPB *p, int num, int dB);
259 int     MIXRmtGetAux        (AXVPB *p, int num);
260 
261 void    MIXRmtSetFader      (AXVPB *p, int num, int dB);
262 void    MIXRmtAdjustFader   (AXVPB *p, int num, int dB);
263 int     MIXRmtGetFader      (AXVPB *p, int num);
264 
265 #ifdef __cplusplus
266 }
267 #endif
268 
269 #endif // __MIX_H__
270