/[openvortex]/alsa/pci/au88x0/au88x0_a3d.c
ViewVC logotype

Diff of /alsa/pci/au88x0/au88x0_a3d.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mjander, Mon Sep 22 03:51:28 2003 UTC revision 1.4 by mjander, Wed Nov 19 23:48:50 2003 UTC
# Line 8  Line 8 
8   * A3D. You may think i'm crazy, but this may work someday. Who knows...   * A3D. You may think i'm crazy, but this may work someday. Who knows...
9   ****************************************************************************/   ****************************************************************************/
10    
11  /* CA3dSourceHw */  #include "au88x0_a3d.h"
12  void Asp4A3DTopology::MakeConnections(void) {  #include "au88x0_a3ddata.c"
13          if (this_34 == 0) {  #include "au88x0.h"
14                  /* Connect A3DOUT to MIXIN */  
15                  Asp4Topology::Route((int) 1, (uchar) this_0c->this_0c,  void a3dsrc_SetTimeConsts(a3dsrc_t *a, short HrtfTrack, short ItdTrack, short GTrack, short CTrack) {
16                          (uchar) this_08->this_04, (uchar) this_10 + 0x50, (uchar) this_14+0x50);          vortex_t *vortex = (vortex_t*)a->vortex;
17                  /* Connect MIXIN's this_10 and this_14 to MIXOUT this_18 */          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_HrtfTrackTC), HrtfTrack);
18                  (CAsp4Mix)this_18::EnableInput(int this_10);          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_ITDTrackTC), ItdTrack);
19                  (CAsp4Mix)this_18::EnableInput(int this_14);          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_GainTrackTC), GTrack);
20                  /* Connect MIXOUT this_18 to SRCIN this_0c */          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_CoeffTrackTC), CTrack);
                 Asp4Topology::Route((int) 1, (uchar) this_0c,  
                         (uchar) this_18->this_08 + 0x30, (uchar) this_0c + 0x40);  
                 /* Connect SRCOUT this_0c to A3DIN this_20 */  
                 Asp4Topology::Route((int) 1, (uchar) 0x11,  
                         (uchar) this_0c->this0c + 0x20, (uchar) this_20 + 0x70);  
         } else {  
                 if (this_08) {  
                         /* Connect this_08 to SRCIN this_0c */  
                         Asp4Topology::Route((int) 1, (uchar) this_0c,  
                                 (uchar) this_08->this_04, (uchar) this_0c + 0x40);  
                         /* Connect SRCOUT this_0c to A3DIN this_20 */  
                         Asp4Topology::Route((int) 1, (uchar) 0x11,  
                                 (uchar) this_0c->this0c + 0x20, (uchar) this_20 + 0x70);                  
                 } else {  
                         // I'm tired. I going to sleep now .  
                           
                 }  
         }  
           
 }  
   
 void CA3dSourceHw::CA3dSourceHw(CAsp4HwIO *hwio, int a,int b) {  
         CA3dSourceHw->this00 = hwio;  
         CA3dSourceHw->this04 = a;  
         CA3dSourceHw->this08 = b;  
 }  
   
 void CA3dSourceHw::Initialize(int a, int b) {  
         CA3dSourceHw->this04 = a;  
         CA3dSourceHw->this08 = b;  
         CA3dSourceHw::ZeroState(void);  
 }  
   
 #define addr(a,b,c) (a + (c << 0xd) + (d*(1 + (8*4 - 3)*8))*4)  
   
 void CA3dSourceHw::SetTimeConsts(short a, short b, short c, short d) {  
         hwwrite(vortex->mmio, addr(0x1837C, this04, this08),  a);  
         hwwrite(vortex->mmio, addr(0x18388, this04, this08),  b);  
         hwwrite(vortex->mmio, addr(0x18380, this04, this08),  c);  
         hwwrite(vortex->mmio, addr(0x18384, this04, this08),  d);  
21  }  }
22    
23  void CA3dSourceHw::GetTimeConsts(short a, short b, short c, short d) {  void a3dsrc_GetTimeConsts(a3dsrc_t *a,  short *HrtfTrack, short *ItdTrack, short *GTrack, short *CTrack) {
24                    // stub!
25  }  }
26    
27  /* Atmospheric absorbtion. */  /* Atmospheric absorbtion. */
28  void CA3dSourceHw::SetAtmosTarget(short a,short b,short c,short d,short e) {  
29          hwwrite(vortex->mmio, addr(0x190Ec, this04, this08), (e << 0x10) | d);  void a3dsrc_SetAtmosTarget(a3dsrc_t *a, short aa,short b,short c,short d,short e) {
30          hwwrite(vortex->mmio, addr(0x190F4, this04, this08), (b << 0x10) | a);          vortex_t *vortex = (vortex_t*)a->vortex;
31          hwwrite(vortex->mmio, addr(0x190FC, this04, this08), c);          //hwwrite(vortex->mmio, addr(0x190Ec, this04, this08), (e << 0x10) | d);
32            hwwrite(vortex->mmio,a3d_addr(a->slice,a->source,A3D_B_A21Target),(e << 0x10) | d);
33            //hwwrite(vortex->mmio, addr(0x190F4, this04, this08), (b << 0x10) | a);
34            hwwrite(vortex->mmio,a3d_addr(a->slice,a->source,A3D_B_B10Target),(b << 0x10) | aa);
35            //hwwrite(vortex->mmio, addr(0x190FC, this04, this08), c);
36            hwwrite(vortex->mmio,a3d_addr(a->slice,a->source,A3D_B_B2Target), c);
37  }  }
38    
39  void CA3dSourceHw::SetAtmosTarget(short *a,short *b,short *c,short *d,short *e) {  void a3dsrc_GetAtmosTarget(a3dsrc_t *a, short *aa,short *b,short *c,short *d,short *e) {
40  }  }
41    
42  void CA3dSourceHw::SetAtmosCurrent(short a,short b,short c,short d,short e) {  void a3dsrc_SetAtmosCurrent(a3dsrc_t *a, short aa,short b,short c,short d,short e) {
43          hwwrite(vortex->mmio, addr(0x190E8, this04, this08), (e << 0x10) | d);          vortex_t *vortex = (vortex_t*)a->vortex;
44          hwwrite(vortex->mmio, addr(0x190f0, this04, this08), (b << 0x10) | a);          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_A12Current), (e << 0x10) | d);
45          hwwrite(vortex->mmio, addr(0x190f8, this04, this08), c);          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_B01Current), (b << 0x10) | aa);
46            hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_B2Current), c);
47  }  }
48    
49  void CA3dSourceHw::GetAtmosCurrent(short *a,short *b,short *c,short *d,short *e) {  void a3dsrc_GetAtmosCurrent(a3dsrc_t *a, short *aa, short *b, short *c, short *d, short *e) {
50          *d = hwread(vortex->mmio, addr(0x180e8, this04, this08));          vortex_t *vortex = (vortex_t*)a->vortex;
51          *e = hwread(vortex->mmio, addr(0x190e8, this04, this08));          *d = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_A12Current));
52          *b = hwread(vortex->mmio, addr(0x180f0, this04, this08));          *e = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_A12Current));
53          *a = hwread(vortex->mmio, addr(0x190f0, this04, this08));          *b = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_B01Current));
54          *c = hwread(vortex->mmio, addr(0x180f8, this04, this08));          *aa = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_B01Current));
55            *c = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_B2Current));
56  }  }
57    
58  void CA3dSourceHw::SetAtmosState(short a,short b,short c,short d) {  void a3dsrc_SetAtmosState(a3dsrc_t *a, short aa,short b,short c,short d) {
59          hwwrite(vortex->mmio, addr(0x1838C, this04, this08), a);          vortex_t *vortex = (vortex_t*)a->vortex;
60          hwwrite(vortex->mmio, addr(0x18390, this04, this08), b);          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_x1), aa);
61          hwwrite(vortex->mmio, addr(0x18394, this04, this08), c);          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_x2), b);
62          hwwrite(vortex->mmio, addr(0x18398, this04, this08), d);          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_y1), c);
63            hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_y2), d);
64  }  }
65    
66  void CA3dSourceHw::GetAtmosState(short a,short b,short c,short d) {  void a3dsrc_GetAtmosState(a3dsrc_t *a, short aa,short b,short c,short d) {
67                    
68  }  }
69    
70    
71  #define addr2(a,b,c, i) (a + (((this08<<0xb)+i)<<2) + (this04*(5*9*2 - 1)*4*2))  /* HRTF */
72  void CA3dSourceHw::SetHrtfTarget(short const *a,short const     *b) {  
73    void a3dsrc_SetHrtfTarget(a3dsrc_t *a, short const *aa, short const *b) {
74            vortex_t *vortex = (vortex_t*)a->vortex;
75          int i;          int i;
76                    
77          for (i=0; i<0x38; i++)          for (i=0; i<HRTF_SZ; i++)
78                  hwwrite(vortex->mmio, addr2(0x19100, this04, this08, i), (b[i]<<0x10) | a[i]);                  hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_HrtfTarget + (i<<2)), (b[i]<<0x10) | aa[i]);
79  }  }
80    
81  void CA3dSourceHw::GetHrtfTarget(short const *a,short const     *b) {  void a3dsrc_GetHrtfTarget(a3dsrc_t *a, short *aa, short *b) {
82            vortex_t *vortex = (vortex_t*)a->vortex;
83            int i;
84            
85            for (i=0; i<HRTF_SZ; i++)
86                    aa[i] = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_HrtfTarget + (i<<2)));
87            for (i=0; i<HRTF_SZ; i++)
88                    b[i] = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_HrtfTarget + (i<<2)));  
89  }  }
90    
91  void CA3dSourceHw::SetHrtfCurrent(short const *a,short const *b) {  void a3dsrc_SetHrtfCurrent(a3dsrc_t *a, short const *aa, short const *b) {
92            vortex_t *vortex = (vortex_t*)a->vortex;
93          int i;          int i;
94                    
95          for (i=0; i<0x38; i++)          for (i=0; i<HRTF_SZ; i++)
96                  hwwrite(vortex->mmio, addr2(0x19000, this04, this08, i), (b[i]<<0x10) | a[i]);                    hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_HrtfCurrent + (i<<2)), (b[i]<<0x10) | aa[i]);
97  }  }
98    
99  void CA3dSourceHw::GetHrtfCurrent(short const *a,short const *b) {  void a3dsrc_GetHrtfCurrent(a3dsrc_t *a, short *aa, short *b) {
100            vortex_t *vortex = (vortex_t*)a->vortex;
101          int i;          int i;
102          // FIXME: verify this!          
103          for (i=0; i<0x38; i++)          for (i=0; i<HRTF_SZ; i++)
104                  a[i] = hwread(vortex->mmio, addr2(0, this04+0xc, this08, i));                  aa[i] = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_HrtfCurrent + (i<<2)));
105          for (i=0; i<0x38; i++)          for (i=0; i<HRTF_SZ; i++)
106                  b[i] = hwread(vortex->mmio, addr2(0x19000, this04, this08, i));                  b[i] = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_HrtfCurrent + (i<<2)));
107  }  }
108  void CA3dSourceHw::SetHrtfState(short const *a,short const *b) {  
109    void a3dsrc_SetHrtfState(a3dsrc_t *a, short const *aa, short const *b) {
110            vortex_t *vortex = (vortex_t*)a->vortex;
111          int i;          int i;
112                    
113          for (i=0; i<0x38; i++)          for (i=0; i<HRTF_SZ; i++)
114                  hwwrite(vortex->mmio, addr2(0x191e8, this04, this08, i), (b[i]<<0x10) | a[i]);                    hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_HrtfDelayLine + (i<<2)), (b[i]<<0x10) | aa[i]);
115  }  }
116    
117  void CA3dSourceHw::GetHrtfState(short const *a,short const *b) {  void a3dsrc_GetHrtfState(a3dsrc_t *a, short *aa, short *b) {
118            vortex_t *vortex = (vortex_t*)a->vortex;
119          int i;          int i;
120          // FIXME: verify this!          // FIXME: verify this!
121          for (i=0; i<0x38; i++)          for (i=0; i<HRTF_SZ; i++)
122                  a[i] = hwread(vortex->mmio, addr2(0, this04+0x6a, this08, i));                  aa[i] = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_HrtfDelayLine + (i<<2)));
123          for (i=0; i<0x38; i++)          for (i=0; i<HRTF_SZ; i++)
124                  b[i] = hwread(vortex->mmio, addr2(0x191e8, this04, this08, i));                  b[i] = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_HrtfDelayLine + (i<<2)));      
125  }  }
126    
127  void CA3dSourceHw::GetHrtfOutput(short *left,short *right) {  void a3dsrc_GetHrtfOutput(a3dsrc_t *a, short *left, short *right) {
128          *left = hwread(vortex->mmio, addr(0x1839C, this04, this08));          vortex_t *vortex = (vortex_t*)a->vortex;
129          *right = hwread(vortex->mmio, addr(0x183A0, this04, this08));          *left = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_HrtfOutL));
130  }          *right = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_HrtfOutR));
131    }
132  void CA3dSourceHw::SetHrtfOutput(short left,short right) {  
133          hwwrite(vortex->mmio, addr(0x1839C, this04, this08), left);  void a3dsrc_SetHrtfOutput(a3dsrc_t *a, short left,short right) {
134          hwwrite(vortex->mmio, addr(0x183a0, this04, this08), right);          vortex_t *vortex = (vortex_t*)a->vortex;
135            hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_HrtfOutL), left);
136            hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_HrtfOutR), right);
137  }  }
138    
139  /* Interaural Time Difference.  /* Interaural Time Difference.
140   * "The other main clue that humans use to locate sounds, is called   * "The other main clue that humans use to locate sounds, is called
141   * Interaural Time Difference (ITD). The differences in distance from   * Interaural Time Difference (ITD). The differences in distance from
142   * the sound source to a listeners ears means  that the sound will   * the sound source to a listeners ears means  that the sound will
143   * reach one ear slightly before the other...." */   * reach one ear slightly before the other....", found somewhere with google.*/
144  void CA3dSourceHw::SetItdTarget(short litd,short ritd) {  void a3dsrc_SetItdTarget(a3dsrc_t *a, short litd,short ritd) {
145            vortex_t *vortex = (vortex_t*)a->vortex;
146            
147          if (litd < 0)          if (litd < 0)
148                  litd = 0;                  litd = 0;
149          if (litd > 0x57FF)          if (litd > 0x57FF)
# Line 166  void CA3dSourceHw::SetItdTarget(short li Line 152  void CA3dSourceHw::SetItdTarget(short li
152                  ritd = 0;                  ritd = 0;
153          if (ritd > 0x57FF)          if (ritd > 0x57FF)
154                  ritd = 0x57FF;                  ritd = 0x57FF;
155          hwwrite(vortex->mmio, addr(0x191DF+5, this04, this08), (ritd<<0x10)|litd);          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_ITDTarget), (ritd<<0x10)|litd);
156            //hwwrite(vortex->mmio, addr(0x191DF+5, this04, this08), (ritd<<0x10)|litd);
157  }  }
158    
159  void CA3dSourceHw::GetItdTarget(short *litd, short *ritd) {  void a3dsrc_GetItdTarget(a3dsrc_t *a, short *litd, short *ritd) {
160          *ritd = hwread(vortex->mmio, addr(0x181E4, this04, this08));          vortex_t *vortex = (vortex_t*)a->vortex;
161          *litd = hwread(vortex->mmio, addr(0x191E4, this04, this08));          *ritd = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_ITDTarget));
162            *litd = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_ITDTarget));
163  }  }
164    
165  void CA3dSourceHw::SetItdCurrent(short litd, short ritd) {  void a3dsrc_SetItdCurrent(a3dsrc_t *a, short litd, short ritd) {
166            vortex_t *vortex = (vortex_t*)a->vortex;
167            
168            if (litd < 0)
169                  litd = 0;                  litd = 0;
170          if (litd > 0x57FF)          if (litd > 0x57FF)
171                  litd = 0x57FF;                  litd = 0x57FF;
# Line 182  void CA3dSourceHw::SetItdCurrent(short l Line 173  void CA3dSourceHw::SetItdCurrent(short l
173                  ritd = 0;                  ritd = 0;
174          if (ritd > 0x57FF)          if (ritd > 0x57FF)
175                  ritd = 0x57FF;                  ritd = 0x57FF;
176          hwwrite(vortex->mmio, addr(0x191DF+1, this04, this08), (ritd<<0x10)|litd);          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_ITDCurrent), (ritd<<0x10)|litd);
177            //hwwrite(vortex->mmio, addr(0x191DF+1, this04, this08), (ritd<<0x10)|litd);
178  }  }
179    
180  void CA3dSourceHw::GetItdCurrent(short *litd,short *ritd) {  void a3dsrc_GetItdCurrent(a3dsrc_t *a, short *litd,short *ritd) {
181          *ritd = hwread(vortex->mmio, addr(0x181E0, this04, this08));          vortex_t *vortex = (vortex_t*)a->vortex;
182          *litd = hwread(vortex->mmio, addr(0x191E0, this04, this08));          
183            *ritd = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_ITDCurrent));
184            *litd = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_ITDCurrent));
185  }  }
186    
187  void CA3dSourceHw::SetItdDline(short const      *dline) {  void a3dsrc_SetItdDline(a3dsrc_t *a, short const *dline) {
188            vortex_t *vortex = (vortex_t*)a->vortex;
189          int i;          int i;
190                    /* 45 != 40 -> Check this ! */
191          for (i=0; i<0x28; i++)          for (i=0; i<DLINE_SZ; i++)
192                  hwwrite(vortex->mmio, addr2(0x182C8, this04, this08, i), dline[i])                  hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_ITDDelayLine + (i<<2)), dline[i]);
193  }  }
194    
195  void CA3dSourceHw::GetItdDline(short *dline) {  void a3dsrc_GetItdDline(a3dsrc_t *a, short *dline) {
196            vortex_t *vortex = (vortex_t*)a->vortex;
197          int i;          int i;
198                    
199          for (i=0; i<0x28; i++)          for (i=0; i<DLINE_SZ; i++)
200                  dline[i] = hwwrite(vortex->mmio, addr2(0x182C8, this04, this08, i));                      dline[i] = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_ITDDelayLine + (i<<2)));    
201    }
202    
203    /* This is may be used for IID Interaural Intensity Difference. */
204    
205    void a3dsrc_SetGainTarget(a3dsrc_t *a, short aa, short b) {
206            vortex_t *vortex = (vortex_t*)a->vortex;
207            hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_GainTarget), (b<<0x10)|aa);
208  }  }
209    
210  /* This is maybe used for IID Interaural Intensity Difference. */  void a3dsrc_GetGainTarget(a3dsrc_t *a, short *aa, short *b) {
211  void CA3dSourceHw::SetGainTarget(short a,short b) {          vortex_t *vortex = (vortex_t*)a->vortex;
212          hwwrite(vortex->mmio, addr(0x190E4, this04, this08), (b<<0x10)|a);          *b = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_GainTarget));
213            *aa = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_GainTarget));
214  }  }
215    
216  void CA3dSourceHw::GetGainTarget(short *,short *) {  void a3dsrc_SetGainCurrent(a3dsrc_t *a, short aa, short b) {
217          *b = hwread(vortex->mmio, addr(0x180e4, this04, this08));          vortex_t *vortex = (vortex_t*)a->vortex;
218          *a = hwread(vortex->mmio, addr(0x190e4, this04, this08));          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_GainCurrent), (b<<0x10)|aa);
219            //hwwrite(vortex->mmio, addr(0x190DC+4, this04, this08), (b<<0x10)|a);
220  }  }
221    
222  void CA3dSourceHw::SetGainCurrent(short a,short b) {  void a3dsrc_GetGainCurrent(a3dsrc_t *a, short *aa, short *b) {
223          hwwrite(vortex->mmio, addr(0x190DC+4, this04, this08), (b<<0x10)|a);          vortex_t *vortex = (vortex_t*)a->vortex;
224            *b = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_A_GainCurrent));
225            *aa = hwread(vortex->mmio, a3d_addr(a->slice, a->source, A3D_B_GainCurrent));
226  }  }
227    
228  void CA3dSourceHw::GetGainCurrent(short *a,short *b) {  /* CA3dIO this func seems to be inlined all over this place. */
229          *b = hwread(vortex->mmio, addr(0x180e0, this04, this08));  void CA3dIO_WriteReg(a3dsrc_t *a, unsigned long addr, short aa, short b) {
230          *a = hwread(vortex->mmio, addr(0x190e0, this04, this08));          vortex_t *vortex = (vortex_t*)a->vortex;
231            hwwrite(vortex->mmio, addr, (aa<<0x10)|b);
232  }  }
233    
234  /* Generic A3D stuff */  /* Generic A3D stuff */
235  void CA3dSourceHw::SetA3DSampleRate(int sr) {  
236    void a3dsrc_SetA3DSampleRate(a3dsrc_t *a, int sr) {
237            vortex_t *vortex = (vortex_t*)a->vortex;
238          int esp0 = 0;          int esp0 = 0;
239            
240          esp0 = (((esp0 & 0x7fffffff)|0xB8000000)&0x7) | ((sr&0x1f)<<3);          esp0 = (((esp0 & 0x7fffffff)|0xB8000000)&0x7) | ((sr&0x1f)<<3);
241          hwwrite(vortex->mmio, 0x19C38 + (this08<<0xd), esp0);          hwwrite(vortex->mmio, A3D_SLICE_Control + (a->slice<<0xd), esp0);
242            //hwwrite(vortex->mmio, 0x19C38 + (this08<<0xd), esp0);
243  }  }
244    
245  void CA3dSourceHw::GetA3DSampleRate(int *sr) {  void a3dsrc_GetA3DSampleRate(a3dsrc_t *a, int *sr) {
246          *sr = ((hwread(vortex->mmio, 0x19C38 + (this08<<0xd))>>3)&0x1f);          vortex_t *vortex = (vortex_t*)a->vortex;
247                    *sr = ((hwread(vortex->mmio, A3D_SLICE_Control + (a->slice << 0xd))>>3)&0x1f);
248            //*sr = ((hwread(vortex->mmio, 0x19C38 + (this08<<0xd))>>3)&0x1f);
249  }  }
250    
251  void CA3dSourceHw::EnableA3D(void) {  void a3dsrc_EnableA3D(a3dsrc_t *a) {
252          hwwrite(vortex->mmio, 19C38 + (this08<<0xd), 0xF0000001);          vortex_t *vortex = (vortex_t*)a->vortex;
253            hwwrite(vortex->mmio, A3D_SLICE_Control + (a->slice << 0xd), 0xF0000001);
254            //hwwrite(vortex->mmio, 0x19C38 + (this08<<0xd), 0xF0000001);
255  }  }
256    
257  void CA3dSourceHw::DisableA3D(void) {  void a3dsrc_DisableA3D(a3dsrc_t *a) {
258          hwwrite(vortex->mmio, 19C38 + (this08<<0xd), 0xF0000000);          vortex_t *vortex = (vortex_t*)a->vortex;
259            hwwrite(vortex->mmio, A3D_SLICE_Control + (a->slice << 0xd), 0xF0000000);
260  }  }
261    
262  void CA3dSourceHw::SetA3DControlReg(unsigned long ctrl) {  void a3dsrc_SetA3DControlReg(a3dsrc_t *a, unsigned long ctrl) {
263          hwwrite(vortex->mmio, 19C38 + (this08<<0xd), ctrl);          vortex_t *vortex = (vortex_t*)a->vortex;
264            hwwrite(vortex->mmio, A3D_SLICE_Control + (a->slice << 0xd), ctrl);
265  }  }
266    
267  void CA3dSourceHw::GetA3DControlReg(unsigned long *ctrl) {  void a3dsrc_GetA3DControlReg(a3dsrc_t *a, unsigned long *ctrl) {
268          *ctrl = hwread(vortex->mmio, 19C38 + (this08<<0xd));          vortex_t *vortex = (vortex_t*)a->vortex;
269            *ctrl = hwread(vortex->mmio, A3D_SLICE_Control + (a->slice << 0xd));
270  }  }
271    
272  void CA3dSourceHw::SetA3DPointerReg(unsigned long ptr) {  void a3dsrc_SetA3DPointerReg(a3dsrc_t *a, unsigned long ptr) {
273          hwwrite(vortex->mmio, 19c40 + (this08<<0xd), ctrl);          vortex_t *vortex = (vortex_t*)a->vortex;
274            hwwrite(vortex->mmio, A3D_SLICE_Pointers + (a->slice << 0xd), ptr);
275  }  }
276    
277  void CA3dSourceHw::GetA3DPointerReg(unsigned long *ptr) {  void a3dsrc_GetA3DPointerReg(a3dsrc_t *a, unsigned long *ptr) {
278          *ptr = hwread(vortex->mmio, 19C40 + (this08<<0xd));          vortex_t *vortex = (vortex_t*)a->vortex;
279            *ptr = hwread(vortex->mmio, A3D_SLICE_Pointers + (a->slice << 0xd));
280  }  }
281    
282  void CA3dSourceHw::ZeroSliceIO(void) {  void a3dsrc_ZeroSliceIO(a3dsrc_t *a) {
283            vortex_t *vortex = (vortex_t*)a->vortex;
284          int i;          int i;
285                    
286          for (i=0; i<8; i++)          for (i=0; i<8; i++)
287                  hwwrite(vortex->mmio, 0x19C00 + (((this08<<0xb)+i)*4), 0);                  hwwrite(vortex->mmio, A3D_SLICE_VDBDest + (((a->slice << 0xb)+i)*4), 0);
288          for (i=0; i<4; i++)          for (i=0; i<4; i++)
289                  hwwrite(vortex->mmio, 0x19C20 + (((this08<<0xb)+i)*4), 0);                        hwwrite(vortex->mmio, A3D_SLICE_VDBSource + (((a->slice << 0xb)+i)*4), 0);      
290  }  }
291    
292  void CA3dSourceHw::ZeroState(void) {  /* Reset Single A3D source. */
293          int i;  void a3dsrc_ZeroState(a3dsrc_t *a) {
294                    
295          CA3dSourceHw::SetAtmosState(0,0,0,0);          a3dsrc_SetAtmosState(a, 0,0,0,0);
296          CA3dSourceHw::SetHrtfState(A3dHrirZeros, A3dHrirZeros);          a3dsrc_SetHrtfState(a, A3dHrirZeros, A3dHrirZeros);
297          CA3dSourceHw::SetItdDline(A3dItdDlineZeros, A3dItdDlineZeros);          a3dsrc_SetItdDline(a, A3dItdDlineZeros);
298          CA3dSourceHw::SetHrtfOutput(0, 0);          a3dsrc_SetHrtfOutput(a, 0, 0);
299          CA3dSourceHw::SetTimeConsts(0,0,0,0);          a3dsrc_SetTimeConsts(a, 0,0,0,0);
300          CA3dSourceHw::SetAtmosCurrent(0,0,0,0,0);          a3dsrc_SetAtmosCurrent(a, 0,0,0,0,0);
301          CA3dSourceHw::SetAtmosTarget(0,0,0,0,0);          a3dsrc_SetAtmosTarget(a, 0,0,0,0,0);
302          CA3dSourceHw::SetItdCurrent(0,0);          a3dsrc_SetItdCurrent(a, 0,0);
303          CA3dSourceHw::SetItdTarget(0,0);          a3dsrc_SetItdTarget(a, 0,0);
304          CA3dSourceHw::SetGainCurrent(0,0);          a3dsrc_SetGainCurrent(a, 0,0);
305          /* The person who originally wrote this surely was smoking crack ...          /* The person who originally wrote this surely was smoking crack ...*/
306          /* (or his/her compiler) */          /* (or his/her compiler) */
307          CA3dIO::WriteReg(190E4 + (this08<<0xd) + (this04*5*9*2 - this04)*8,0,0);          //CA3dIO_WriteReg(a->vortex, A3D_B_GainTarget + (a->slice << 0xd) + (a->source *5*9*2 - a->source)*8,0,0);
308            CA3dIO_WriteReg(a, a3d_addr(a->slice, a->source, A3D_B_GainTarget),0,0);
309                    
310          CA3dSourceHw::SetHrtfCurrent(A3dHrirZeros, A3dHrirZeros);          a3dsrc_SetHrtfCurrent(a, A3dHrirZeros, A3dHrirZeros);
311          CA3dSourceHw::SetHrtfTarget(A3dHrirZeros, A3dHrirZeros)          a3dsrc_SetHrtfTarget(a, A3dHrirZeros, A3dHrirZeros);
312  }  }
313    
314  void CA3dSourceHw::ZeroStateA3D(void) {  /* Reset entire A3D engine */
315    void a3dsrc_ZeroStateA3D(a3dsrc_t *a) {
316          int i, ii, var, var2;          int i, ii, var, var2;
317                    
318          CA3dSourceHw::SetA3DControlReg(0);          a3dsrc_SetA3DControlReg(a, 0);
319          CA3dSourceHw::SetA3DPointerReg(0);          a3dsrc_SetA3DPointerReg(a, 0);
320          var = this08;          var = a->slice;
321          var2 = this04; // ??          var2 = a->source;
322          for (ii=0; ii<4; ii++) {          for (i=0; i<4; i++) {
323                  this08 = ii;                  a->slice = i;
324                                    a3dsrc_ZeroSliceIO(a);
325                  CA3dSourceHw::ZeroSliceIO(void);                  for (ii=0; ii<4; ii++) {
326                  CA3dSourceHw::ZeroState(void);                            a->source = ii;
327                            a3dsrc_ZeroState(a);
328                    }
329          }          }
330          this04 = var2;          a->source = var2;
331          this08 = var;          a->slice = var;
332  }  }
333    
334  /* Program A3D block as pass through */  /* Program A3D block as pass through */
335  void CA3dSourceHw::ProgramPipe(void) {  void a3dsrc_ProgramPipe(a3dsrc_t *a) {
336          CA3dSourceHw::SetTimeConsts(0,0,0,0);          a3dsrc_SetTimeConsts(a, 0,0,0,0);
337          CA3dSourceHw::SetAtmosCurrent(0, 0x4000, 0,0,0);          a3dsrc_SetAtmosCurrent(a, 0x4000,0,0,0,0);
338          CA3dSourceHw::SetAtmosTarget(0x4000,0,0,0,0);          a3dsrc_SetAtmosTarget(a, 0x4000,0,0,0,0);
339          CA3dSourceHw::SetItdCurrent(0,0);          a3dsrc_SetItdCurrent(a, 0,0);
340          CA3dSourceHw::SetItdTarget(0,0);          a3dsrc_SetItdTarget(a, 0,0);
341          CA3dSourceHw::SetGainCurrent(0x7fff,0x7fff);          a3dsrc_SetGainCurrent(a, 0x7fff,0x7fff);
342          CA3dSourceHw::SetGainTarget(0x7fff,0x7fff);          a3dsrc_SetGainTarget(a, 0x7fff,0x7fff);
343          CA3dSourceHw::SetHrtfCurrent(A3dHrirImpulse, A3dHrirImpulse);          a3dsrc_SetHrtfCurrent(a, A3dHrirImpulse, A3dHrirImpulse);
344          CA3dSourceHw::SetHrtfTarget(A3dHrirImpulse, A3dHrirImpulse);          a3dsrc_SetHrtfTarget(a, A3dHrirImpulse, A3dHrirImpulse);
345  }  }
346  /* VDB = Vortex audio Dataflow Bus */  /* VDB = Vortex audio Dataflow Bus */
347  void CA3dSourceHw::ClearVDBData(unsigned long a) {  void a3dsrc_ClearVDBData(a3dsrc_t *a, unsigned long aa) {
348          hwwrite(vortex->mmio, 0x19c00 + (((a>>2)*255*4)+a)*8, 0);          vortex_t *vortex = (vortex_t*)a->vortex;
349          hwwrite(vortex->mmio, 0x19c04 + (((a>>2)*255*4)+a)*8, 0);          hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_SLICE_VDBDest), 0);
350            hwwrite(vortex->mmio, a3d_addr(a->slice, a->source, A3D_SLICE_VDBDest + 4), 0);
351            /*
352            hwwrite(vortex->mmio, 0x19c00 + (((aa>>2)*255*4)+aa)*8, 0);
353            hwwrite(vortex->mmio, 0x19c04 + (((aa>>2)*255*4)+aa)*8, 0);
354            */
355  }  }
 /*CA3dIO*/  
