renamed i2sOutputFlushScheduled
This commit is contained in:
parent
ad725ffc71
commit
50f033c617
3 changed files with 7 additions and 7 deletions
|
|
@ -59,7 +59,7 @@ VolumeStream volume(i2s); //access from audioStreamTask only
|
||||||
QueueStream<uint8_t> queue(audioBuffer); //access from audioStreamTask only
|
QueueStream<uint8_t> queue(audioBuffer); //access from audioStreamTask only
|
||||||
StreamCopy copier(volume, queue);
|
StreamCopy copier(volume, queue);
|
||||||
AudioInfo info(SAMPLE_RATE, CHANNELS, BITS_PER_SAMPLE);
|
AudioInfo info(SAMPLE_RATE, CHANNELS, BITS_PER_SAMPLE);
|
||||||
volatile bool outputFlushScheduled = false;
|
volatile bool i2sOutputFlushScheduled = false;
|
||||||
|
|
||||||
unsigned long getSpeakingDuration() {
|
unsigned long getSpeakingDuration() {
|
||||||
if (deviceState == SPEAKING && speakingStartTime > 0) {
|
if (deviceState == SPEAKING && speakingStartTime > 0) {
|
||||||
|
|
@ -91,7 +91,7 @@ void transitionToListening() {
|
||||||
Serial.println("Transitioning to listening mode");
|
Serial.println("Transitioning to listening mode");
|
||||||
|
|
||||||
i2sInputFlushScheduled = true;
|
i2sInputFlushScheduled = true;
|
||||||
outputFlushScheduled = true;
|
i2sOutputFlushScheduled = true;
|
||||||
|
|
||||||
Serial.println("Transitioned to listening mode");
|
Serial.println("Transitioned to listening mode");
|
||||||
|
|
||||||
|
|
@ -139,8 +139,8 @@ void audioStreamTask(void *parameter) {
|
||||||
volume.begin(vcfg);
|
volume.begin(vcfg);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if ( outputFlushScheduled) {
|
if ( i2sOutputFlushScheduled) {
|
||||||
outputFlushScheduled = false;
|
i2sOutputFlushScheduled = false;
|
||||||
i2s.flush();
|
i2s.flush();
|
||||||
volume.flush();
|
volume.flush();
|
||||||
queue.flush();
|
queue.flush();
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ extern VolumeStream volume;
|
||||||
extern QueueStream<uint8_t> queue;
|
extern QueueStream<uint8_t> queue;
|
||||||
extern StreamCopy copier;
|
extern StreamCopy copier;
|
||||||
extern AudioInfo info;
|
extern AudioInfo info;
|
||||||
extern volatile bool outputFlushScheduled;
|
extern volatile bool i2sOutputFlushScheduled;
|
||||||
|
|
||||||
// AUDIO INPUT
|
// AUDIO INPUT
|
||||||
extern I2SStream i2sInput;
|
extern I2SStream i2sInput;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ void enterSleep()
|
||||||
// First, change device state to prevent any new data processing
|
// First, change device state to prevent any new data processing
|
||||||
deviceState = SLEEP;
|
deviceState = SLEEP;
|
||||||
scheduleListeningRestart = false;
|
scheduleListeningRestart = false;
|
||||||
outputFlushScheduled = true;
|
i2sOutputFlushScheduled = true;
|
||||||
i2sInputFlushScheduled = true;
|
i2sInputFlushScheduled = true;
|
||||||
vTaskDelay(10); //let all tasks accept state
|
vTaskDelay(10); //let all tasks accept state
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ void enterSleep()
|
||||||
i2s_stop(I2S_PORT_OUT);
|
i2s_stop(I2S_PORT_OUT);
|
||||||
|
|
||||||
// Clear any remaining audio in buffer
|
// Clear any remaining audio in buffer
|
||||||
outputFlushScheduled = true;
|
i2sOutputFlushScheduled = true;
|
||||||
|
|
||||||
// Properly disconnect WebSocket and wait for it to complete
|
// Properly disconnect WebSocket and wait for it to complete
|
||||||
if (webSocket.isConnected()) {
|
if (webSocket.isConnected()) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue