33 a3dsrc_SetTimeConsts(
a3dsrc_t *
a,
short HrtfTrack,
short ItdTrack,
34 short GTrack,
short CTrack)
49 a3dsrc_GetTimeConsts(
a3dsrc_t * a,
short *HrtfTrack,
short *ItdTrack,
50 short *GTrack,
short *CTrack)
59 a3dsrc_SetAtmosTarget(
a3dsrc_t * a,
short aa,
short b,
short c,
short d,
74 a3dsrc_SetAtmosCurrent(
a3dsrc_t * a,
short aa,
short b,
short c,
short d,
89 a3dsrc_SetAtmosState(
a3dsrc_t * a,
short x1,
short x2,
short y1,
short y2)
100 a3dsrc_GetAtmosTarget(
a3dsrc_t * a,
short *aa,
short *b,
short *c,
105 a3dsrc_GetAtmosCurrent(
a3dsrc_t * a,
short *bb01,
short *ab01,
short *b2,
106 short *aa12,
short *ba12)
127 a3dsrc_GetAtmosState(
a3dsrc_t * a,
short *x1,
short *x2,
short *y1,
short *y2)
145 (b[i] << 0x10) | aa[
i]);
158 (b[i] << 0x10) | aa[
i]);
171 (b[i] << 0x10) | aa[
i]);
235 static void a3dsrc_GetHrtfOutput(
a3dsrc_t * a,
short *left,
short *right)
253 static void a3dsrc_SetItdTarget(
a3dsrc_t * a,
short litd,
short ritd)
267 (ritd << 0x10) | litd);
271 static void a3dsrc_SetItdCurrent(
a3dsrc_t * a,
short litd,
short ritd)
285 (ritd << 0x10) | litd);
301 static void a3dsrc_GetItdTarget(
a3dsrc_t * a,
short *litd,
short *ritd)
312 static void a3dsrc_GetItdCurrent(
a3dsrc_t * a,
short *litd,
short *ritd)
339 static void a3dsrc_SetGainTarget(
a3dsrc_t * a,
short left,
short right)
344 (right << 0x10) | left);
347 static void a3dsrc_SetGainCurrent(
a3dsrc_t * a,
short left,
short right)
352 (right << 0x10) | left);
356 static void a3dsrc_GetGainTarget(
a3dsrc_t * a,
short *left,
short *right)
367 static void a3dsrc_GetGainCurrent(
a3dsrc_t * a,
short *left,
short *right)
379 static void CA3dIO_WriteReg(
a3dsrc_t * a,
unsigned long addr,
short aa,
short b)
388 static void a3dsrc_SetA3DSampleRate(
a3dsrc_t * a,
int sr)
393 esp0 = (((esp0 & 0x7fffffff) | 0xB8000000) & 0x7) | ((sr & 0x1f) << 3);
398 static void a3dsrc_EnableA3D(
a3dsrc_t * a)
406 static void a3dsrc_DisableA3D(
a3dsrc_t * a)
413 static void a3dsrc_SetA3DControlReg(
a3dsrc_t * a,
unsigned long ctrl)
419 static void a3dsrc_SetA3DPointerReg(
a3dsrc_t * a,
unsigned long ptr)
426 static void a3dsrc_GetA3DSampleRate(
a3dsrc_t * a,
int *sr)
434 static void a3dsrc_GetA3DControlReg(
a3dsrc_t * a,
unsigned long *ctrl)
440 static void a3dsrc_GetA3DPointerReg(
a3dsrc_t * a,
unsigned long *ptr)
447 static void a3dsrc_ZeroSliceIO(
a3dsrc_t * a)
452 for (i = 0; i < 8; i++)
455 ((((a->
slice) << 0
xb) + i) << 2), 0);
456 for (i = 0; i < 4; i++)
459 ((((a->
slice) << 0
xb) + i) << 2), 0);
463 static void a3dsrc_ZeroState(
a3dsrc_t * a)
469 a3dsrc_SetAtmosState(a, 0, 0, 0, 0);
470 a3dsrc_SetHrtfState(a, A3dHrirZeros, A3dHrirZeros);
471 a3dsrc_SetItdDline(a, A3dItdDlineZeros);
472 a3dsrc_SetHrtfOutput(a, 0, 0);
473 a3dsrc_SetTimeConsts(a, 0, 0, 0, 0);
475 a3dsrc_SetAtmosCurrent(a, 0, 0, 0, 0, 0);
476 a3dsrc_SetAtmosTarget(a, 0, 0, 0, 0, 0);
477 a3dsrc_SetItdCurrent(a, 0, 0);
478 a3dsrc_SetItdTarget(a, 0, 0);
479 a3dsrc_SetGainCurrent(a, 0, 0);
480 a3dsrc_SetGainTarget(a, 0, 0);
482 a3dsrc_SetHrtfCurrent(a, A3dHrirZeros, A3dHrirZeros);
483 a3dsrc_SetHrtfTarget(a, A3dHrirZeros, A3dHrirZeros);
487 static void a3dsrc_ZeroStateA3D(
a3dsrc_t * a)
492 printk(
KERN_ERR "vortex: ZeroStateA3D: ERROR: a->vortex is NULL\n");
496 a3dsrc_SetA3DControlReg(a, 0);
497 a3dsrc_SetA3DPointerReg(a, 0);
501 for (i = 0; i < 4; i++) {
503 a3dsrc_ZeroSliceIO(a);
511 static void a3dsrc_ProgramPipe(
a3dsrc_t * a)
513 a3dsrc_SetTimeConsts(a, 0, 0, 0, 0);
514 a3dsrc_SetAtmosCurrent(a, 0, 0x4000, 0, 0, 0);
515 a3dsrc_SetAtmosTarget(a, 0x4000, 0, 0, 0, 0);
516 a3dsrc_SetItdCurrent(a, 0, 0);
517 a3dsrc_SetItdTarget(a, 0, 0);
518 a3dsrc_SetGainCurrent(a, 0x7fff, 0x7fff);
519 a3dsrc_SetGainTarget(a, 0x7fff, 0x7fff);
524 a3dsrc_SetHrtfCurrent(a, A3dHrirImpulse, A3dHrirImpulse);
525 a3dsrc_SetHrtfTarget(a, A3dHrirImpulse, A3dHrirImpulse);
534 static void a3dsrc_ClearVDBData(
a3dsrc_t * a,
unsigned long aa)
555 a3dsrc_t *a3dsrc = &(v->
a3d[source + (slice * 4)]);
558 a3dsrc->
vortex = (
void *)v;
560 a3dsrc->
slice = slice;
561 a3dsrc_ZeroState(a3dsrc);
563 a3dsrc_SetA3DSampleRate(a3dsrc, 0x11);
566 static int Vort3DRend_Initialize(
vortex_t *
v,
unsigned short mode)
570 vortex_XtalkHw_init(v);
571 vortex_XtalkHw_SetGainsAllChan(v);
574 vortex_XtalkHw_ProgramXtalkNarrow(v);
577 vortex_XtalkHw_ProgramXtalkWide(v);
581 vortex_XtalkHw_ProgramPipe(v);
584 vortex_XtalkHw_ProgramDiamondXtalk(v);
587 vortex_XtalkHw_SetSampleRate(v, 0x11);
588 vortex_XtalkHw_Enable(v);
594 static int vortex_a3d_register_controls(
vortex_t * vortex);
595 static void vortex_a3d_unregister_controls(
vortex_t * vortex);
602 for (i = 0; i <
NR_A3D; i++) {
603 vortex_A3dSourceHw_Initialize(v, i % 4, i >> 2);
604 a3dsrc_ZeroStateA3D(&(v->
a3d[0]));
607 vortex_a3d_register_controls(v);
610 static void vortex_Vort3D_disable(
vortex_t * v)
612 vortex_XtalkHw_Disable(v);
613 vortex_a3d_unregister_controls(v);
617 static void vortex_Vort3D_connect(
vortex_t * v,
int en)
632 (
"vortex: vortex_Vort3D: ERROR: not enough free mixer resources.\n");
639 (
"vortex: vortex_Vort3D: ERROR: not enough free mixer resources.\n");
645 for (i = 0; i < 4; i++) {
664 vortex_connection_mixin_mix(v, en, v->
mixxtlk[0],
666 vortex_connection_mixin_mix(v, en, v->
mixxtlk[1],
668 vortex_mix_setinputvolumebyte(v, v->
mixplayb[2],
671 vortex_mix_setinputvolumebyte(v, v->
mixplayb[3],
679 static void vortex_Vort3D_InitializeSource(
a3dsrc_t * a,
int en)
683 (
"vortex: Vort3D_InitializeSource: A3D source not initialized\n");
687 a3dsrc_ProgramPipe(a);
688 a3dsrc_SetA3DSampleRate(a, 0x11);
689 a3dsrc_SetTimeConsts(a, HrtfTCDefault,
690 ItdTCDefault, GainTCDefault,
697 a3dsrc_DisableA3D(a);
704 static void vortex_a3d_coord2hrtf(
a3d_Hrtf_t hrtf,
int *coord)
709 static void vortex_a3d_coord2itd(
a3d_Itd_t itd,
int *coord)
714 static void vortex_a3d_coord2ild(
a3d_LRGains_t ild,
int left,
int right)
755 snd_vortex_a3d_filter_info(
struct snd_kcontrol *kcontrol,
781 for (i = 0; i < 6; i++)
782 coord[i] = ucontrol->
value.integer.value[i];
784 vortex_a3d_coord2hrtf(a->
hrtf[0], coord);
785 vortex_a3d_coord2hrtf(a->
hrtf[1], coord);
786 a3dsrc_SetHrtfTarget(a, a->
hrtf[0], a->
hrtf[1]);
787 a3dsrc_SetHrtfCurrent(a, a->
hrtf[0], a->
hrtf[1]);
798 for (i = 0; i < 6; i++)
799 coord[i] = ucontrol->
value.integer.value[i];
801 vortex_a3d_coord2itd(a->
hrtf[0], coord);
802 vortex_a3d_coord2itd(a->
hrtf[1], coord);
804 a3dsrc_SetItdTarget(a, a->
itd[0], a->
itd[1]);
805 a3dsrc_SetItdCurrent(a, a->
itd[0], a->
itd[1]);
806 a3dsrc_SetItdDline(a, a->
dline);
818 l = ucontrol->
value.integer.value[0];
819 r = ucontrol->
value.integer.value[1];
820 vortex_a3d_coord2ild(a->
ild, l, r);
822 a3dsrc_SetGainTarget(a, l, r);
823 a3dsrc_SetGainCurrent(a, l, r);
828 snd_vortex_a3d_filter_put(
struct snd_kcontrol *kcontrol,
834 for (i = 0; i < 6; i++)
835 params[i] = ucontrol->
value.integer.value[i];
837 vortex_a3d_translate_filter(a->
filter, params);
839 a3dsrc_SetAtmosTarget(a, a->
filter[0],
842 a3dsrc_SetAtmosCurrent(a, a->
filter[0],
850 .name =
"Playback PCM advanced processing",
852 .info = snd_vortex_a3d_hrtf_info,
853 .get = snd_vortex_a3d_get,
854 .put = snd_vortex_a3d_hrtf_put,
863 for (i = 0; i <
NR_A3D; i++) {
868 kcontrol->
info = snd_vortex_a3d_hrtf_info;
869 kcontrol->
put = snd_vortex_a3d_hrtf_put;
874 for (i = 0; i <
NR_A3D; i++) {
879 kcontrol->
info = snd_vortex_a3d_itd_info;
880 kcontrol->
put = snd_vortex_a3d_itd_put;
885 for (i = 0; i <
NR_A3D; i++) {
890 kcontrol->
info = snd_vortex_a3d_ild_info;
891 kcontrol->
put = snd_vortex_a3d_ild_put;
896 for (i = 0; i <
NR_A3D; i++) {
901 kcontrol->
info = snd_vortex_a3d_filter_info;
902 kcontrol->
put = snd_vortex_a3d_filter_put;
909 static void vortex_a3d_unregister_controls(
vortex_t * vortex)