GetAudio do not take any arguments

This commit is contained in:
Geoffrey Merck 2020-04-21 22:00:11 +02:00
parent 9170c398be
commit 1c599138ad
7 changed files with 22 additions and 18 deletions

10
FM.cpp
View File

@ -75,16 +75,16 @@ void CFM::samples(bool cos, q15_t* samples, uint8_t length)
currentSample = 0U; currentSample = 0U;
} }
/*if(!m_callsign.isRunning()) if(!m_callsign.isRunning())
currentSample = m_rfAck.getAudio(currentSample); currentSample += m_rfAck.getAudio();
if(!m_rfAck.isRunning()) if(!m_rfAck.isRunning())
currentSample = m_rfAck.getAudio(currentSample); currentSample += m_callsign.getAudio();
if (!m_callsign.isRunning() && !m_rfAck.isRunning()) 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; samples[i] = currentSample;
} }

View File

@ -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) if(m_n >= m_length)
m_n = 0U; m_n = 0U;

View File

@ -28,7 +28,7 @@ public:
uint8_t setParams(uint8_t frequency, uint8_t level); uint8_t setParams(uint8_t frequency, uint8_t level);
void getAudio(q15_t* samples, uint8_t length); void getAudio(q15_t* samples, uint8_t length);
q15_t getAudio(q15_t sample); q15_t getAudio();
private: private:
q15_t* m_values; q15_t* m_values;

View File

@ -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) if (!m_wanted)
return 0U; //TODO F4FXL, not sure what to do here return 0U;
q15_t output;
bool b = READ_BIT(m_poBuffer, m_poPos); bool b = READ_BIT(m_poBuffer, m_poPos);
if (b) if (b)
output = sample + m_audio[m_audioPos]; output = m_audio[m_audioPos];
m_audioPos++; m_audioPos++;
if (m_audioPos >= m_audioLen) if (m_audioPos >= m_audioLen)
@ -171,7 +171,7 @@ q15_t CFMKeyer::getAudio(q15_t sample)
m_poPos++; m_poPos++;
if (m_poPos >= m_poLen) { if (m_poPos >= m_poLen) {
stop(); stop();
return sample; return output;
} }
} }

View File

@ -29,7 +29,7 @@ public:
void getAudio(q15_t* samples, uint8_t length); void getAudio(q15_t* samples, uint8_t length);
q15_t getAudio(q15_t sample); q15_t getAudio();
void start(); void start();
void stop(); void stop();

View File

@ -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) { if (m_pos > 12000U) {
q31_t sample = BUSY_AUDIO[m_n] * m_level; q31_t sample = BUSY_AUDIO[m_n] * m_level;
sample = q15_t(__SSAT((sample >> 15), 16)); sample = q15_t(__SSAT((sample >> 15), 16));
@ -79,7 +83,7 @@ q15_t CFMTimeout::getAudio(q15_t sample)
if (m_pos >= 24000U) if (m_pos >= 24000U)
m_pos = 0U; m_pos = 0U;
return sample; return sample;
} }
void CFMTimeout::start() void CFMTimeout::start()

View File

@ -32,7 +32,7 @@ public:
void getAudio(q15_t* samples, uint8_t length); void getAudio(q15_t* samples, uint8_t length);
q15_t getAudio(q15_t sample); q15_t getAudio();
private: private:
q15_t m_level; q15_t m_level;