(almost) One loop to rule all the samples

Avoid looping over and over the samples. One
This commit is contained in:
Geoffrey Merck 2020-04-21 20:38:02 +02:00
parent 87c3b57ae4
commit 8d340cbfba
9 changed files with 78 additions and 43 deletions

View file

@ -152,6 +152,32 @@ void CFMKeyer::getAudio(q15_t* samples, uint8_t length)
}
}
q15_t CFMKeyer::getAudio(q15_t sample)
{
if (!m_wanted)
return 0U; //TODO F4FXL, not sure what to do here
q15_t output;
bool b = READ_BIT(m_poBuffer, m_poPos);
if (b)
output = sample + m_audio[m_audioPos];
m_audioPos++;
if (m_audioPos >= m_audioLen)
m_audioPos = 0U;
m_dotPos++;
if (m_dotPos >= m_dotLen) {
m_dotPos = 0U;
m_poPos++;
if (m_poPos >= m_poLen) {
stop();
return sample;
}
}
return output;
}
void CFMKeyer::start()
{
if (isRunning())