mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-10-23 11:05:00 +02:00
(almost) One loop to rule all the samples
Avoid looping over and over the samples. One
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user