Slight improvement of the tone generator.

This commit is contained in:
teixeluis
2021-06-11 00:13:56 +01:00
parent edcd780402
commit c2dc7d1cf5
6 changed files with 99 additions and 38 deletions

View File

@@ -90,8 +90,6 @@
#include "audio_output.hpp"
#include "tone_gen.hpp"
#include "tonesets.hpp"
#include "sine_table_int16.hpp"
#include "buffer.hpp"
@@ -108,7 +106,6 @@ public:
private:
static constexpr size_t baseband_fs = 2457600;
static constexpr size_t beep_iterations = 60;
std::array<int16_t, 32> audio { };
@@ -119,12 +116,11 @@ private:
AudioOutput audio_output { };
bool beep_playing { false };
bool beep_play { false };
bool silence_play { false };
bool pitch_rssi_enabled { false };
uint32_t tone_delta { 0 };
uint32_t tone_phase { 0 };
uint8_t curr_sample { 0 };
ToneGen tone_gen { };
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Receive };
RSSIThread rssi_thread { NORMALPRIO + 10 };
@@ -178,7 +174,16 @@ private:
void play_beep();
void stop_beep();
/**
* Used for filling the audio buffer with the waveform
* generated by the ToneGen class:
*
*/
void generate_beep();
/**
* Used for filling the audio buffer with silence:
*/
void generate_silence();
void pitch_rssi_config(const PitchRSSIConfigureMessage& message);