356    
357  void CA3dIO::WriteReg(unsigned long addr, short a, short b) {  
358          hwwrite(vortex->mmio, addr, (a<<0x10)|b);  #if 0
359    /* Asp4A3DTopology */
360    void Asp4A3DTopology__MakeConnections(vortex_t * vortex) {
361            if (this_34 == 1) {             /* Source, is mixed with something else. */
362                    /* Connect 0x50 to MIXIN */
363                    Asp4Topology_Route((int) 1, (uchar) this_0c->this_0c,
364                            (uchar) this_08->this_04, (uchar) this_10 + 0x50, (uchar) this_14+0x50);
365                    /* Connect MIXIN's this_10 and this_14 to MIXOUT this_18 */
366                    (CAsp4Mix)this_18_EnableInput(int this_10);
367                    (CAsp4Mix)this_18_EnableInput(int this_14);
368                    /* Connect MIXOUT this_18 to SRCIN this_0c */
369                    Asp4Topology_Route((int) 1, (uchar) this_0c,
370                            (uchar) this_18->this_08 + 0x30, (uchar) this_0c + 0x40);
371                    /* Connect SRCOUT this_0c to A3DIN this_20 */
372                    Asp4Topology_Route((int) 1, (uchar) 0x11,
373                            (uchar) this_0c->this0c + 0x20, (uchar) this_20 + 0x70);
374            } else {                /* Source, directly piped through SRC (doppler) into A3D. */
375                    if (this_08) { /* Route ADB DMA to A3D */
376                            /* Connect this_08 to SRCIN this_0c */
377                            Asp4Topology_Route((int) 1, (uchar) this_0c,
378                                    (uchar) this_08->this_04, (uchar) this_0c + 0x40);
379                            /* Connect SRCOUT this_0c to A3DIN this_20 */
380                            Asp4Topology_Route((int) 1, (uchar) 0x11,
381                                    (uchar) this_0c->this0c + 0x20, (uchar) this_20 + 0x70);                
382                    } else {        /* Looks like route to DSP coprocessor ? */
383                            /* Connect WT to A3DIN this_20 */
384                            Asp4Topology_Route((int) 1, (uchar) 0x11,
385                                    //(uchar) ((((this_24->this04 <= 0x20)?0x1:0)-1)&0xFFFFFFC0)+0x80+(this_24->this04&0x1f),
386                                    //(uchar) (((this_24->this04 > 0x20)?0:0xFFFFFFC0)+0x80+(this_24->this04&0x1f),
387                                    //(uchar) ((((this_24->this04 < 0x20)?0x1:0)-1)&0xFFFFFFC0)+0x80+(this_24->this04&0x1f),
388                                    (uchar) ((this_24->this04 > 0x20)?0x80:0x40)+(this_24->this04 & 0x1f),
389                                    (uchar) this_20 + 0x70);                
390                            /* Search for mixers referred by 0x8f, 0x90 and return in this_38, this_3c */
391                            
392                            /* Connect WT to A3DIN this_2c */
393                            Asp4Topology_Route((int) 1, (uchar) 0x11,
394                                    (uchar) ((this_24->this04 > 0x20)?0x80:0x40)+(this_24->this04 & 0x1f),
395                                    (uchar) this_2c + 0x70);
396                            /* Enable output to mixers this_0x38 and this_0x3c */
397                            (CAsp4Mix)this_38_EnableInput(int this_2c);
398                            (CAsp4Mix)this_3c_EnableInput(int this_2c);    
399                            /* Set mixer volumes */
400                    }
401            }
402    }
403    
404    void Asp4A3DTopology__MakeDisconnections(void) {
405            char mix0, mix1;
406            
407            if (this_28 == 0)
408                    return;
409            
410            if (this_34 == 1) {
411                    
412                    
413            } else {
414                    
415                    
416            }
417    }
418    
419    void Asp4Topology__AllocA3D(class CResource *arg_0, (int) arg_4) {
420            /* Fail path has been left out for now. */
421            Asp4A3DTopology_Asp4A3DTopology((CResource *)arg_0, (Asp4Topology *)this_00);
422            Asp4A3DTopology_Create((int) arg_4, (SPEAKER_OUTPUTMODE) this_15C);
423            if (!this_84->this_0c)
424                    CList<TopologyObj *>_NewBlock(void);
425            /* Looks like initialization of a linked list */
426            this_84->this_0c = *this_84->this_0c;
427            *(this_84->this_0c) = 0;
428            *(this_84->this_10) = 0;
429            *this->84->this_08++;
430            *this->84->this_04 = Asp4A3DTopology;
431            
432            if ()
433             //line 68242
434            
435    }
436    #endif
437    
438    /* A3D HwSource stuff. */
439    
440    void vortex_A3dSourceHw_Initialize(vortex_t *v, int source, int slice) {
441            a3dsrc_t *a3dsrc = &(v->a3d[source + (slice*4)]);
442            
443            a3dsrc->vortex = (void *)v;
444            a3dsrc->source = source; /* source */
445            a3dsrc->slice = slice; /* slice */
446            a3dsrc_ZeroState(a3dsrc);
447  }  }
448    
449  /* CHrtf */  /* CHrtf */
450  void CHrtf::CHrtf(void) {  #if 0
451    void CHrtf_CHrtf(void) {
452          this_00 = 0;          this_00 = 0;
453          this_04 = 0;          this_04 = 0;
454          this_08 = 0;          this_08 = 0;
455  }  }
456  void CHrtf::Initialize(int arg_0 ,int arg_4 ,short *arg_8) {  void CHrtf_Initialize(int arg_0 ,int arg_4 ,short *arg_8) {
457          this_04 = arg_0;          this_04 = arg_0;
458          this_00 = arg_4;          this_00 = arg_4;
459          this_08 = *arg_8;          this_08 = *arg_8;
460  }  }
461  void CHrtf::InterpolateHrtf(short *arg_0, short *arg_4, short *arg_8) {  void CHrtf_InterpolateHrtf(short *arg_0, short *arg_4, short *arg_8) {
462                    // No thanks for now :D
           
463  }  }
464    #endif
465  /* CVort3dRend */  /* CVort3dRend */
466    #if 0
467  void CVort3DRend::CVort3DRend(class CAsp4Core *core, class CAsp4HwIO *hwio) {  void Vort3DRend_Vort3DRend(class CAsp4Core *core, class CAsp4HwIO *hwio) {
468          this00 = core;          this00 = core;
469          this04 = hwio;          this04 = hwio;
470          this08 = 0;          this08 = 0;
471  }  }
472    
473  void CVort3DRend::~CVort3DRend(void) {  void Vort3DRend__Vort3DRend(void) {
474          if (this08)          if (this08)
475                  operator delete(this08);                  operator delete(this08);
476  }  }
477    #endif
478  int CVort3DRend::Initialize(unsigned short a) {  int Vort3DRend_Initialize(vortex_t *v, unsigned short mode) {
479          if (this00 == 0)          v->xt_mode = mode; /* this_14 */
480                  return -1;          
481          this14 = a;          //vortex_XtalkHw_CXtalkHw(v, this04);
482          CXtalkHw = operator new(4);  
483          CXtalkHw::CXtalkHw(this04);          vortex_XtalkHw_SetGains(v, asXtalkGainsAllChan);
484            if (v->xt_mode) {
485          CXtalkHw::SetGains(XtalkGainsAllChan);                  //if (this08==0xffff) {
486          if (this14) {                  if (v->xt_mode == XT_SPEAKER0) {
                 if (this08==0xffff) {  
487                          /* Speaker type 1 ? */                          /* Speaker type 1 ? */
488                          CXtalkHw::ProgramXtalkNarrow(void);                          vortex_XtalkHw_ProgramXtalkNarrow(v);
489                  } else{                  } else{
490                          /* Speaker type 2 ? */                          /* Speaker type 2 ? */
491                          CXtalkHw::ProgramXtalkWide(void)                          vortex_XtalkHw_ProgramXtalkWide(v)
492                  }                  }
493          } else {          } else {
494                  /* Headphones ? */                  /* Headphones ? */
495                  CXtalkHw::ProgramPipe(void);                  vortex_XtalkHw_ProgramPipe(v);
496          }          }
497          CXtalkHw::SetSampleRate(0x11);          vortex_XtalkHw_SetSampleRate(v, 0x11);
498          CXtalkHw::Enable(void);          vortex_XtalkHw_Enable(v);
499  }  }
500    
501  int CVort3DRend::SetGlobalControl(struct _XTALKctrl *xtctrl) {  int Vort3DRend_SetGlobalControl(vortex_t *v) {
502          if (xtctrl==0)          /*
                 return 0;  
           
503          this0c->this04 = xtctrl->this04;          this0c->this04 = xtctrl->this04;
504          this0c->this08 = xtctrl->this08;          this0c->this08 = xtctrl->this08;
505          this0c->this0c = xtctrl->this0c;          this0c->this0c = xtctrl->this0c;
506                    
507          this0c = xtctrl->this00;          this0c = xtctrl->this00;
508          CXtalkHw = this08;          CXtalkHw = this08;
509          if (this14) {          */
510                  if (this08==0xffff)          
511                          CXtalkHw::ProgramXtalkNarrow(void);          if (v->xt_mode) {
512                  else                  if (v->xt_mode == XT_SPEAKER0) {
513                          CXtalkHw::ProgramXtalkWide(void)                          /* Speaker type 1 */
514                            vortex_XtalkHw_ProgramXtalkNarrow(v);
515                    } else {
516                            /* Speaker type 2 */
517                            vortex_XtalkHw_ProgramXtalkWide(v)
518                    }
519          } else {          } else {
520                  CXtalkHw::ProgramPipe(void);                  /* Headphones */
521                    vortex_XtalkHw_ProgramPipe(v);
522          }          }
523  }  }
524    
525  int  CVort3DRend::GetGlobalControl(struct _XTALKctrl *xtctrl) {  int Vort3DRend_GetGlobalControl(struct _XTALKctrl *xtctrl) {
526    
527  }  }
528  int CVort3DRend::AddBuffer(class CVort3dWave *a) {  #if 0
529    int Vort3DRend_AddBuffer(class CVort3dWave *a) {
530          return 0;          return 0;
531  }  }
532  int CVort3DRend::RemoveBuffer(class CVort3dWave *a) {  int Vort3DRend_RemoveBuffer(class CVort3dWave *a) {
533          return 0;          return 0;
534  }  }
535    #endif
536  /* CVort3dWave */  /* CVort3dWave */
537  void CVort3dWave::CVort3dWave(class CAsp4Core *,class CAsp4HwIO *,class CHrtfMgr *) {  #if 0
538    void CVort3dWave_CVort3dWave(class CAsp4Core *,class CAsp4HwIO  *,class CHrtfMgr *) {
539                    
540  }  }
541  //174743  //174743
542  void CVort3dWave::Initialize(struct _ASPWAVEFORMAT * arg_0, void (__stdcall *)(class CAuWave *,char *,unsigned long,int,unsigned long,unsigned long),unsigned long arg_4 ,void *arg_c) {  void CVort3dWave_Initialize(struct _ASPWAVEFORMAT * arg_0, void (__stdcall *)(class CAuWave *,char *,unsigned long,int,unsigned long,unsigned long),unsigned long arg_4 ,void *arg_c) {
543          a3dsource_t a3d;          a3dsource_t a3d;
544          CWave::Initialize(_ASPWAVEFORMAT *arg_0 ,ASPDIRECTION 0,void (*)(CAuWave *,char *,ulong ,int,ulong,ulong) arg_4,void *arg_c, ulong 1);          CWave_Initialize(_ASPWAVEFORMAT *arg_0 ,ASPDIRECTION 0,void (*)(CAuWave *,char *,ulong ,int,ulong,ulong) arg_4,void *arg_c, ulong 1);
545                    
546          this_320 = 0;          this_320 = 0;
547          this_324 = 0;          this_324 = 0;
# Line 437  void CVort3dWave::Initialize(struct _ASP Line 562  void CVort3dWave::Initialize(struct _ASP
562          this_788 = 0;          this_788 = 0;
563          this_7cc = 0;          this_7cc = 0;
564                                    
565          if ((a3d = CAdbTopology::GetA3DSource(void)) < 0) {          if ((a3d = CAdbTopology_GetA3DSource(void)) < 0) {
566                  (CAsp4Core)this_318::GetProperty((COREPROPERTY) 4, void *arg_c, (ulong) 4);                  (CAsp4Core)this_318_GetProperty((COREPROPERTY) 4, void *arg_c, (ulong) 4);
567                  if (arg_c == 1)                  if (arg_c == 1)
568                          return 8007000E;                          return 8007000E;
569          } else {          } else {
# Line 449  void CVort3dWave::Initialize(struct _ASP Line 574  void CVort3dWave::Initialize(struct _ASP
574          }          }
575  }  }
576                    
577  void CVort3DWave::SetLRGains(void) {  void CVort3DWave_SetLRGains(void) {
578                    
579                    
580  }  }
581    
582  int  CVort3dWave::Set3dParms(unsigned long offset, unsigned long arg4, void * arg8) {  int  CVort3dWave_Set3dParms(unsigned long offset, unsigned long arg4, void * arg8) {
583                    
584          if (offset)          if (offset)
585                  return 80070057;                  return 80070057;
586          if (arg4 == 0xf6) {          if (arg4 == 0xf6) {
587                  CVort3dWave::Anzio3dToSuperCtrl((Anzio3d *) arg8, (A3DCTRL_SRC_SUPER *) this_370);                  CVort3dWave_Anzio3dToSuperCtrl((Anzio3d *) arg8, (A3DCTRL_SRC_SUPER *) this_370);
588                  CVort3dWave::Set3dParms((A3DCTRL_SRC_SUPER *) this_370);                  CVort3dWave_Set3dParms((A3DCTRL_SRC_SUPER *) this_370);
589                  return 0;                  return 0;
590          }          }
591          if (arg4 == 0x40) {          if (arg4 == 0x40) {
592                  CVort3dWave::Set3dParms((A3DCTRL_SRC_SUPER *) arg8)                  CVort3dWave_Set3dParms((A3DCTRL_SRC_SUPER *) arg8)
593          }          }
594  }  }
595    
596  int  CVort3dWave::Set3dParms(struct A3DCTRL_SRC_SUPER *) {  int  CVort3dWave_Set3dParms(struct A3DCTRL_SRC_SUPER *) {
597          int var14;          int var14;
598          struct var0 {          struct var0 {
599                  int a;                  int a;
# Line 477  int  CVort3dWave::Set3dParms(struct A3DC Line 602  int  CVort3dWave::Set3dParms(struct A3DC
602          };          };
603    
604          CAsp4Core = this_318;          CAsp4Core = this_318;
605          CAsp4Core::GetProperty((COREPROPERTY) 4, (void *) &var14, (ulong) 4);          CAsp4Core_GetProperty((COREPROPERTY) 4, (void *) &var14, (ulong) 4);
606          CAsp4Core::GetProperty((COREPROPERTY) 1, (void *) &var0+0x10, (ulong) 0x10);          CAsp4Core_GetProperty((COREPROPERTY) 1, (void *) &var0+0x10, (ulong) 0x10);
607          if ((var0.b != this_354)||(var14 != this_350)) {          if ((var0.b != this_354)||(var14 != this_350)) {
608                  this_354 = var0.b;                  this_354 = var0.b;
609                  this_350 = var14;                  this_350 = var14;
610                  CHrtfMgr = this_344;                  CHrtfMgr = this_344;
611                  if (var14 == 1) {                  if (var14 == 1) {
612                          if (var0.b)                          if (var0.b)
613                                  CHrtfMgr::Initialize((ulong) 0xBB80, (ulong) 0x3a, (ulong) 0x102)                                  CHrtfMgr_Initialize((ulong) 0xBB80, (ulong) 0x3a, (ulong) 0x102)
614                          else                          else
615                                  CHrtfMgr::Initialize((ulong) 0xBB80, (ulong) 2, (ulong) 0x101);                                  CHrtfMgr_Initialize((ulong) 0xBB80, (ulong) 2, (ulong) 0x101);
616                  } else                  } else
617                          CHrtfMgr::Initialize((ulong) 0xBB80, (ulong) 0x38, (ulong) 0);                          CHrtfMgr_Initialize((ulong) 0xBB80, (ulong) 0x38, (ulong) 0);
618          }          }
619          if (var14 == 1) {          if (var14 == 1) {
620                  if (var0.b == 0)                  if (var0.b == 0)
621                          CVort3dWave::RenderQuadPan((A3DCTRL_SRC_SUPER *) arg0);                          CVort3dWave_RenderQuadPan((A3DCTRL_SRC_SUPER *) arg0);
622                  else                  else
623                          CVort3dWave::RenderSuperQuad((A3DCTRL_SRC_SUPER *) arg0);                          CVort3dWave_RenderSuperQuad((A3DCTRL_SRC_SUPER *) arg0);
624                  return 0;                  return 0;
625          }          }
626          eax = CAdbTopology::GetA3DSource(void);          eax = CAdbTopology_GetA3DSource(void);
627          if (eax >= 0)          if (eax >= 0)
628                  CVort3dWave::Render3d((A3DCTRL_SRC_SUPER *) arg0);                  CVort3dWave_Render3d((A3DCTRL_SRC_SUPER *) arg0);
629          else          else
630                  CVort3dWave::Render2d((A3DCTRL_SRC_SUPER *) arg0);                  CVort3dWave_Render2d((A3DCTRL_SRC_SUPER *) arg0);
631          return 0;          return 0;
632  }  }
633    
634  void CVort3dWave::Render2d(struct A3DCTRL_SRC_SUPER *) {  void CVort3dWave_Render2d(struct A3DCTRL_SRC_SUPER *) {
635                    
636          CVort3dWave::Calc2d(A3DCTRL_EAR *,A3DCTRL_EAR   *,float,ulong *,_ASPVOLUME *);          CVort3dWave_Calc2d(A3DCTRL_EAR *,A3DCTRL_EAR    *,float,ulong *,_ASPVOLUME *);
637                    
638          CVort3dWave::SetLRGains(void);          CVort3dWave_SetLRGains(void);
639          CAdbTopology::SetFilter(ulong);          CAdbTopology_SetFilter(ulong);
640                    
641  }  }
642  void CVort3dWave::Render3d(struct A3DCTRL_SRC_SUPER *) {  void CVort3dWave_Render3d(struct A3DCTRL_SRC_SUPER *) {
643                            
644          CA3dSourceHw::SetAtmosTarget(short,short,short,short,short);          a3dsrc_SetAtmosCurrent(a, 0x4000,0,0,0,0);
645          CA3dSourceHw::SetAtmosCurrent(short,short,short,short,short);          a3dsrc_SetAtmosTarget(a, 0x4000,0,0,0,0);
646          CVort3dWave::SetLRGains(void);          CVort3DWave_SetLRGains(void);
         CA3dSourceHw::SetHrtfTarget(short const *,short const *);  
         CA3dSourceHw::SetHrtfCurrent(short const *,short const *)  
         CA3dSourceHw::SetItdTarget(short,short);  
647                    
648            a3dsrc_SetHrtfTarget(a, A3dHrirImpulse, A3dHrirImpulse);
649            a3dsrc_SetHrtfCurrent(a, A3dHrirImpulse, A3dHrirImpulse);
650                    
651            a3dsrc_SetItdTarget(a, 0,0);
652    
653  }  }
654    
655  void CVort3dWave::RenderQuadPan(struct A3DCTRL_SRC_SUPER *) {  void CVort3dWave_RenderQuadPan(struct A3DCTRL_SRC_SUPER *) {
656                    
657                    
658  }  }
659    
660  void CAdbTopology::SetFilter(unsigned long a) {  void CAdbTopology_SetFilter(unsigned long a) {
661          int eax;          int eax;
662                    
663          if (this_1E0 == 0)          if (this_1E0 == 0)
664                  return;  // "CAdbTopology::SetFilter - m_pWtDma not available\n"                  return;  // "CAdbTopology_SetFilter - m_pWtDma not available\n"
665          if (a) {          if (a) {
666                  if (a & 0xFFFF0000)                  if (a & 0xFFFF0000)
667                          eax = 0xcf;                          eax = 0xcf;
# Line 556  void CAdbTopology::SetFilter(unsigned lo Line 682  void CAdbTopology::SetFilter(unsigned lo
682                  eax = 0;                  eax = 0;
683          this_1E4 = (this_1E4 & 0xFFFFFF) | (eax << 0x18);          this_1E4 = (this_1E4 & 0xFFFFFF) | (eax << 0x18);
684          this_1E8 = this_1E4 | 1;          this_1E8 = this_1E4 | 1;
685          AuWt::WriteReg(0x204 + (this_1DC << 4), this_1E8);          AuWt_WriteReg(0x204 + (this_1DC << 4), this_1E8);
686          AuWt::WriteReg(0x200 + (this_1DC << 4), this_1E4);          AuWt_WriteReg(0x200 + (this_1DC << 4), this_1E4);
687  }  }
688    
689  void AuWt::WriteReg(unsigned long addr, unsigned long data) {  void AuWt_WriteReg(unsigned long addr, unsigned long data) {
690          hwwrite(vortex->mmio, (this_04 << 0xf) + addr, data);          hwwrite(vortex->mmio, (this_04 << 0xf) + addr, data);
691  }  }
692    
693  int  AuWt::ReadReg(unsigned long addr) {  int  AuWt_ReadReg(unsigned long addr) {
694          return hwread(vortex->mmio, (this_04 << 0xf) + addr);          return hwread(vortex->mmio, (this_04 << 0xf) + addr);
695  }  }
696    #endif
697    /* 3D Sound renderer. creeepy... */
698    
699    
700    /* A3D base support (de)allocator */
701    void vortex_Vort3D(vortex_t *v, int en) {
702            int i;
703            
704            /* Alloc mixer resources */
705            v->mixa3d[0] = vortex_adb_checkinout(v, v->fixed_res, en, VORTEX_RESOURCE_MIXOUT);
706            v->mixa3d[1] = vortex_adb_checkinout(v, v->fixed_res, en, VORTEX_RESOURCE_MIXOUT);
707            v->mixxtlk[0] = vortex_adb_checkinout(v, v->fixed_res, en, VORTEX_RESOURCE_MIXIN);
708            v->mixxtlk[1] = vortex_adb_checkinout(v, v->fixed_res, en, VORTEX_RESOURCE_MIXIN);
709            
710            /* Connect Crosstalk canceler to audio outputs. */
711    #if 1
712            vortex_route(v, en, 0x11, v->mixa3d[0], ADB_XTALKIN(0));
713            vortex_route(v, en, 0x11, v->mixa3d[1], ADB_XTALKIN(1));
714            vortex_route(v, en, 0x11, ADB_XTALKOUT(0), v->mixxtlk[0]);
715            vortex_route(v, en, 0x11, ADB_XTALKOUT(1), v->mixxtlk[1]);
716            
717            vortex_connection_mixin_mix(v, en, v->mixxtlk[0], v->mixplayb[0], 0);
718            vortex_connection_mixin_mix(v, en, v->mixxtlk[1], v->mixplayb[1], 0);
719            if (VORTEX_IS_QUAD(v)) {
720                    vortex_connection_mixin_mix(v, en, v->mixxtlk[0], v->mixplayb[2], 0);
721                    vortex_connection_mixin_mix(v, en, v->mixxtlk[1], v->mixplayb[3], 0);          
722            }
723    #ifndef CHIP_AU8820
724            vortex_connection_mixin_mix(v, en, v->mixxtlk[0], v->mixspdif[0], 0);
725            vortex_connection_mixin_mix(v, en, v->mixxtlk[1], v->mixspdif[1], 0);
726    #endif
727    #endif
728            /*
729            Vort3DRend_Initialize(v, 0);
730            for (i=0; i<NR_A3D; i++)
731                    vortex_A3dSourceHw_Initialize(v, i % 4, i / 4);
732            a3dsrc_ZeroStateA3D(&(v->a3d[0]));
733            */
734    }
735    
736    /* Initialize one single A3D source. */
737    void vortex_Vort3D_InitializeSource(a3dsrc_t *a, int en) {
738            if (en) {
739                    a3dsrc_ZeroState(a);
740                    a3dsrc_SetTimeConsts(a, HrtfTCDefault, ItdTCDefault, GainTCDefault ,CoefTCDefault);
741                    a3dsrc_SetGainTarget(a,0,0);
742                    a3dsrc_SetGainCurrent(a,0,0);
743                    a3dsrc_EnableA3D(a);
744                    /* Set as pipe for now for testing. */
745                    a3dsrc_ProgramPipe(a);
746            } else
747                    a3dsrc_DisableA3D(a);
748    }
749    
750    /*
751     Function:
752     vortex_Vort3D_setparms(a3dsrc_t *a, a3d_params_t *p, unsigned int mask)
753    
754     Purpose: Set 3D hardware sound source parameters.
755     Parameters:
756            a3d_params_t *p: parameter set.
757            mask: set only parameters indicated by mask (flags yet to be defined).
758    
759     */
760    void vortex_Vort3D_setparms(a3dsrc_t *a, a3d_params_t *p, unsigned int mask) {
761            
762            /* Atmospheric absorbtion and filtering. */
763            a3dsrc_SetAtmosTarget(a, p->atmos_target[0],p->atmos_target[1],
764                            p->atmos_target[2],p->atmos_target[3],p->atmos_target[4]);
765            a3dsrc_SetAtmosCurrent(a, p->atmos_current[0],p->atmos_current[1],
766                            p->atmos_current[2],p->atmos_current[3],p->atmos_current[4]);
767            
768            /* Left Right panning. */
769            a3dsrc_SetGainTarget(a, p->gainL, p->gainR);
770            a3dsrc_SetGainCurrent(a, p->gainL, p->gainR);
771            
772            /* Head related transfer function. */
773            a3dsrc_SetHrtfTarget(a, p->hrtf_target[0], p->hrtf_target[1]);
774            a3dsrc_SetHrtfCurrent(a, p->hrtf_current[0], p->hrtf_current[1]);
775            
776            /* Inter aural time difference. */
777            a3dsrc_SetItdTarget(a, p->itd_target[0], p->itd_target[1]);
778            a3dsrc_SetItdTarget(a, p->itd_current[0], p->itd_current[1]);
779            a3dsrc_SetItdDline(a, p->dline);
780    }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26