History

ALSA: emu10k1: enable bit-exact playback, part 1: DSP attenuation

Fractional multiplication with the maximal value 2^31-1 causes some tiny distortion. Instead, we want to multiply with the full 2^31. The catch is of course that this cannot be represented in the DSP's signed 32 bit registers. One way to deal with this is to encode 1.0 as a negative number and special-case it. As a matter of fact, the SbLive! code path already contained such code, though the controls never actually exercised it. A more efficient approach is to use negative values, which actually extend to -2^31. Accordingly, for all the volume adjustments we now use the MAC1 instruction which negates the X operand. The range of the controls in highres mode is extended downwards, so -1 is the new zero/mute. At maximal excursion, real zero is not mute any more, but I don't think anyone will notice this behavior change. ;-) That also required making the min/max/values in the control structs signed. This technically changes the user space interface, but it seems implausible that someone would notice - the numbers were actually treated as if they were signed anyway (and in the actual mixer iface they _are_). And without this change, the min value didn't even make sense in the first place (and no-one noticed, because it was always 0).

Oswald Buddenhagen committed 3 years ago

Commit 1298bc91 parent de0dc313 files · +64 −69Browse files

Unified · Split

3 files
  1. include/sound/emu10k1.h +3 −3
  2. include/uapi/sound/emu10k1.h +5 −3
  3. sound/pci/emu10k1/emufx.c +56 −63
