mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-25 15:20:31 -04:00
Mic to hp refactoring (#1521)
* Refactoring previous "Hear Mic" PR * Missed file
This commit is contained in:
parent
efcedd9005
commit
1b73a138b6
6 changed files with 25 additions and 31 deletions
|
@ -224,7 +224,7 @@ void AK4951::speaker_disable() {
|
|||
set_speaker_power(false);
|
||||
}
|
||||
|
||||
void AK4951::microphone_enable(int8_t alc_mode) {
|
||||
void AK4951::microphone_enable(int8_t alc_mode, bool mic_to_HP_enabled) {
|
||||
// alc_mode =0 = (OFF =same as original code = NOT using AK4951 Programmable digital filter block),
|
||||
// alc_mode >1 (with DIGITAL FILTER BLOCK , example : 1:(+12dB) , 2:(+9dB)", 3:(+6dB), ...)
|
||||
|
||||
|
@ -505,6 +505,11 @@ void AK4951::microphone_enable(int8_t alc_mode) {
|
|||
map.r.power_management_1.PMPFIL = 1; // Pre-loaded in top part. Orig value=0, Programmable Digital filter unused (not power up), routed around.
|
||||
update(Register::PowerManagement1); // Activating the Power management of the used blocks . (Mic ADC always + Dig Block filter , when used )
|
||||
|
||||
if (mic_to_HP_enabled)
|
||||
microphone_to_HP_enable();
|
||||
else
|
||||
microphone_to_HP_disable();
|
||||
|
||||
// 1059/fs, 22ms @ 48kHz
|
||||
chThdSleepMilliseconds(22);
|
||||
}
|
||||
|
|
|
@ -844,7 +844,7 @@ class AK4951 : public audio::Codec {
|
|||
void set_headphone_volume(const volume_t volume) override;
|
||||
void headphone_mute();
|
||||
|
||||
void microphone_enable(int8_t alc_mode); // added user GUI parameter , to set up AK4951 ALC mode.
|
||||
void microphone_enable(int8_t alc_mode, bool mic_to_HP_enabled); // added user GUI parameter , to set up AK4951 ALC mode, and mic_to_HP_enabled to control "Hear to Mic"
|
||||
void microphone_disable();
|
||||
|
||||
void microphone_to_HP_enable();
|
||||
|
|
|
@ -349,13 +349,18 @@ class WM8731 : public audio::Codec {
|
|||
return false;
|
||||
}
|
||||
|
||||
void microphone_enable(int8_t wm8731_boost_GUI) override {
|
||||
void microphone_enable(int8_t wm8731_boost_GUI, bool mic_to_HP_enabled) override {
|
||||
microphone_mute(true); // c/m to reduce "plop noise" when changing wm8731_boost_GUI.
|
||||
// chThdSleepMilliseconds(20); // does not help to reduce the "plop noise"
|
||||
microphone_boost((wm8731_boost_GUI < 2) ? 1 : 0); // 1 = Enable Boost (+20 dBs) . 0 = Disable Boost (0dBs).
|
||||
chThdSleepMilliseconds(120); // >50 msegs, very effective , >100 msegs minor improvement ,120 msegs trade off speed .
|
||||
microphone_mute(false);
|
||||
// (void)alc_mode; In prev. fw version , when we did not use at all param., to avoid "unused warning" when compiling.)
|
||||
|
||||
if (mic_to_HP_enabled)
|
||||
microphone_to_HP_enable();
|
||||
else
|
||||
microphone_to_HP_disable();
|
||||
}
|
||||
|
||||
void microphone_disable() override {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue