Applied patch from thq (bug #1146). Thanks a lot! I tested this change on Haiku.
Avoids noise on shutdown because the amplifier is left on after shutdown, the amplifier is also turned on directly after init. The patch changes this to be the last thing to be turned on, and the first to be turned off. The creation of controls had an of by 1 error where the last control was skipped. Also made the controls more UI friendly so that the 'boost mic +20dB' is a part of the mic control instead of its own tab, and the AC97 mixer tab is changed to be the first one as it is probably more used than the 'Record' tab, which now is called 'Recording'. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20646 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6cde6beba7
commit
127dffedfb
@ -279,9 +279,9 @@ void cs4299_amp_enable(device_config *config, bool yesno)
|
||||
}
|
||||
|
||||
const ac97_source_info source_info[] = {
|
||||
{ "Record", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO|B_MIX_RECORDMUX, 100, AC97_RECORD_GAIN, 0x8000, 4, 0, 1, 0, 0.0, 22.5, 1.5 },
|
||||
{ "Recording", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO|B_MIX_RECORDMUX, 100, AC97_RECORD_GAIN, 0x8000, 4, 0, 1, 0, 0.0, 22.5, 1.5 },
|
||||
{ "Master", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 101, AC97_MASTER_VOLUME, 0x8000, 5, 0, 1, 1,-46.5, 0.0, 1.5 },
|
||||
//{ "Bass/Trebble", B_MIX_GAIN|B_MIX_STEREO, 102, AC97_MASTER_TONE, 0x0f0f, 4, 0, 1, 1,-12.0, 10.5, 1.5 },
|
||||
//{ "Bass/Treble", B_MIX_GAIN|B_MIX_STEREO, 102, AC97_MASTER_TONE, 0x0f0f, 4, 0, 1, 1,-12.0, 10.5, 1.5 },
|
||||
//{ "Aux Out", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 103, AC97_AUX_OUT_VOLUME, 0x8000, 5, 0, 1, 1,-46.5, 0.0, 1.5 },
|
||||
{ "PCM Out", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 104, AC97_PCM_OUT_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 },
|
||||
{ "CD", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 105, AC97_CD_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 },
|
||||
|
@ -659,7 +659,6 @@ auich_setup(auich_dev * card)
|
||||
snooze(50000); // 50 ms
|
||||
|
||||
ac97_init(&card->config);
|
||||
ac97_amp_enable(&card->config, true);
|
||||
|
||||
rv = auich_reg_read_32(&card->config, AUICH_REG_GLOB_STA);
|
||||
if (!(rv & STA_S0CR)) { /* reset failure */
|
||||
@ -698,6 +697,7 @@ auich_setup(auich_dev * card)
|
||||
PRINT(("codec record gain = %#04x\n",auich_codec_read(&card->config, 0x1c)));*/
|
||||
|
||||
PRINT(("writing codec registers\n"));
|
||||
|
||||
// TODO : to move with AC97
|
||||
/* enable master output */
|
||||
auich_codec_write(&card->config, AC97_MASTER_VOLUME, 0x0000);
|
||||
@ -714,6 +714,8 @@ auich_setup(auich_dev * card)
|
||||
/* set record gain */
|
||||
//auich_codec_write(&card->config, AC97_RECORD_GAIN, 0x0000);
|
||||
|
||||
ac97_amp_enable(&card->config, true);
|
||||
|
||||
PRINT(("codec master output = %#04x\n",auich_codec_read(&card->config, AC97_MASTER_VOLUME)));
|
||||
PRINT(("codec aux output = %#04x\n",auich_codec_read(&card->config, AC97_AUX_OUT_VOLUME)));
|
||||
PRINT(("codec mono output = %#04x\n",auich_codec_read(&card->config, AC97_MONO_VOLUME)));
|
||||
@ -830,6 +832,7 @@ static void
|
||||
auich_shutdown(auich_dev *card)
|
||||
{
|
||||
PRINT(("shutdown(%p)\n", card));
|
||||
ac97_amp_enable(&card->config, false);
|
||||
card->interrupt_mask = 0;
|
||||
|
||||
if (current_settings.use_thread) {
|
||||
|
@ -194,10 +194,82 @@ auich_create_controls_list(multi_dev *multi)
|
||||
{
|
||||
uint32 i = 0, index = 0, count, id, parent, parent2, parent3;
|
||||
const ac97_source_info *info;
|
||||
|
||||
/* AC97 Mixer */
|
||||
parent = auich_create_group_control(multi, &index, 0, 0, "AC97 Mixer");
|
||||
|
||||
count = source_info_size;
|
||||
//Note that we ignore first item in source_info
|
||||
//It's for recording, but do match this with ac97.c's source_info
|
||||
for(i=1; i < count ; i++) {
|
||||
info = &source_info[i];
|
||||
PRINT(("name : %s\n", info->name));
|
||||
|
||||
parent = auich_create_group_control(multi, &index, 0, 0, "Record");
|
||||
parent2 = auich_create_group_control(multi, &index, parent, 0, info->name);
|
||||
|
||||
if(info->type & B_MIX_GAIN) {
|
||||
if(info->type & B_MIX_MUTE) {
|
||||
multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index;
|
||||
multi->controls[index].mix_control.flags = B_MULTI_MIX_ENABLE;
|
||||
multi->controls[index].mix_control.master = EMU_MULTI_CONTROL_MASTERID;
|
||||
multi->controls[index].mix_control.parent = parent2;
|
||||
multi->controls[index].mix_control.string = S_MUTE;
|
||||
multi->controls[index].cookie = info;
|
||||
multi->controls[index].type = B_MIX_MUTE;
|
||||
multi->controls[index].get = &auich_ac97_get_mix;
|
||||
multi->controls[index].set = &auich_ac97_set_mix;
|
||||
index++;
|
||||
}
|
||||
|
||||
multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index;
|
||||
multi->controls[index].mix_control.flags = B_MULTI_MIX_GAIN;
|
||||
multi->controls[index].mix_control.master = EMU_MULTI_CONTROL_MASTERID;
|
||||
multi->controls[index].mix_control.parent = parent2;
|
||||
strcpy(multi->controls[index].mix_control.name, info->name);
|
||||
multi->controls[index].mix_control.u.gain.min_gain = info->min_gain;
|
||||
multi->controls[index].mix_control.u.gain.max_gain = info->max_gain;
|
||||
multi->controls[index].mix_control.u.gain.granularity = info->granularity;
|
||||
multi->controls[index].cookie = info;
|
||||
multi->controls[index].type = B_MIX_GAIN;
|
||||
multi->controls[index].get = &auich_ac97_get_mix;
|
||||
multi->controls[index].set = &auich_ac97_set_mix;
|
||||
id = multi->controls[index].mix_control.id;
|
||||
index++;
|
||||
|
||||
if(info->type & B_MIX_STEREO) {
|
||||
multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index;
|
||||
multi->controls[index].mix_control.flags = B_MULTI_MIX_GAIN;
|
||||
multi->controls[index].mix_control.master = id;
|
||||
multi->controls[index].mix_control.parent = parent2;
|
||||
strcpy(multi->controls[index].mix_control.name, info->name);
|
||||
multi->controls[index].mix_control.u.gain.min_gain = info->min_gain;
|
||||
multi->controls[index].mix_control.u.gain.max_gain = info->max_gain;
|
||||
multi->controls[index].mix_control.u.gain.granularity = info->granularity;
|
||||
multi->controls[index].cookie = info;
|
||||
multi->controls[index].type = B_MIX_GAIN;
|
||||
multi->controls[index].get = &auich_ac97_get_mix;
|
||||
multi->controls[index].set = &auich_ac97_set_mix;
|
||||
index++;
|
||||
}
|
||||
|
||||
if(info->type & B_MIX_MICBOOST) {
|
||||
multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index;
|
||||
multi->controls[index].mix_control.flags = B_MULTI_MIX_ENABLE;
|
||||
multi->controls[index].mix_control.master = EMU_MULTI_CONTROL_MASTERID;
|
||||
multi->controls[index].mix_control.parent = parent2;
|
||||
strcpy(multi->controls[index].mix_control.name, "+20 dB");
|
||||
multi->controls[index].cookie = info;
|
||||
multi->controls[index].type = B_MIX_MICBOOST;
|
||||
multi->controls[index].get = &auich_ac97_get_mix;
|
||||
multi->controls[index].set = &auich_ac97_set_mix;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* AC97 Record */
|
||||
parent = auich_create_group_control(multi, &index, 0, 0, "Recording");
|
||||
|
||||
info = &source_info[0];
|
||||
PRINT(("name : %s\n", info->name));
|
||||
|
||||
@ -302,83 +374,7 @@ auich_create_controls_list(multi_dev *multi)
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
parent = auich_create_group_control(multi, &index, 0, 0, "AC97 Mixer");
|
||||
|
||||
count = source_info_size;
|
||||
count--;
|
||||
|
||||
for(i=1; i < count ; i++) {
|
||||
info = &source_info[i];
|
||||
PRINT(("name : %s\n", info->name));
|
||||
|
||||
parent2 = auich_create_group_control(multi, &index, parent, 0, info->name);
|
||||
|
||||
if(info->type & B_MIX_GAIN) {
|
||||
if(info->type & B_MIX_MUTE) {
|
||||
multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index;
|
||||
multi->controls[index].mix_control.flags = B_MULTI_MIX_ENABLE;
|
||||
multi->controls[index].mix_control.master = EMU_MULTI_CONTROL_MASTERID;
|
||||
multi->controls[index].mix_control.parent = parent2;
|
||||
multi->controls[index].mix_control.string = S_MUTE;
|
||||
multi->controls[index].cookie = info;
|
||||
multi->controls[index].type = B_MIX_MUTE;
|
||||
multi->controls[index].get = &auich_ac97_get_mix;
|
||||
multi->controls[index].set = &auich_ac97_set_mix;
|
||||
index++;
|
||||
}
|
||||
|
||||
multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index;
|
||||
multi->controls[index].mix_control.flags = B_MULTI_MIX_GAIN;
|
||||
multi->controls[index].mix_control.master = EMU_MULTI_CONTROL_MASTERID;
|
||||
multi->controls[index].mix_control.parent = parent2;
|
||||
strcpy(multi->controls[index].mix_control.name, info->name);
|
||||
multi->controls[index].mix_control.u.gain.min_gain = info->min_gain;
|
||||
multi->controls[index].mix_control.u.gain.max_gain = info->max_gain;
|
||||
multi->controls[index].mix_control.u.gain.granularity = info->granularity;
|
||||
multi->controls[index].cookie = info;
|
||||
multi->controls[index].type = B_MIX_GAIN;
|
||||
multi->controls[index].get = &auich_ac97_get_mix;
|
||||
multi->controls[index].set = &auich_ac97_set_mix;
|
||||
id = multi->controls[index].mix_control.id;
|
||||
index++;
|
||||
|
||||
if(info->type & B_MIX_STEREO) {
|
||||
multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index;
|
||||
multi->controls[index].mix_control.flags = B_MULTI_MIX_GAIN;
|
||||
multi->controls[index].mix_control.master = id;
|
||||
multi->controls[index].mix_control.parent = parent2;
|
||||
strcpy(multi->controls[index].mix_control.name, info->name);
|
||||
multi->controls[index].mix_control.u.gain.min_gain = info->min_gain;
|
||||
multi->controls[index].mix_control.u.gain.max_gain = info->max_gain;
|
||||
multi->controls[index].mix_control.u.gain.granularity = info->granularity;
|
||||
multi->controls[index].cookie = info;
|
||||
multi->controls[index].type = B_MIX_GAIN;
|
||||
multi->controls[index].get = &auich_ac97_get_mix;
|
||||
multi->controls[index].set = &auich_ac97_set_mix;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parent = auich_create_group_control(multi, &index, 0, S_SETUP, NULL);
|
||||
|
||||
/* AC97 20db Boost Mic */
|
||||
info = &source_info[6];
|
||||
|
||||
if(info->type & B_MIX_GAIN && info->type & B_MIX_MICBOOST) {
|
||||
multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index;
|
||||
multi->controls[index].mix_control.flags = B_MULTI_MIX_ENABLE;
|
||||
multi->controls[index].mix_control.master = EMU_MULTI_CONTROL_MASTERID;
|
||||
multi->controls[index].mix_control.parent = parent;
|
||||
strcpy(multi->controls[index].mix_control.name, "Mic +20dB");
|
||||
multi->controls[index].cookie = info;
|
||||
multi->controls[index].type = B_MIX_MICBOOST;
|
||||
multi->controls[index].get = &auich_ac97_get_mix;
|
||||
multi->controls[index].set = &auich_ac97_set_mix;
|
||||
index++;
|
||||
}
|
||||
|
||||
multi->control_count = index;
|
||||
PRINT(("multi->control_count %lu\n", multi->control_count));
|
||||
return B_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user