From 1c599138ada1610e5730dfdddad3e59a64cd95c6 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Tue, 21 Apr 2020 22:00:11 +0200 Subject: [PATCH] GetAudio do not take any arguments --- FM.cpp | 10 +++++----- FMCTCSSTX.cpp | 4 ++-- FMCTCSSTX.h | 2 +- FMKeyer.cpp | 12 ++++++------ FMKeyer.h | 2 +- FMTimeout.cpp | 8 ++++++-- FMTimeout.h | 2 +- 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/FM.cpp b/FM.cpp index db339e6..5852061 100644 --- a/FM.cpp +++ b/FM.cpp @@ -75,16 +75,16 @@ void CFM::samples(bool cos, q15_t* samples, uint8_t length) currentSample = 0U; } - /*if(!m_callsign.isRunning()) - currentSample = m_rfAck.getAudio(currentSample); + if(!m_callsign.isRunning()) + currentSample += m_rfAck.getAudio(); if(!m_rfAck.isRunning()) - currentSample = m_rfAck.getAudio(currentSample); + currentSample += m_callsign.getAudio(); if (!m_callsign.isRunning() && !m_rfAck.isRunning()) - currentSample = m_timeoutTone.getAudio(currentSample);*/ + currentSample += m_timeoutTone.getAudio(); - currentSample = m_ctcssTX.getAudio(currentSample); + currentSample += m_ctcssTX.getAudio(); samples[i] = currentSample; } diff --git a/FMCTCSSTX.cpp b/FMCTCSSTX.cpp index d8c4324..5011ce5 100644 --- a/FMCTCSSTX.cpp +++ b/FMCTCSSTX.cpp @@ -126,9 +126,9 @@ void CFMCTCSSTX::getAudio(q15_t* samples, uint8_t length) } } -q15_t CFMCTCSSTX::getAudio(q15_t sample) +q15_t CFMCTCSSTX::getAudio() { - sample += m_values[m_n++]; + q15_t sample = m_values[m_n++]; if(m_n >= m_length) m_n = 0U; diff --git a/FMCTCSSTX.h b/FMCTCSSTX.h index e72d654..a8dfd37 100644 --- a/FMCTCSSTX.h +++ b/FMCTCSSTX.h @@ -28,7 +28,7 @@ public: uint8_t setParams(uint8_t frequency, uint8_t level); void getAudio(q15_t* samples, uint8_t length); - q15_t getAudio(q15_t sample); + q15_t getAudio(); private: q15_t* m_values; diff --git a/FMKeyer.cpp b/FMKeyer.cpp index 44225b0..f16ebc0 100644 --- a/FMKeyer.cpp +++ b/FMKeyer.cpp @@ -152,15 +152,15 @@ void CFMKeyer::getAudio(q15_t* samples, uint8_t length) } } -q15_t CFMKeyer::getAudio(q15_t sample) +q15_t CFMKeyer::getAudio() { + q15_t output = 0U; if (!m_wanted) - return 0U; //TODO F4FXL, not sure what to do here - - q15_t output; + return 0U; + bool b = READ_BIT(m_poBuffer, m_poPos); if (b) - output = sample + m_audio[m_audioPos]; + output = m_audio[m_audioPos]; m_audioPos++; if (m_audioPos >= m_audioLen) @@ -171,7 +171,7 @@ q15_t CFMKeyer::getAudio(q15_t sample) m_poPos++; if (m_poPos >= m_poLen) { stop(); - return sample; + return output; } } diff --git a/FMKeyer.h b/FMKeyer.h index e13f2fb..88308e6 100644 --- a/FMKeyer.h +++ b/FMKeyer.h @@ -29,7 +29,7 @@ public: void getAudio(q15_t* samples, uint8_t length); - q15_t getAudio(q15_t sample); + q15_t getAudio(); void start(); void stop(); diff --git a/FMTimeout.cpp b/FMTimeout.cpp index d6dab6e..c64aada 100644 --- a/FMTimeout.cpp +++ b/FMTimeout.cpp @@ -62,8 +62,12 @@ void CFMTimeout::getAudio(q15_t* samples, uint8_t length) } } -q15_t CFMTimeout::getAudio(q15_t sample) +q15_t CFMTimeout::getAudio() { + q15_t sample = 0U; + if (!m_running) + return sample; + if (m_pos > 12000U) { q31_t sample = BUSY_AUDIO[m_n] * m_level; sample = q15_t(__SSAT((sample >> 15), 16)); @@ -79,7 +83,7 @@ q15_t CFMTimeout::getAudio(q15_t sample) if (m_pos >= 24000U) m_pos = 0U; - return sample; + return sample; } void CFMTimeout::start() diff --git a/FMTimeout.h b/FMTimeout.h index d6e4967..8b8a415 100644 --- a/FMTimeout.h +++ b/FMTimeout.h @@ -32,7 +32,7 @@ public: void getAudio(q15_t* samples, uint8_t length); - q15_t getAudio(q15_t sample); + q15_t getAudio(); private: q15_t m_level;