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 #229 from lucoiso/development
Browse files Browse the repository at this point in the history
AzSpeech v1.6.12
  • Loading branch information
lucoiso authored Aug 28, 2023
2 parents 357086b + b1fc992 commit 51caa04
Show file tree
Hide file tree
Showing 55 changed files with 851 additions and 482 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": 28,
"VersionName": "1.6.11",
"Version": 29,
"VersionName": "1.6.12",
"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
62 changes: 1 addition & 61 deletions Source/AzSpeech/Private/AzSpeech/AzSpeechEngineSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@
// Repo: https://github.com/lucoiso/UEAzSpeech

#include "AzSpeech/AzSpeechEngineSubsystem.h"
#include "AzSpeech/Tasks/Bases/AzSpeechTaskBase.h"
#include "AzSpeech/Tasks/SpeechToTextAsync.h"
#include "AzSpeech/Tasks/SSMLToAudioDataAsync.h"
#include "AzSpeech/Tasks/SSMLToSoundWaveAsync.h"
#include "AzSpeech/Tasks/SSMLToSpeechAsync.h"
#include "AzSpeech/Tasks/SSMLToWavFileAsync.h"
#include "AzSpeech/Tasks/TextToAudioDataAsync.h"
#include "AzSpeech/Tasks/TextToSoundWaveAsync.h"
#include "AzSpeech/Tasks/TextToSpeechAsync.h"
#include "AzSpeech/Tasks/TextToWavFileAsync.h"
#include "AzSpeech/Tasks/WavFileToTextAsync.h"
#include "AzSpeech/Tasks/Synthesis/Bases/AzSpeechSpeechSynthesisBase.h"
#include "LogAzSpeech.h"

#ifdef UE_INLINE_GENERATED_CPP_BY_NAME
Expand Down Expand Up @@ -143,56 +133,6 @@ bool UAzSpeechEngineSubsystem::IsQueueEmpty(const int64 QueueId) const
return TaskQueueMap.Find(QueueId)->Value.IsEmpty();
}

UAzSpeechTaskBase* UAzSpeechEngineSubsystem::CreateSpeechToTextTask(UObject* WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechRecognitionOptions RecognitionOptions, const FString& AudioInputDeviceID, const FName PhraseListGroup)
{
return USpeechToTextAsync::SpeechToText_CustomOptions(WorldContextObject, SubscriptionOptions, RecognitionOptions, AudioInputDeviceID, PhraseListGroup);
}

UAzSpeechTaskBase* UAzSpeechEngineSubsystem::CreateSSMLToAudioDataTask(UObject* WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisSSML)
{
return USSMLToAudioDataAsync::SSMLToAudioData_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisSSML);
}

UAzSpeechTaskBase* UAzSpeechEngineSubsystem::CreateSSMLToSoundWaveTask(UObject* WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisSSML)
{
return USSMLToSoundWaveAsync::SSMLToSoundWave_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisSSML);
}

UAzSpeechTaskBase* UAzSpeechEngineSubsystem::CreateSSMLToSpeechTask(UObject* WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisSSML)
{
return USSMLToSpeechAsync::SSMLToSpeech_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisSSML);
}

UAzSpeechTaskBase* UAzSpeechEngineSubsystem::CreateSSMLToWavFileTask(UObject* WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisSSML, const FString& FilePath, const FString& FileName)
{
return USSMLToWavFileAsync::SSMLToWavFile_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisSSML, FilePath, FileName);
}

UAzSpeechTaskBase* UAzSpeechEngineSubsystem::CreateTextToAudioDataTask(UObject* WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisText)
{
return UTextToAudioDataAsync::TextToAudioData_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisText);
}

UAzSpeechTaskBase* UAzSpeechEngineSubsystem::CreateTextToSoundWaveTask(UObject* WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisText)
{
return UTextToSoundWaveAsync::TextToSoundWave_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisText);
}

UAzSpeechTaskBase* UAzSpeechEngineSubsystem::CreateTextToSpeechTask(UObject* WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisText)
{
return UTextToSpeechAsync::TextToSpeech_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisText);
}

UAzSpeechTaskBase* UAzSpeechEngineSubsystem::CreateTextToWavFileTask(UObject* WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisText, const FString& FilePath, const FString& FileName)
{
return UTextToWavFileAsync::TextToWavFile_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisText, FilePath, FileName);
}

UAzSpeechTaskBase* UAzSpeechEngineSubsystem::CreateWavFileToTextTask(UObject* WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechRecognitionOptions RecognitionOptions, const FString& FilePath, const FString& FileName, const FName PhraseListGroup)
{
return UWavFileToTextAsync::WavFileToText_CustomOptions(WorldContextObject, SubscriptionOptions, RecognitionOptions, FilePath, FileName, PhraseListGroup);
}

void UAzSpeechEngineSubsystem::RegisterAzSpeechTask(UAzSpeechTaskBase* const Task) const
{
if (UAzSpeechTaskStatus::IsTaskStillValid(Task) && !RegisteredTasks.Contains(Task))
Expand Down
74 changes: 69 additions & 5 deletions Source/AzSpeech/Private/AzSpeech/AzSpeechHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@

#include "AzSpeech/AzSpeechHelper.h"
#include "AzSpeechInternalFuncs.h"
#include "AzSpeech/Tasks/Bases/AzSpeechRecognizerTaskBase.h"
#include "AzSpeech/Tasks/Bases/AzSpeechSynthesizerTaskBase.h"
#include "AzSpeech/Tasks/Recognition/KeywordRecognitionAsync.h"
#include "AzSpeech/Tasks/Recognition/SpeechToTextAsync.h"
#include "AzSpeech/Tasks/Recognition/WavFileToTextAsync.h"
#include "AzSpeech/Tasks/Synthesis/SSMLToAudioDataAsync.h"
#include "AzSpeech/Tasks/Synthesis/SSMLToSoundWaveAsync.h"
#include "AzSpeech/Tasks/Synthesis/SSMLToSpeechAsync.h"
#include "AzSpeech/Tasks/Synthesis/SSMLToWavFileAsync.h"
#include "AzSpeech/Tasks/Synthesis/TextToAudioDataAsync.h"
#include "AzSpeech/Tasks/Synthesis/TextToSoundWaveAsync.h"
#include "AzSpeech/Tasks/Synthesis/TextToSpeechAsync.h"
#include "AzSpeech/Tasks/Synthesis/TextToWavFileAsync.h"
#include <Audio.h>
#include <Sound/SoundWave.h>
#include <Misc/FileHelper.h>
Expand Down Expand Up @@ -562,22 +571,77 @@ const TArray<FAzSpeechAnimationData> UAzSpeechHelper::ExtractAnimationDataFromVi
return Output;
}

UAzSpeechTaskBase* UAzSpeechHelper::CastToAzSpeechTaskBase(UObject* Object)
UAzSpeechTaskBase* UAzSpeechHelper::CastToAzSpeechTaskBase(UObject* const Object)
{
return Cast<UAzSpeechTaskBase>(Object);
}

UAzSpeechRecognizerTaskBase* UAzSpeechHelper::CastToAzSpeechRecognizerTaskBase(UObject* Object)
UAzSpeechRecognizerTaskBase* UAzSpeechHelper::CastToAzSpeechRecognizerTaskBase(UObject* const Object)
{
return Cast<UAzSpeechRecognizerTaskBase>(Object);
}

UAzSpeechSynthesizerTaskBase* UAzSpeechHelper::CastToAzSpeechSynthesizerTaskBase(UObject* Object)
UAzSpeechSynthesizerTaskBase* UAzSpeechHelper::CastToAzSpeechSynthesizerTaskBase(UObject* const Object)
{
return Cast<UAzSpeechSynthesizerTaskBase>(Object);
}

const FString UAzSpeechHelper::GetAzSpeechLogsBaseDir()
{
return FPaths::Combine(*FPaths::ProjectLogDir(), TEXT("AzSpeech"));
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateKeywordRecognitionTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechRecognitionOptions RecognitionOptions, const FString& AudioInputDeviceID, const FName PhraseListGroup)
{
return UKeywordRecognitionAsync::KeywordRecognition_CustomOptions(WorldContextObject, SubscriptionOptions, RecognitionOptions, AudioInputDeviceID, PhraseListGroup);
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateSpeechToTextTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechRecognitionOptions RecognitionOptions, const FString& AudioInputDeviceID, const FName PhraseListGroup)
{
return USpeechToTextAsync::SpeechToText_CustomOptions(WorldContextObject, SubscriptionOptions, RecognitionOptions, AudioInputDeviceID, PhraseListGroup);
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateSSMLToAudioDataTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisSSML)
{
return USSMLToAudioDataAsync::SSMLToAudioData_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisSSML);
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateSSMLToSoundWaveTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisSSML)
{
return USSMLToSoundWaveAsync::SSMLToSoundWave_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisSSML);
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateSSMLToSpeechTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisSSML)
{
return USSMLToSpeechAsync::SSMLToSpeech_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisSSML);
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateSSMLToWavFileTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisSSML, const FString& FilePath, const FString& FileName)
{
return USSMLToWavFileAsync::SSMLToWavFile_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisSSML, FilePath, FileName);
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateTextToAudioDataTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisText)
{
return UTextToAudioDataAsync::TextToAudioData_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisText);
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateTextToSoundWaveTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisText)
{
return UTextToSoundWaveAsync::TextToSoundWave_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisText);
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateTextToSpeechTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisText)
{
return UTextToSpeechAsync::TextToSpeech_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisText);
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateTextToWavFileTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechSynthesisOptions SynthesisOptions, const FString& SynthesisText, const FString& FilePath, const FString& FileName)
{
return UTextToWavFileAsync::TextToWavFile_CustomOptions(WorldContextObject, SubscriptionOptions, SynthesisOptions, SynthesisText, FilePath, FileName);
}

UAzSpeechTaskBase* UAzSpeechHelper::CreateWavFileToTextTask(UObject* const WorldContextObject, const FAzSpeechSubscriptionOptions SubscriptionOptions, const FAzSpeechRecognitionOptions RecognitionOptions, const FString& FilePath, const FString& FileName, const FName PhraseListGroup)
{
return UWavFileToTextAsync::WavFileToText_CustomOptions(WorldContextObject, SubscriptionOptions, RecognitionOptions, FilePath, FileName, PhraseListGroup);
}
13 changes: 12 additions & 1 deletion Source/AzSpeech/Private/AzSpeech/AzSpeechSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "AzSpeech/AzSpeechSettings.h"
#include "AzSpeechInternalFuncs.h"
#include "LogAzSpeech.h"
#include <Runtime/Launch/Resources/Version.h>

#if WITH_EDITOR
Expand All @@ -14,7 +15,17 @@
#include UE_INLINE_GENERATED_CPP_BY_NAME(AzSpeechSettings)
#endif

UAzSpeechSettings::UAzSpeechSettings(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer), TaskInitTimeOut(15.f), TasksThreadPriority(EAzSpeechThreadPriority::Normal), ThreadUpdateInterval(0.016667f), bFilterVisemeFacialExpression(true), bEnableSDKLogs(true), bEnableInternalLogs(false), bEnableDebuggingLogs(false), bEnableDebuggingPrints(false), StringDelimiters(" ,.;:[]{}!'\"?")
UAzSpeechSettings::UAzSpeechSettings(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
, TaskInitTimeOut(15.f)
, TasksThreadPriority(EAzSpeechThreadPriority::Normal)
, ThreadUpdateInterval(0.016667f)
, bFilterVisemeFacialExpression(true)
, bEnableSDKLogs(true)
, bEnableInternalLogs(false)
, bEnableDebuggingLogs(false)
, bEnableDebuggingPrints(false)
, StringDelimiters(TEXT(R"( ,.;:[]{}!'"?)"))
{
CategoryName = TEXT("Plugins");

Expand Down
Loading

0 comments on commit 51caa04

Please sign in to comment.