mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
ALSA: emu10k1: straighten out FX send init
The mixer structures were filled in two places: on driver init, and when the devices are opened. The latter made the former pointless, so we remove the former. This implies that mixer dumps may now return all zeroes, which is OK, as restoring them is meaningless as well. Things were even weirder for the (generally unused) secondary sends: Some of the initialization loops were forgotten when support for Audigy was added, thus creating the technically illegal state of multiple sends being routed to the same FX accumulator (though it apparently doesn't matter when the amount is zero). The global multi-channel init used some rather bizarre values for the secondary sends, and the init on open actually forgot to re-initialize them. We now use a not really more useful, but simpler formula. The direct register init was also bogus. This doesn't really matter, as the value is overwritten when a voice comes into use, but still. Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Link: https://lore.kernel.org/r/20230516093612.3536451-2-oswald.buddenhagen@gmx.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
24cdfcb4cc
commit
155e3d3bf0
@ -240,30 +240,30 @@ name='EMU10K1 PCM Send Routing',index 0-31
|
||||
This control specifies the destination - FX-bus accumulators. There are 24
|
||||
values in this mapping:
|
||||
|
||||
* 0 - mono, A destination (FX-bus 0-63), default 0
|
||||
* 1 - mono, B destination (FX-bus 0-63), default 1
|
||||
* 2 - mono, C destination (FX-bus 0-63), default 2
|
||||
* 3 - mono, D destination (FX-bus 0-63), default 3
|
||||
* 4 - mono, E destination (FX-bus 0-63), default 0
|
||||
* 5 - mono, F destination (FX-bus 0-63), default 0
|
||||
* 6 - mono, G destination (FX-bus 0-63), default 0
|
||||
* 7 - mono, H destination (FX-bus 0-63), default 0
|
||||
* 8 - left, A destination (FX-bus 0-63), default 0
|
||||
* 9 - left, B destination (FX-bus 0-63), default 1
|
||||
* 0 - mono, A destination (FX-bus 0-63), default 0
|
||||
* 1 - mono, B destination (FX-bus 0-63), default 1
|
||||
* 2 - mono, C destination (FX-bus 0-63), default 2
|
||||
* 3 - mono, D destination (FX-bus 0-63), default 3
|
||||
* 4 - mono, E destination (FX-bus 0-63), default 4
|
||||
* 5 - mono, F destination (FX-bus 0-63), default 5
|
||||
* 6 - mono, G destination (FX-bus 0-63), default 6
|
||||
* 7 - mono, H destination (FX-bus 0-63), default 7
|
||||
* 8 - left, A destination (FX-bus 0-63), default 0
|
||||
* 9 - left, B destination (FX-bus 0-63), default 1
|
||||
* 10 - left, C destination (FX-bus 0-63), default 2
|
||||
* 11 - left, D destination (FX-bus 0-63), default 3
|
||||
* 12 - left, E destination (FX-bus 0-63), default 0
|
||||
* 13 - left, F destination (FX-bus 0-63), default 0
|
||||
* 14 - left, G destination (FX-bus 0-63), default 0
|
||||
* 15 - left, H destination (FX-bus 0-63), default 0
|
||||
* 12 - left, E destination (FX-bus 0-63), default 4
|
||||
* 13 - left, F destination (FX-bus 0-63), default 5
|
||||
* 14 - left, G destination (FX-bus 0-63), default 6
|
||||
* 15 - left, H destination (FX-bus 0-63), default 7
|
||||
* 16 - right, A destination (FX-bus 0-63), default 0
|
||||
* 17 - right, B destination (FX-bus 0-63), default 1
|
||||
* 18 - right, C destination (FX-bus 0-63), default 2
|
||||
* 19 - right, D destination (FX-bus 0-63), default 3
|
||||
* 20 - right, E destination (FX-bus 0-63), default 0
|
||||
* 21 - right, F destination (FX-bus 0-63), default 0
|
||||
* 22 - right, G destination (FX-bus 0-63), default 0
|
||||
* 23 - right, H destination (FX-bus 0-63), default 0
|
||||
* 20 - right, E destination (FX-bus 0-63), default 4
|
||||
* 21 - right, F destination (FX-bus 0-63), default 5
|
||||
* 22 - right, G destination (FX-bus 0-63), default 6
|
||||
* 23 - right, H destination (FX-bus 0-63), default 7
|
||||
|
||||
Don't forget that it's illegal to assign a channel to the same FX-bus accumulator
|
||||
more than once (it means 0=0 && 1=0 is an invalid combination).
|
||||
|
@ -95,7 +95,7 @@ void snd_emu10k1_voice_init(struct snd_emu10k1 *emu, int ch)
|
||||
snd_emu10k1_ptr_write(emu, A_CSFE, ch, 0);
|
||||
snd_emu10k1_ptr_write(emu, A_CSHG, ch, 0);
|
||||
snd_emu10k1_ptr_write(emu, A_FXRT1, ch, 0x03020100);
|
||||
snd_emu10k1_ptr_write(emu, A_FXRT2, ch, 0x3f3f3f3f);
|
||||
snd_emu10k1_ptr_write(emu, A_FXRT2, ch, 0x07060504);
|
||||
snd_emu10k1_ptr_write(emu, A_SENDAMOUNTS, ch, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1752,7 +1752,7 @@ static int rename_ctl(struct snd_card *card, const char *src, const char *dst)
|
||||
int snd_emu10k1_mixer(struct snd_emu10k1 *emu,
|
||||
int pcm_device, int multi_device)
|
||||
{
|
||||
int err, pcm;
|
||||
int err;
|
||||
struct snd_kcontrol *kctl;
|
||||
struct snd_card *card = emu->card;
|
||||
const char * const *c;
|
||||
@ -2016,48 +2016,6 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* initialize the routing and volume table for each pcm playback stream */
|
||||
for (pcm = 0; pcm < 32; pcm++) {
|
||||
struct snd_emu10k1_pcm_mixer *mix;
|
||||
int v;
|
||||
|
||||
mix = &emu->pcm_mixer[pcm];
|
||||
mix->epcm = NULL;
|
||||
|
||||
for (v = 0; v < 4; v++)
|
||||
mix->send_routing[0][v] =
|
||||
mix->send_routing[1][v] =
|
||||
mix->send_routing[2][v] = v;
|
||||
|
||||
memset(&mix->send_volume, 0, sizeof(mix->send_volume));
|
||||
mix->send_volume[0][0] = mix->send_volume[0][1] =
|
||||
mix->send_volume[1][0] = mix->send_volume[2][1] = 255;
|
||||
|
||||
mix->attn[0] = mix->attn[1] = mix->attn[2] = 0xffff;
|
||||
}
|
||||
|
||||
/* initialize the routing and volume table for the multichannel playback stream */
|
||||
for (pcm = 0; pcm < NUM_EFX_PLAYBACK; pcm++) {
|
||||
struct snd_emu10k1_pcm_mixer *mix;
|
||||
int v;
|
||||
|
||||
mix = &emu->efx_pcm_mixer[pcm];
|
||||
mix->epcm = NULL;
|
||||
|
||||
mix->send_routing[0][0] = pcm;
|
||||
mix->send_routing[0][1] = (pcm == 0) ? 1 : 0;
|
||||
for (v = 0; v < 2; v++)
|
||||
mix->send_routing[0][2+v] = 13+v;
|
||||
if (emu->audigy)
|
||||
for (v = 0; v < 4; v++)
|
||||
mix->send_routing[0][4+v] = 60+v;
|
||||
|
||||
memset(&mix->send_volume, 0, sizeof(mix->send_volume));
|
||||
mix->send_volume[0][0] = 255;
|
||||
|
||||
mix->attn[0] = 0xffff;
|
||||
}
|
||||
|
||||
if (!emu->card_capabilities->ecard && !emu->card_capabilities->emu_model) {
|
||||
/* sb live! and audigy */
|
||||
kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu);
|
||||
|
@ -283,11 +283,8 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,
|
||||
|
||||
/* volume parameters */
|
||||
if (extra) {
|
||||
memset(send_routing, 0, sizeof(send_routing));
|
||||
send_routing[0] = 0;
|
||||
send_routing[1] = 1;
|
||||
send_routing[2] = 2;
|
||||
send_routing[3] = 3;
|
||||
for (int i = 0; i < 8; i++)
|
||||
send_routing[i] = i;
|
||||
memset(send_amount, 0, sizeof(send_amount));
|
||||
} else {
|
||||
/* mono, left, right (master voice = left) */
|
||||
@ -1031,7 +1028,7 @@ static int snd_emu10k1_efx_playback_open(struct snd_pcm_substream *substream)
|
||||
struct snd_emu10k1_pcm *epcm;
|
||||
struct snd_emu10k1_pcm_mixer *mix;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
|
||||
if (epcm == NULL)
|
||||
@ -1046,7 +1043,8 @@ static int snd_emu10k1_efx_playback_open(struct snd_pcm_substream *substream)
|
||||
|
||||
for (i = 0; i < NUM_EFX_PLAYBACK; i++) {
|
||||
mix = &emu->efx_pcm_mixer[i];
|
||||
mix->send_routing[0][0] = i;
|
||||
for (j = 0; j < 8; j++)
|
||||
mix->send_routing[0][j] = i + j;
|
||||
memset(&mix->send_volume, 0, sizeof(mix->send_volume));
|
||||
mix->send_volume[0][0] = 255;
|
||||
mix->attn[0] = 0x8000;
|
||||
@ -1093,7 +1091,7 @@ static int snd_emu10k1_playback_open(struct snd_pcm_substream *substream)
|
||||
return err;
|
||||
}
|
||||
mix = &emu->pcm_mixer[substream->number];
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < 8; i++)
|
||||
mix->send_routing[0][i] = mix->send_routing[1][i] = mix->send_routing[2][i] = i;
|
||||
memset(&mix->send_volume, 0, sizeof(mix->send_volume));
|
||||
mix->send_volume[0][0] = mix->send_volume[0][1] =
|
||||
|
Loading…
Reference in New Issue
Block a user