(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
+20
View File
@@ -62,6 +62,26 @@ void CFMTimeout::getAudio(q15_t* samples, uint8_t length)
}
}
q15_t CFMTimeout::getAudio(q15_t sample)
{
if (m_pos > 12000U) {
q31_t sample = BUSY_AUDIO[m_n] * m_level;
sample = q15_t(__SSAT((sample >> 15), 16));
m_n++;
if (m_n >= BUSY_AUDIO_LEN)
m_n = 0U;
} else {
sample = 0U;
}
m_pos++;
if (m_pos >= 24000U)
m_pos = 0U;
return sample;
}
void CFMTimeout::start()
{
m_running = true;