Partial fix for speaker pop when a voiceprompt begins
This commit is contained in:
parent
5ee3a2e9f0
commit
0692bea269
|
|
@ -411,15 +411,17 @@ void vp_terminate()
|
||||||
|
|
||||||
void vp_stop()
|
void vp_stop()
|
||||||
{
|
{
|
||||||
voicePromptActive = false;
|
voicePromptActive = false;
|
||||||
|
disableSpkOutput();
|
||||||
|
codec_stop();
|
||||||
|
|
||||||
|
// Clear voice prompt sequence data
|
||||||
vpCurrentSequence.pos = 0;
|
vpCurrentSequence.pos = 0;
|
||||||
vpCurrentSequence.c2DataIndex = 0;
|
vpCurrentSequence.c2DataIndex = 0;
|
||||||
vpCurrentSequence.c2DataLength = 0;
|
vpCurrentSequence.c2DataLength = 0;
|
||||||
codec_stop();
|
|
||||||
|
|
||||||
// If any beep is playing, immediately stop it.
|
// If any beep is playing, immediately stop it.
|
||||||
beep_flush();
|
beep_flush();
|
||||||
disableSpkOutput();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp_flush()
|
void vp_flush()
|
||||||
|
|
@ -562,8 +564,8 @@ void vp_play()
|
||||||
|
|
||||||
voicePromptActive = true;
|
voicePromptActive = true;
|
||||||
|
|
||||||
enableSpkOutput();
|
|
||||||
codec_startDecode(SINK_SPK);
|
codec_startDecode(SINK_SPK);
|
||||||
|
enableSpkOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp_tick()
|
void vp_tick()
|
||||||
|
|
@ -619,11 +621,11 @@ void vp_tick()
|
||||||
// see if we've finished.
|
// see if we've finished.
|
||||||
if(vpCurrentSequence.pos == vpCurrentSequence.length)
|
if(vpCurrentSequence.pos == vpCurrentSequence.length)
|
||||||
{
|
{
|
||||||
|
disableSpkOutput();
|
||||||
voicePromptActive = false;
|
voicePromptActive = false;
|
||||||
vpCurrentSequence.pos = 0;
|
vpCurrentSequence.pos = 0;
|
||||||
vpCurrentSequence.c2DataIndex = 0;
|
vpCurrentSequence.c2DataIndex = 0;
|
||||||
vpCurrentSequence.c2DataLength = 0;
|
vpCurrentSequence.c2DataLength = 0;
|
||||||
disableSpkOutput();
|
|
||||||
codec_stop();
|
codec_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -657,8 +659,8 @@ void vp_beep(uint16_t freq, uint16_t duration)
|
||||||
beepSeriesBuffer[1].duration = 0;
|
beepSeriesBuffer[1].duration = 0;
|
||||||
currentBeepDuration = duration;
|
currentBeepDuration = duration;
|
||||||
beepSeriesIndex = 0;
|
beepSeriesIndex = 0;
|
||||||
enableSpkOutput();
|
|
||||||
platform_beepStart(freq);
|
platform_beepStart(freq);
|
||||||
|
enableSpkOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp_beepSeries(const uint16_t* beepSeries)
|
void vp_beepSeries(const uint16_t* beepSeries)
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ void audio_init()
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gpio_setMode(BEEP_OUT, INPUT);
|
||||||
|
|
||||||
gpio_setPin(SPK_MUTE); // Speaker muted
|
gpio_setPin(SPK_MUTE); // Speaker muted
|
||||||
#ifndef PLATFORM_MD9600
|
#ifndef PLATFORM_MD9600
|
||||||
gpio_clearPin(AUDIO_AMP_EN); // Audio PA off
|
gpio_clearPin(AUDIO_AMP_EN); // Audio PA off
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ streamId outputStream_start(const enum AudioSink destination,
|
||||||
NVIC_EnableIRQ(DMA1_Stream2_IRQn);
|
NVIC_EnableIRQ(DMA1_Stream2_IRQn);
|
||||||
|
|
||||||
// Enable compare channel
|
// Enable compare channel
|
||||||
TIM3->CCR3 = 0;
|
TIM3->CCR3 = buf[0];
|
||||||
TIM3->CCER |= TIM_CCER_CC3E;
|
TIM3->CCER |= TIM_CCER_CC3E;
|
||||||
TIM3->CR1 |= TIM_CR1_CEN;
|
TIM3->CR1 |= TIM_CR1_CEN;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue