mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 15:37:43 +00:00
Ak4951-ALC_base adding WM8731-boost OFF options
This commit is contained in:
@@ -42,10 +42,16 @@ void Modulator::set_over(uint32_t new_over) {
|
||||
over = new_over;
|
||||
}
|
||||
|
||||
void Modulator::set_gain_vumeter_beep(float new_audio_gain , bool new_play_beep ) {
|
||||
audio_gain = new_audio_gain ;
|
||||
void Modulator::set_gain_shiftbits_vumeter_beep(float new_audio_gain ,uint8_t new_audio_shift_bits_s16, bool new_play_beep ) {
|
||||
//new_audio_shift_bits_s16 are the direct shift bits (FM mod >>x) , and can be 8 fixed (AK) or 4,5,6 (WM boost OFF) or 8 (WM boost ON)
|
||||
audio_gain = new_audio_gain ;
|
||||
audio_shift_bits_s16_FM = new_audio_shift_bits_s16; //FM : >>8(AK) fixed , >>4,5,6 (WM boost OFF)
|
||||
if (new_audio_shift_bits_s16==8) { //FM : we are in AK codec IC => for AM-SSB-DSB we were using >>2 fixed (wm boost ON) .
|
||||
audio_shift_bits_s16_AM_DSB_SSB = 2; //AM-DSB-SSB: >>2(AK) fixed , >>0,1,2 (WM boost OFF)
|
||||
} else {
|
||||
audio_shift_bits_s16_AM_DSB_SSB = (new_audio_shift_bits_s16-4) ; //AM-DSB-SSB: >>0,1,2 (WM boost OFF)
|
||||
}
|
||||
play_beep = new_play_beep;
|
||||
|
||||
}
|
||||
|
||||
int32_t Modulator::apply_beep(int32_t sample_in, bool& configured_in, uint32_t& new_beep_index, uint32_t& new_beep_timer, TXProgressMessage& new_txprogress_message ) {
|
||||
@@ -85,7 +91,7 @@ void SSB::execute(const buffer_s16_t& audio, const buffer_c8_t& buffer, bool& co
|
||||
if (counter % 128 == 0) {
|
||||
float i = 0.0, q = 0.0;
|
||||
|
||||
sample = audio.p[counter / over] >> 2;
|
||||
sample = audio.p[counter / over] >> audio_shift_bits_s16_AM_DSB_SSB; // originally fixed >> 2, now >>2 for AK, 0,1,2,3 for WM (boost off)
|
||||
sample *= audio_gain; // Apply GAIN Scale factor to the audio TX modulation.
|
||||
|
||||
//switch (mode) {
|
||||
@@ -145,7 +151,7 @@ void FM::execute(const buffer_s16_t& audio, const buffer_c8_t& buffer, bool& con
|
||||
|
||||
for (size_t counter = 0; counter < buffer.count; counter++) {
|
||||
|
||||
sample = audio.p[counter>>6] >> 8; // sample = audio.p[counter / over] >> 8; (not enough efficient running code, over = 1536000/240000= 64 )
|
||||
sample = audio.p[counter>>6] >> audio_shift_bits_s16_FM ; // Orig. >>8 , sample = audio.p[counter / over] >> 8; (not enough efficient running code, over = 1536000/240000= 64 )
|
||||
sample *= audio_gain; // Apply GAIN Scale factor to the audio TX modulation.
|
||||
|
||||
if (play_beep) {
|
||||
@@ -190,7 +196,7 @@ void AM::execute(const buffer_s16_t& audio, const buffer_c8_t& buffer, bool& con
|
||||
|
||||
for (size_t counter = 0; counter < buffer.count; counter++) {
|
||||
if (counter % 128 == 0) {
|
||||
sample = audio.p[counter / over] >> 2;
|
||||
sample = audio.p[counter / over] >> audio_shift_bits_s16_AM_DSB_SSB; // originally fixed >> 2, now >>2 for AK, 0,1,2,3 for WM (boost off)
|
||||
sample *= audio_gain; // Apply GAIN Scale factor to the audio TX modulation.
|
||||
}
|
||||
|
||||
|
@@ -50,9 +50,11 @@ public:
|
||||
void set_mode(Mode new_mode);
|
||||
|
||||
void set_over(uint32_t new_over);
|
||||
void set_gain_vumeter_beep(float new_audio_gain , bool new_play_beep );
|
||||
void set_gain_shiftbits_vumeter_beep(float new_audio_gain ,uint8_t new_audio_shift_bits_s16, bool new_play_beep );
|
||||
int32_t apply_beep(int32_t sample_in, bool& configured_in, uint32_t& new_beep_index, uint32_t& new_beep_timer, TXProgressMessage& new_txprogress_message );
|
||||
float audio_gain { };
|
||||
uint8_t audio_shift_bits_s16_FM { }; // shift bits factor to the captured ADC S16 audio sample.
|
||||
uint8_t audio_shift_bits_s16_AM_DSB_SSB { };
|
||||
bool play_beep { false };
|
||||
uint32_t power_acc_count { 0 }; // this var it is initialized from Proc_mictx.cpp
|
||||
uint32_t divider { }; // this var it is initialized from Proc_mictx.cpp
|
||||
|
@@ -35,7 +35,7 @@ void MicTXProcessor::execute(const buffer_c8_t& buffer){
|
||||
if (!configured) return;
|
||||
|
||||
audio_input.read_audio_buffer(audio_buffer);
|
||||
modulator->set_gain_vumeter_beep(audio_gain, play_beep ) ;
|
||||
modulator->set_gain_shiftbits_vumeter_beep(audio_gain, audio_shift_bits_s16, play_beep ) ;
|
||||
modulator->execute(audio_buffer, buffer, configured, beep_index, beep_timer, txprogress_message, level_message, power_acc_count, divider ); // Now "Key Tones & CTCSS" baseband additon inside FM mod. dsp_modulate.cpp"
|
||||
|
||||
/* Original fw 1.3.1 good reference, beep and vu-meter
|
||||
@@ -141,6 +141,7 @@ void MicTXProcessor::on_message(const Message* const msg) {
|
||||
}
|
||||
|
||||
audio_gain = config_message.audio_gain;
|
||||
audio_shift_bits_s16 = config_message.audio_shift_bits_s16;
|
||||
divider = config_message.divider;
|
||||
power_acc_count = 0;
|
||||
|
||||
|
@@ -61,6 +61,8 @@ private:
|
||||
|
||||
uint32_t divider { };
|
||||
float audio_gain { };
|
||||
uint8_t audio_shift_bits_s16 { } ; // shift bits factor to the captured ADC S16 audio sample.
|
||||
|
||||
uint64_t power_acc { 0 };
|
||||
uint32_t power_acc_count { 0 };
|
||||
bool play_beep { false };
|
||||
|
Reference in New Issue
Block a user