ggwave : add option to query the generated tones

Calling the getWaveformTones() method after calling encode() gives a
list of the tones participating in the generated sound
This commit is contained in:
Georgi Gerganov
2021-04-03 18:46:21 +03:00
parent 7d88f42e4e
commit ba87a651e3
3 changed files with 49 additions and 3 deletions

View File

@@ -275,6 +275,14 @@ public:
return kTxProtocols;
}
struct ToneData {
double freq_hz;
double duration_ms;
};
using Tones = std::vector<ToneData>;
using WaveformTones = std::vector<Tones>;
using AmplitudeData = std::vector<float>;
using AmplitudeDataI16 = std::vector<int16_t>;
using SpectrumData = std::vector<float>;
@@ -355,6 +363,12 @@ public:
static const TxProtocol & getTxProtocol(int id) { return getTxProtocols().at(TxProtocolId(id)); }
static const TxProtocol & getTxProtocol(TxProtocolId id) { return getTxProtocols().at(id); }
// get a list of the tones generated for the last waveform
//
// Call this method after calling encode() to get a list of the tones participating in the generated waveform
//
const WaveformTones & getWaveformTones() { return m_waveformTones; }
bool takeTxAmplitudeI16(AmplitudeDataI16 & dst);
// Rx
@@ -473,6 +487,7 @@ private:
TxRxData m_outputBlockTmp;
AmplitudeDataI16 m_outputBlockI16;
AmplitudeDataI16 m_txAmplitudeDataI16;
WaveformTones m_waveformTones;
// Impl
// todo : move all members inside Impl