include/sound/emu10k1.h+3−3
@@ -1508,9 +1508,9 @@ struct snd_emu10k1_fx8010_ctl { · 1507 unmodified lines
15081508 unsigned int vcount;
15091509 unsigned int count; /* count of GPR (1..16) */
15101510 unsigned short gpr[32]; /* GPR number(s) */
1511− unsigned int value[32];
1512− unsigned int min; /* minimum range */
1513− unsigned int max; /* maximum range */
1511+ int value[32];
1512+ int min; /* minimum range */
1513+ int max; /* maximum range */
15141514 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
15151515 struct snd_kcontrol *kcontrol;
15161516 };
include/uapi/sound/emu10k1.h+5−3
@@ -308,6 +308,8 @@ struct snd_emu10k1_fx8010_info { · 307 unmodified lines
308308 #define EMU10K1_GPR_TRANSLATION_BASS 2
309309 #define EMU10K1_GPR_TRANSLATION_TREBLE 3
310310 #define EMU10K1_GPR_TRANSLATION_ONOFF 4
311+#define EMU10K1_GPR_TRANSLATION_NEGATE 5
312+#define EMU10K1_GPR_TRANSLATION_NEG_TABLE100 6
311313
312314 enum emu10k1_ctl_elem_iface {
313315 EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */
@@ -328,9 +330,9 @@ struct snd_emu10k1_fx8010_control_gpr { · 14 unmodified lines
328330 unsigned int vcount; /* visible count */
329331 unsigned int count; /* count of GPR (1..16) */
330332 unsigned short gpr[32]; /* GPR number(s) */
331− unsigned int value[32]; /* initial values */
332− unsigned int min; /* minimum range */
333− unsigned int max; /* maximum range */
333+ int value[32]; /* initial values */
334+ int min; /* minimum range */
335+ int max; /* maximum range */
334336 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
335337 const unsigned int *tlv;
336338 };
sound/pci/emu10k1/emufx.c+56−63
@@ -332,7 +332,7 @@ static int snd_emu10k1_gpr_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl · 331 unmodified lines
332332 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
333333 struct snd_emu10k1_fx8010_ctl *ctl =
334334 (struct snd_emu10k1_fx8010_ctl *) kcontrol->private_value;
335− unsigned int nval, val;
335+ int nval, val;
336336 unsigned int i, j;
337337 int change = 0;
338338
@@ -349,9 +349,16 @@ static int snd_emu10k1_gpr_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl · 10 unmodified lines
349349 case EMU10K1_GPR_TRANSLATION_NONE:
350350 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, val);
351351 break;
352+ case EMU10K1_GPR_TRANSLATION_NEGATE:
353+ snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, ~val);
354+ break;
352355 case EMU10K1_GPR_TRANSLATION_TABLE100:
353356 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, db_table[val]);
354357 break;
358+ case EMU10K1_GPR_TRANSLATION_NEG_TABLE100:
359+ snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0,
360+ val == 100 ? 0x80000000 : -(int)db_table[val]);
361+ break;
355362 case EMU10K1_GPR_TRANSLATION_BASS:
356363 if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) {
357364 change = -EIO;
@@ -771,8 +778,10 @@ static int snd_emu10k1_verify_controls(struct snd_emu10k1 *emu, · 413 unmodified lines
771778 }
772779 switch (gctl->translation) {
773780 case EMU10K1_GPR_TRANSLATION_NONE:
781+ case EMU10K1_GPR_TRANSLATION_NEGATE:
774782 break;
775783 case EMU10K1_GPR_TRANSLATION_TABLE100:
784+ case EMU10K1_GPR_TRANSLATION_NEG_TABLE100:
776785 if (gctl->min != 0 || gctl->max != 100) {
777786 err = -EINVAL;
778787 goto __error;
@@ -1137,44 +1146,44 @@ static int snd_emu10k1_ipcm_peek(struct snd_emu10k1 *emu, · 358 unmodified lines
11371146
11381147 static void
11391148 snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1140− const char *name, int gpr, int defval)
1149+ const char *name, int gpr, int defval)
11411150 {
11421151 ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
11431152 strcpy(ctl->id.name, name);
11441153 ctl->vcount = ctl->count = 1;
11451154 if (high_res_gpr_volume) {
1146− ctl->min = 0;
1155+ ctl->min = -1;
11471156 ctl->max = 0x7fffffff;
11481157 ctl->tlv = snd_emu10k1_db_linear;
1149− ctl->translation = EMU10K1_GPR_TRANSLATION_NONE;
1150− defval = defval * 0x7fffffffLL / 100;
1158+ ctl->translation = EMU10K1_GPR_TRANSLATION_NEGATE;
1159+ defval = defval * 0x80000000LL / 100 - 1;
11511160 } else {
11521161 ctl->min = 0;
11531162 ctl->max = 100;
11541163 ctl->tlv = snd_emu10k1_db_scale1;
1155− ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
1164+ ctl->translation = EMU10K1_GPR_TRANSLATION_NEG_TABLE100;
11561165 }
11571166 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
11581167 }
11591168
11601169 static void
11611170 snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1162− const char *name, int gpr, int defval)
1171+ const char *name, int gpr, int defval)
11631172 {
11641173 ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
11651174 strcpy(ctl->id.name, name);
11661175 ctl->vcount = ctl->count = 2;
11671176 if (high_res_gpr_volume) {
1168− ctl->min = 0;
1177+ ctl->min = -1;
11691178 ctl->max = 0x7fffffff;
11701179 ctl->tlv = snd_emu10k1_db_linear;
1171− ctl->translation = EMU10K1_GPR_TRANSLATION_NONE;
1172− defval = defval * 0x7fffffffLL / 100;
1180+ ctl->translation = EMU10K1_GPR_TRANSLATION_NEGATE;
1181+ defval = defval * 0x80000000LL / 100 - 1;
11731182 } else {
11741183 ctl->min = 0;
11751184 ctl->max = 100;
11761185 ctl->tlv = snd_emu10k1_db_scale1;
1177− ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
1186+ ctl->translation = EMU10K1_GPR_TRANSLATION_NEG_TABLE100;
11781187 }
11791188 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
11801189 ctl->gpr[1] = gpr + 1; ctl->value[1] = defval;
@@ -1293,36 +1302,36 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu) · 112 unmodified lines
12931302
12941303 #if 1
12951304 /* PCM front Playback Volume (independent from stereo mix)
1296− * playback = 0 + ( gpr * FXBUS_PCM_LEFT_FRONT >> 31)
1297− * where gpr contains attenuation from corresponding mixer control
1305+ * playback = -gpr * FXBUS_PCM_LEFT_FRONT >> 31
1306+ * where gpr contains negated attenuation from corresponding mixer control
12981307 * (snd_emu10k1_init_stereo_control)
12991308 */
1300− A_OP(icode, &ptr, iMAC0, A_GPR(playback), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_FRONT));
1301− A_OP(icode, &ptr, iMAC0, A_GPR(playback+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_FRONT));
1309+ A_OP(icode, &ptr, iMAC1, A_GPR(playback), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_FRONT));
1310+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_FRONT));
13021311 snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Front Playback Volume", gpr, 100);
13031312 gpr += 2;
13041313
13051314 /* PCM Surround Playback (independent from stereo mix) */
1306− A_OP(icode, &ptr, iMAC0, A_GPR(playback+2), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_REAR));
1307− A_OP(icode, &ptr, iMAC0, A_GPR(playback+3), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_REAR));
1315+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+2), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_REAR));
1316+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+3), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_REAR));
13081317 snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Surround Playback Volume", gpr, 100);
13091318 gpr += 2;
13101319
13111320 /* PCM Side Playback (independent from stereo mix) */
13121321 if (emu->card_capabilities->spk71) {
1313− A_OP(icode, &ptr, iMAC0, A_GPR(playback+6), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_SIDE));
1314− A_OP(icode, &ptr, iMAC0, A_GPR(playback+7), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_SIDE));
1322+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+6), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_SIDE));
1323+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+7), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_SIDE));
13151324 snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Side Playback Volume", gpr, 100);
13161325 gpr += 2;
13171326 }
13181327
13191328 /* PCM Center Playback (independent from stereo mix) */
1320− A_OP(icode, &ptr, iMAC0, A_GPR(playback+4), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_CENTER));
1329+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+4), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_CENTER));
13211330 snd_emu10k1_init_mono_control(&controls[nctl++], "PCM Center Playback Volume", gpr, 100);
13221331 gpr++;
13231332
13241333 /* PCM LFE Playback (independent from stereo mix) */
1325− A_OP(icode, &ptr, iMAC0, A_GPR(playback+5), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LFE));
1334+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+5), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LFE));
13261335 snd_emu10k1_init_mono_control(&controls[nctl++], "PCM LFE Playback Volume", gpr, 100);
13271336 gpr++;
13281337
@@ -1330,26 +1339,26 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu) · 1 unmodified line
13301339 * Stereo Mix
13311340 */
13321341 /* Wave (PCM) Playback Volume (will be renamed later) */
1333− A_OP(icode, &ptr, iMAC0, A_GPR(stereo_mix), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT));
1334− A_OP(icode, &ptr, iMAC0, A_GPR(stereo_mix+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT));
1342+ A_OP(icode, &ptr, iMAC1, A_GPR(stereo_mix), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT));
1343+ A_OP(icode, &ptr, iMAC1, A_GPR(stereo_mix+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT));
13351344 snd_emu10k1_init_stereo_control(&controls[nctl++], "Wave Playback Volume", gpr, 100);
13361345 gpr += 2;
13371346
13381347 /* Synth Playback */
1339− A_OP(icode, &ptr, iMAC0, A_GPR(stereo_mix+0), A_GPR(stereo_mix+0), A_GPR(gpr), A_FXBUS(FXBUS_MIDI_LEFT));
1340− A_OP(icode, &ptr, iMAC0, A_GPR(stereo_mix+1), A_GPR(stereo_mix+1), A_GPR(gpr+1), A_FXBUS(FXBUS_MIDI_RIGHT));
1348+ A_OP(icode, &ptr, iMAC1, A_GPR(stereo_mix+0), A_GPR(stereo_mix+0), A_GPR(gpr), A_FXBUS(FXBUS_MIDI_LEFT));
1349+ A_OP(icode, &ptr, iMAC1, A_GPR(stereo_mix+1), A_GPR(stereo_mix+1), A_GPR(gpr+1), A_FXBUS(FXBUS_MIDI_RIGHT));
13411350 snd_emu10k1_init_stereo_control(&controls[nctl++], "Synth Playback Volume", gpr, 100);
13421351 gpr += 2;
13431352
13441353 /* Wave (PCM) Capture */
1345− A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT));
1346− A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT));
1354+ A_OP(icode, &ptr, iMAC1, A_GPR(capture+0), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT));
1355+ A_OP(icode, &ptr, iMAC1, A_GPR(capture+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT));
13471356 snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Capture Volume", gpr, 0);
13481357 gpr += 2;
13491358
13501359 /* Synth Capture */
1351− A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_GPR(capture+0), A_GPR(gpr), A_FXBUS(FXBUS_MIDI_LEFT));
1352− A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr+1), A_FXBUS(FXBUS_MIDI_RIGHT));
1360+ A_OP(icode, &ptr, iMAC1, A_GPR(capture+0), A_GPR(capture+0), A_GPR(gpr), A_FXBUS(FXBUS_MIDI_LEFT));
1361+ A_OP(icode, &ptr, iMAC1, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr+1), A_FXBUS(FXBUS_MIDI_RIGHT));
13531362 snd_emu10k1_init_stereo_control(&controls[nctl++], "Synth Capture Volume", gpr, 0);
13541363 gpr += 2;
13551364
@@ -1357,23 +1366,23 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu) · 1 unmodified line
13571366 * inputs
13581367 */
13591368 #define A_ADD_VOLUME_IN(var,vol,input) \
1360−A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1369+ A_OP(icode, &ptr, iMAC1, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
13611370
13621371 if (emu->card_capabilities->emu_model) {
13631372 /* EMU1010 DSP 0 and DSP 1 Capture */
13641373 // The 24 MSB hold the actual value. We implicitly discard the 16 LSB.
13651374 if (emu->card_capabilities->ca0108_chip) {
13661375 // For unclear reasons, the EMU32IN cannot be the Y operand!
1367− A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_GPR(capture+0), A3_EMU32IN(0x0), A_GPR(gpr));
1376+ A_OP(icode, &ptr, iMAC1, A_GPR(capture+0), A_GPR(capture+0), A3_EMU32IN(0x0), A_GPR(gpr));
13681377 // A3_EMU32IN(0) is delayed by one sample, so all other A3_EMU32IN channels
13691378 // need to be delayed as well; we use an auxiliary register for that.
1370− A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr+2), A_GPR(gpr+1));
1379+ A_OP(icode, &ptr, iMAC1, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr+2), A_GPR(gpr+1));
13711380 A_OP(icode, &ptr, iACC3, A_GPR(gpr+2), A3_EMU32IN(0x1), A_C_00000000, A_C_00000000);
13721381 } else {
1373− A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_GPR(capture+0), A_GPR(gpr), A_P16VIN(0x0));
1382+ A_OP(icode, &ptr, iMAC1, A_GPR(capture+0), A_GPR(capture+0), A_P16VIN(0x0), A_GPR(gpr));
13741383 // A_P16VIN(0) is delayed by one sample, so all other A_P16VIN channels
13751384 // need to be delayed as well; we use an auxiliary register for that.
1376− A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr+1), A_GPR(gpr+2));
1385+ A_OP(icode, &ptr, iMAC1, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr+2), A_GPR(gpr+1));
13771386 A_OP(icode, &ptr, iACC3, A_GPR(gpr+2), A_P16VIN(0x1), A_C_00000000, A_C_00000000);
13781387 }
13791388 snd_emu10k1_init_stereo_control(&controls[nctl++], "EMU Capture Volume", gpr, 0);
@@ -1465,33 +1474,33 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) · 85 unmodified lines
14651474 }
14661475
14671476 /* Stereo Mix Front Playback Volume */
1468− A_OP(icode, &ptr, iMAC0, A_GPR(playback), A_GPR(playback), A_GPR(gpr), A_GPR(stereo_mix));
1469− A_OP(icode, &ptr, iMAC0, A_GPR(playback+1), A_GPR(playback+1), A_GPR(gpr+1), A_GPR(stereo_mix+1));
1477+ A_OP(icode, &ptr, iMAC1, A_GPR(playback), A_GPR(playback), A_GPR(gpr), A_GPR(stereo_mix));
1478+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+1), A_GPR(playback+1), A_GPR(gpr+1), A_GPR(stereo_mix+1));
14701479 snd_emu10k1_init_stereo_control(&controls[nctl++], "Front Playback Volume", gpr, 100);
14711480 gpr += 2;
14721481
14731482 /* Stereo Mix Surround Playback */
1474− A_OP(icode, &ptr, iMAC0, A_GPR(playback+2), A_GPR(playback+2), A_GPR(gpr), A_GPR(stereo_mix));
1475− A_OP(icode, &ptr, iMAC0, A_GPR(playback+3), A_GPR(playback+3), A_GPR(gpr+1), A_GPR(stereo_mix+1));
1483+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+2), A_GPR(playback+2), A_GPR(gpr), A_GPR(stereo_mix));
1484+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+3), A_GPR(playback+3), A_GPR(gpr+1), A_GPR(stereo_mix+1));
14761485 snd_emu10k1_init_stereo_control(&controls[nctl++], "Surround Playback Volume", gpr, 0);
14771486 gpr += 2;
14781487
14791488 /* Stereo Mix Center Playback */
14801489 /* Center = sub = Left/2 + Right/2 */
14811490 A_OP(icode, &ptr, iINTERP, A_GPR(tmp), A_GPR(stereo_mix), A_C_40000000, A_GPR(stereo_mix+1));
1482− A_OP(icode, &ptr, iMAC0, A_GPR(playback+4), A_GPR(playback+4), A_GPR(gpr), A_GPR(tmp));
1491+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+4), A_GPR(playback+4), A_GPR(gpr), A_GPR(tmp));
14831492 snd_emu10k1_init_mono_control(&controls[nctl++], "Center Playback Volume", gpr, 0);
14841493 gpr++;
14851494
14861495 /* Stereo Mix LFE Playback */
1487− A_OP(icode, &ptr, iMAC0, A_GPR(playback+5), A_GPR(playback+5), A_GPR(gpr), A_GPR(tmp));
1496+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+5), A_GPR(playback+5), A_GPR(gpr), A_GPR(tmp));
14881497 snd_emu10k1_init_mono_control(&controls[nctl++], "LFE Playback Volume", gpr, 0);
14891498 gpr++;
14901499
14911500 if (emu->card_capabilities->spk71) {
14921501 /* Stereo Mix Side Playback */
1493− A_OP(icode, &ptr, iMAC0, A_GPR(playback+6), A_GPR(playback+6), A_GPR(gpr), A_GPR(stereo_mix));
1494− A_OP(icode, &ptr, iMAC0, A_GPR(playback+7), A_GPR(playback+7), A_GPR(gpr+1), A_GPR(stereo_mix+1));
1502+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+6), A_GPR(playback+6), A_GPR(gpr), A_GPR(stereo_mix));
1503+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+7), A_GPR(playback+7), A_GPR(gpr+1), A_GPR(stereo_mix+1));
14951504 snd_emu10k1_init_stereo_control(&controls[nctl++], "Side Playback Volume", gpr, 0);
14961505 gpr += 2;
14971506 }
@@ -1579,7 +1588,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) · 81 unmodified lines
15791588
15801589 /* Master volume (will be renamed later) */
15811590 for (z = 0; z < 8; z++)
1582− A_OP(icode, &ptr, iMAC0, A_GPR(playback+z), A_C_00000000, A_GPR(gpr), A_GPR(playback+z));
1591+ A_OP(icode, &ptr, iMAC1, A_GPR(playback+z), A_C_00000000, A_GPR(gpr), A_GPR(playback+z));
15831592 snd_emu10k1_init_mono_control(&controls[nctl++], "Wave Master Playback Volume", gpr, 0);
15841593 gpr++;
15851594
@@ -1731,30 +1740,14 @@ __err_gpr: · 145 unmodified lines
17311740 * initial DSP configuration for Emu10k1
17321741 */
17331742
1734−/* when volume = max, then copy only to avoid volume modification */
1735−/* with iMAC0 (negative values) */
1743+/* Volumes are in the [-2^31, 0] range, zero being mute. */
17361744 static void _volume(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol)
17371745 {
1738− OP(icode, ptr, iMAC0, dst, C_00000000, src, vol);
1739− OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff);
1740− OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000001);
1741− OP(icode, ptr, iACC3, dst, src, C_00000000, C_00000000);
1746+ OP(icode, ptr, iMAC1, dst, C_00000000, src, vol);
17421747 }
17431748 static void _volume_add(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol)
17441749 {
1745− OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff);
1746− OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000002);
1747− OP(icode, ptr, iMACINT0, dst, dst, src, C_00000001);
1748− OP(icode, ptr, iSKIP, C_00000000, C_7fffffff, C_7fffffff, C_00000001);
1749− OP(icode, ptr, iMAC0, dst, dst, src, vol);
1750−}
1751−static void _volume_out(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol)
1752−{
1753− OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff);
1754− OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000002);
1755− OP(icode, ptr, iACC3, dst, src, C_00000000, C_00000000);
1756− OP(icode, ptr, iSKIP, C_00000000, C_7fffffff, C_7fffffff, C_00000001);
1757− OP(icode, ptr, iMAC0, dst, C_00000000, src, vol);
1750+ OP(icode, ptr, iMAC1, dst, dst, src, vol);
17581751 }
17591752
17601753 #define VOLUME(icode, ptr, dst, src, vol) \
@@ -1766,7 +1759,7 @@ static void _volume_out(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst · 5 unmodified lines
17661759 #define VOLUME_ADDIN(icode, ptr, dst, src, vol) \
17671760 _volume_add(icode, ptr, GPR(dst), EXTIN(src), GPR(vol))
17681761 #define VOLUME_OUT(icode, ptr, dst, src, vol) \
1769− _volume_out(icode, ptr, EXTOUT(dst), GPR(src), GPR(vol))
1762+ _volume(icode, ptr, EXTOUT(dst), GPR(src), GPR(vol))
17701763 #define _SWITCH(icode, ptr, dst, src, sw) \
17711764 OP((icode), ptr, iMACINT0, dst, C_00000000, src, sw);
17721765 #define SWITCH(icode, ptr, dst, src, sw) \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t