mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-31 18:49:15 -04:00
Formatted code (#1007)
* Updated style * Updated files * fixed new line * Updated spacing * File fix WIP * Updated to clang 13 * updated comment style * Removed old comment code
This commit is contained in:
parent
7aca7ce74d
commit
033c4e9a5b
599 changed files with 70746 additions and 66896 deletions
|
@ -25,29 +25,28 @@
|
|||
#include <array>
|
||||
|
||||
bool FMSquelch::execute(const buffer_f32_t& audio) {
|
||||
if( threshold_squared == 0.0f ) {
|
||||
return true;
|
||||
}
|
||||
if (threshold_squared == 0.0f) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: No hard-coded array size.
|
||||
std::array<float, N> squelch_energy_buffer;
|
||||
const buffer_f32_t squelch_energy {
|
||||
squelch_energy_buffer.data(),
|
||||
squelch_energy_buffer.size()
|
||||
};
|
||||
non_audio_hpf.execute(audio, squelch_energy);
|
||||
// TODO: No hard-coded array size.
|
||||
std::array<float, N> squelch_energy_buffer;
|
||||
const buffer_f32_t squelch_energy{
|
||||
squelch_energy_buffer.data(),
|
||||
squelch_energy_buffer.size()};
|
||||
non_audio_hpf.execute(audio, squelch_energy);
|
||||
|
||||
float non_audio_max_squared = 0;
|
||||
for(const auto sample : squelch_energy_buffer) {
|
||||
const float sample_squared = sample * sample;
|
||||
if( sample_squared > non_audio_max_squared ) {
|
||||
non_audio_max_squared = sample_squared;
|
||||
}
|
||||
}
|
||||
float non_audio_max_squared = 0;
|
||||
for (const auto sample : squelch_energy_buffer) {
|
||||
const float sample_squared = sample * sample;
|
||||
if (sample_squared > non_audio_max_squared) {
|
||||
non_audio_max_squared = sample_squared;
|
||||
}
|
||||
}
|
||||
|
||||
return (non_audio_max_squared < threshold_squared);
|
||||
return (non_audio_max_squared < threshold_squared);
|
||||
}
|
||||
|
||||
void FMSquelch::set_threshold(const float new_value) {
|
||||
threshold_squared = new_value * new_value;
|
||||
threshold_squared = new_value * new_value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue