Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #246 from lucoiso/development
Browse files Browse the repository at this point in the history
v1.6.14: Fix audio config checking (#245)
  • Loading branch information
lucoiso authored Oct 20, 2023
2 parents 972cbd5 + 5b32d3b commit 2e6f40e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions AzSpeech.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 30,
"VersionName": "1.6.13",
"Version": 31,
"VersionName": "1.6.14",
"FriendlyName": "AzSpeech - Voice and Text",
"Description": "Integrates Azure Speech Cognitive Services into the Engine by adding functions to perform recognition and synthesis via asynchronous tasks.",
"Category": "Game Features",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ bool FAzSpeechRecognitionRunnableBase::InitializeAzureObject()

ApplySDKSettings(SpeechConfig);

const auto TaskAudioConfig = GetAudioConfig();
if (!SpeechConfig)
{
UE_LOG(LogAzSpeech_Internal, Error, TEXT("Thread: %s; Function: %s; Message: Invalid audio config"), *GetThreadName(), *FString(__func__));
return false;
}

if (RecognizerTask->GetRecognitionOptions().bUseLanguageIdentification)
{
const std::vector<std::string> Candidates = GetCandidateLanguages();
Expand All @@ -193,15 +200,11 @@ bool FAzSpeechRecognitionRunnableBase::InitializeAzureObject()
return false;
}

SpeechRecognizer = MicrosoftSpeech::SpeechRecognizer::FromConfig(SpeechConfig, MicrosoftSpeech::AutoDetectSourceLanguageConfig::FromLanguages(Candidates), GetAudioConfig());
}
else if (const std::shared_ptr<MicrosoftSpeech::Audio::AudioConfig> TaskAudioConfig = GetAudioConfig())
{
SpeechRecognizer = MicrosoftSpeech::SpeechRecognizer::FromConfig(SpeechConfig, TaskAudioConfig);
SpeechRecognizer = MicrosoftSpeech::SpeechRecognizer::FromConfig(SpeechConfig, MicrosoftSpeech::AutoDetectSourceLanguageConfig::FromLanguages(Candidates), TaskAudioConfig);
}
else
{
return false;
SpeechRecognizer = MicrosoftSpeech::SpeechRecognizer::FromConfig(SpeechConfig, TaskAudioConfig);
}

return InsertPhraseList() && ConnectRecognitionStartedSignals() && ConnectRecognitionUpdatedSignals();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,21 @@ bool FAzSpeechSynthesisRunnable::InitializeAzureObject()

ApplySDKSettings(SpeechConfig);

if (!SynthesizerTask->IsSSMLBased() && SynthesizerTask->GetSynthesisOptions().bUseLanguageIdentification)
const auto TaskAudioConfig = GetAudioConfig();
if (!SpeechConfig)
{
UE_LOG(LogAzSpeech_Internal, Display, TEXT("Thread: %s; Function: %s; Message: Initializing auto language detection"), *GetThreadName(), *FString(__func__));
SpeechSynthesizer = MicrosoftSpeech::SpeechSynthesizer::FromConfig(SpeechConfig, MicrosoftSpeech::AutoDetectSourceLanguageConfig::FromOpenRange(), GetAudioConfig());
UE_LOG(LogAzSpeech_Internal, Error, TEXT("Thread: %s; Function: %s; Message: Invalid audio config"), *GetThreadName(), *FString(__func__));
return false;
}
else if (const std::shared_ptr<MicrosoftSpeech::Audio::AudioConfig> TaskAudioConfig = GetAudioConfig())

if (!SynthesizerTask->IsSSMLBased() && SynthesizerTask->GetSynthesisOptions().bUseLanguageIdentification)
{
SpeechSynthesizer = MicrosoftSpeech::SpeechSynthesizer::FromConfig(SpeechConfig, TaskAudioConfig);
UE_LOG(LogAzSpeech_Internal, Display, TEXT("Thread: %s; Function: %s; Message: Initializing auto language detection"), *GetThreadName(), *FString(__func__));
SpeechSynthesizer = MicrosoftSpeech::SpeechSynthesizer::FromConfig(SpeechConfig, MicrosoftSpeech::AutoDetectSourceLanguageConfig::FromOpenRange(), TaskAudioConfig);
}
else
{
return false;
SpeechSynthesizer = MicrosoftSpeech::SpeechSynthesizer::FromConfig(SpeechConfig, TaskAudioConfig);
}

return ConnectVisemeSignal() && ConnectSynthesisStartedSignal() && ConnectSynthesisUpdateSignals();
Expand Down

0 comments on commit 2e6f40e

Please sign in to comment.