mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-05-07 13:37:48 +00:00
(almost) One loop to rule all the samples
Avoid looping over and over the samples. One
This commit is contained in:
parent
87c3b57ae4
commit
8d340cbfba
9 changed files with 78 additions and 43 deletions
26
FMKeyer.cpp
26
FMKeyer.cpp
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue