More debug Audio Beep Test tweaks (#2028)

This commit is contained in:
Mark Thompson 2024-03-23 13:25:36 -05:00 committed by GitHub
parent 28a5fc5915
commit 81e24d582d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 41 additions and 12 deletions

View file

@ -27,7 +27,13 @@
// Functions for audio beep (used by Sonde RSSI)
void ToneGen::configure_beep(const uint32_t freq, const uint32_t sample_rate) {
f_delta_ = (float)(freq * sizeof(sine_table_i8)) / sample_rate;
f_tone_phase_ = sizeof(sine_table_i8) / 4; // Start at sine peak to handle case of freq=sample_rate/2
f_tone_phase_ = 0.0;
// For higher frequencies, start at sine peak to handle case of freq=sample_rate/2;
// we don't want to sample the sine wave only when it's crossing 0!
// There is still an amplitude issue though depending on magnitude of selected sine sample deltas.
if (f_delta_ >= sizeof(sine_table_i8) / 4)
f_tone_phase_ = sizeof(sine_table_i8) / 4;
}
int16_t ToneGen::process_beep() {