Added AUDIO_PlayQueuedVoice.

This commit is contained in:
Dual Tachyon 2023-08-15 11:04:21 +01:00
parent 396c2b122d
commit 1f113ccd7e
2 changed files with 57 additions and 0 deletions

56
audio.c
View File

@ -282,3 +282,59 @@ uint8_t AUDIO_SetDigitVoice(uint8_t Index, uint32_t Value)
return Count + 1;
}
void AUDIO_PlayQueuedVoice(void)
{
uint8_t VoiceID;
uint8_t Delay;
bool Skip;
Skip = false;
gVoiceReadIndex = gVoiceReadIndex;
if (gVoiceReadIndex != gVoiceWriteIndex && gEeprom.KEYPAD_TONE != 0) {
VoiceID = gVoiceID[gVoiceReadIndex];
if (gEeprom.KEYPAD_TONE == 1) {
if (VoiceID < 58) {
Delay = VoiceClipLengthChinese[VoiceID];
VoiceID += VOICE_ID_CHI_BASE;
} else {
Skip = true;
}
} else {
if (VoiceID < 76) {
Delay = VoiceClipLengthEnglish[VoiceID];
VoiceID += VOICE_ID_ENG_BASE;
} else {
Skip = true;
}
}
gVoiceReadIndex++;
if (gVoiceReadIndex == gVoiceWriteIndex) {
Delay += 3;
}
if (!Skip) {
AUDIO_PlayVoice(VoiceID);
gCountdownToPlayNextVoice = Delay;
gFlagPlayQueuedVoice = false;
g_200003B6 = 2000;
return;
}
}
if (gCurrentFunction == FUNCTION_4 || gCurrentFunction == FUNCTION_2) {
if (gInfoCHAN_A->_0x0033 == true) {
BK4819_SetAF(BK4819_AF_7);
} else {
BK4819_SetAF(BK4819_AF_OPEN);
}
}
if (gFmMute == true) {
BK1080_Mute(false);
}
if (g_2000036B == 0) {
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
}
g_200003B6 = 0x50;
gVoiceWriteIndex = 0;
gVoiceReadIndex = 0;
}

View File

@ -126,6 +126,7 @@ void AUDIO_PlayVoice(VOICE_ID_t VoiceID);
void AUDIO_PlaySingleVoice(bool bFlag);
void AUDIO_SetVoiceID(uint8_t Index, VOICE_ID_t VoiceID);
uint8_t AUDIO_SetDigitVoice(uint8_t Index, uint32_t Value);
void AUDIO_PlayQueuedVoice(void);
#endif