Add Mixer::loop() to allow just sending I2S data
Allow users to call the ::loop() method to pump out any possible data to the I2S interface, without requiring any Stubs to pump the queue.
This commit is contained in:
1 parent
e9aec0449d
commit
db411fadbf
2 files changed
+10
-3
No files matched your search
@@ -177,7 +177,7 @@ void AudioOutputMixer::RemoveInput(int id)
|
||||
stubRunning[id] = false;
|
||||
}
|
||||
|
||||
bool AudioOutputMixer::ConsumeSample(int16_t sample[2], int id)
|
||||
bool AudioOutputMixer::loop()
|
||||
{
|
||||
// First, try and fill I2S...
|
||||
// This is not optimal, but algorithmically should work fine
|
||||
@@ -216,7 +216,13 @@ bool AudioOutputMixer::ConsumeSample(int16_t sample[2], int id)
|
||||
readPtr = (readPtr + 1) % buffSize;
|
||||
}
|
||||
} while (avail);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputMixer::ConsumeSample(int16_t sample[2], int id)
|
||||
{
|
||||
loop(); // Send any pre-existing, completed I2S data we can fit
|
||||
|
||||
// Now, do we have space for a new sample?
|
||||
int nextWritePtr = (writePtr[id] + 1) % buffSize;
|
||||
if (nextWritePtr == readPtr) {
|
||||
|
||||
Reference in new issue
Block a user