diff --git a/Source/VAPlugin/Private/VADirectivity.cpp b/Source/VAPlugin/Private/VADirectivity.cpp index 37e780500801b480e978e52bfb9f01d41eb79247..d3e3cd607793b0fba7a7256ed80f47ca2776a55e 100644 --- a/Source/VAPlugin/Private/VADirectivity.cpp +++ b/Source/VAPlugin/Private/VADirectivity.cpp @@ -30,6 +30,9 @@ VADirectivity::VADirectivity(FString fileName, TArray<FString> phonemes_) UE_LOG(LogTemp, Warning, TEXT(" Directivity file %s cannot be found!"), *fileName); return; } + + VAUtils::logStuff("created new VADirectivity"); + } diff --git a/Source/VAPlugin/Private/VADirectivityManager.cpp b/Source/VAPlugin/Private/VADirectivityManager.cpp index ed91e8be08f5d63fc2e60f0c8361806702d23e73..2665aed584935b5c8f25597ca37d2ca362fc4914 100644 --- a/Source/VAPlugin/Private/VADirectivityManager.cpp +++ b/Source/VAPlugin/Private/VADirectivityManager.cpp @@ -1,4 +1,7 @@ #include "VADirectivityManager.h" + +#include "VAUtils.h" + #include "Core.h" #include "Interfaces/IPluginManager.h" @@ -22,8 +25,12 @@ void VADirectivityManager::readConfigFile(FString configFileName_) { configFileName = configFileName_; // Read config File - FString BaseDir = IPluginManager::Get().FindPlugin("VAPlugin")->GetBaseDir(); - FString dir = FPaths::Combine(*BaseDir, TEXT("config/directivities/")); + // FString BaseDir = IPluginManager::Get().FindPlugin("VAPlugin")->GetBaseDir(); + // FString dir = FPaths::Combine(*BaseDir, TEXT("config/directivities/")); + + FString RelativePath = FPaths::ProjectContentDir(); + FString dir = IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*RelativePath) + "Study/"; + FString config_file_name = dir + configFileName; GConfig->UnloadFile(config_file_name); @@ -32,9 +39,11 @@ void VADirectivityManager::readConfigFile(FString configFileName_) { FConfigFile* config = GConfig->FindConfigFile(config_file_name); if (config == nullptr) { - VAUtils::logStuff(FString("[VADirectivityManager::readConfigFile()] - Unable to load directivity config file") + config_file_name); + VAUtils::logStuff(FString("[VADirectivityManager::readConfigFile()] - Unable to load directivity config file: ") + config_file_name); return; } + VAUtils::logStuff(FString("[VADirectivityManager::readConfigFile()] - Config file loaded: ") + config_file_name); + FString listSymbol, mapToSymbol; config->GetString(TEXT("DirectivityMapping"), TEXT("listSymbol"), listSymbol); @@ -83,6 +92,13 @@ void VADirectivityManager::readConfigFile(FString configFileName_) { // continue; // } + FString output = "Mapping from: "; + for (auto p : tmp_phonemes) { + output.Append(p + ","); + } + output.Append(" --> " + tmp_fileName); + VAUtils::logStuff(output); + VADirectivity* tmpDir = new VADirectivity(tmp_fileName, tmp_phonemes); directivities.Add(tmpDir); diff --git a/Source/VAPlugin/Private/VAPlugin.cpp b/Source/VAPlugin/Private/VAPlugin.cpp index e3a568ed70d9e1c02d4d5b3cca0c441ba0b2fe2c..97f44859bab28018167aa77e71828907f4fc29cd 100644 --- a/Source/VAPlugin/Private/VAPlugin.cpp +++ b/Source/VAPlugin/Private/VAPlugin.cpp @@ -174,11 +174,11 @@ void FVAPluginModule::askForSettings(FString host, int port, bool askForDebugMod isMaster = IDisplayCluster::Get().GetClusterMgr() != nullptr && IDisplayCluster::Get().GetClusterMgr()->IsMaster(); EAppReturnType::Type ret = FMessageDialog::Open(EAppMsgType::YesNo, FText::FromString("Use VA Server (" + host + ":" + FString::FromInt(port) + ")? If yes, make sure to have it switched on.")); - if (ret == EAppReturnType::Type::No) { - useVA = false; + if (ret == EAppReturnType::Type::Yes) { + useVA = true; } else { - useVA = true; + useVA = false; debugMode = false; initialized = true; return; diff --git a/Source/VAPlugin/Private/VAReceiverActor.cpp b/Source/VAPlugin/Private/VAReceiverActor.cpp index cfb9d069358cef644999b2834efcee885673c262..a648906faa1b1db7dbd5acbce423d12c65d70d4c 100644 --- a/Source/VAPlugin/Private/VAReceiverActor.cpp +++ b/Source/VAPlugin/Private/VAReceiverActor.cpp @@ -168,9 +168,14 @@ void AVAReceiverActor::Tick(float DeltaTime) timeSinceUpdate = 0.0f; } - if (totalTime > 8.0f) { - runOnAllNodes("debugMode = false"); - timeSinceUpdate = -100000.0f; + if (totalTime > 2.0f) { + if (FVAPluginModule::getDebugMode()) { + runOnAllNodes("debugMode = false"); + } + else { + runOnAllNodes("debugMode = true"); + } + totalTime = 0.0f; } } @@ -183,20 +188,18 @@ bool AVAReceiverActor::updateVirtualWorldPosition() { controller->GetPlayerViewPoint(tmpPosF, tmpRotF); - FString text = "Position of Receiver (id: " + FString::FromInt(receiverID) + ") is: "; - text.Append(FString::FromInt(tmpPosF.X)).Append("/").Append(FString::FromInt(tmpPosF.Y)).Append("/").Append(FString::FromInt(tmpPosF.Z)); - VAUtils::logStuff(text); - - text = "Rotation of Receiver (id: " + FString::FromInt(receiverID) + ") is: "; - text.Append(FString::FromInt(tmpRotF.Roll)).Append("/").Append(FString::FromInt(tmpRotF.Pitch)).Append("/").Append(FString::FromInt(tmpRotF.Yaw)); - - VAUtils::logStuff(text); + // FString text = "Position of Receiver (id: " + FString::FromInt(receiverID) + ") is: "; + // text.Append(FString::FromInt(tmpPosF.X)).Append("/").Append(FString::FromInt(tmpPosF.Y)).Append("/").Append(FString::FromInt(tmpPosF.Z)); + // VAUtils::logStuff(text); + // + // text = "Rotation of Receiver (id: " + FString::FromInt(receiverID) + ") is: "; + // text.Append(FString::FromInt(tmpRotF.Roll)).Append("/").Append(FString::FromInt(tmpRotF.Pitch)).Append("/").Append(FString::FromInt(tmpRotF.Yaw)); + // + // VAUtils::logStuff(text); FVAPluginModule::setSoundReceiverPosition(receiverID, tmpPosF); FVAPluginModule::setSoundReceiverRotation(receiverID, tmpRotF); - // FVAPluginModule::updateReceiverPos(tmpPosF, tmpRotF); - return false; } @@ -395,6 +398,8 @@ void AVAReceiverActor::HandleClusterEvent(const FDisplayClusterClusterEvent & Ev void AVAReceiverActor::handleClusterCommand(FString command) { + VAUtils::logStuff("Cluster Command " + command + " received"); + if (command == "useVA = false") { FVAPluginModule::setUseVA(false); } diff --git a/Source/VAPlugin/Private/VASoundSourceRepresentation.cpp b/Source/VAPlugin/Private/VASoundSourceRepresentation.cpp index 7324578dc846bc20eda5acb8a0300533e85cd63a..641f05d3c7ac4d937c6dac061156fa901f03ed22 100644 --- a/Source/VAPlugin/Private/VASoundSourceRepresentation.cpp +++ b/Source/VAPlugin/Private/VASoundSourceRepresentation.cpp @@ -14,33 +14,6 @@ AVASoundSourceRepresentation::AVASoundSourceRepresentation() // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true; - // reflection Sphere - // sphereComp2 = CreateDefaultSubobject<USphereComponent>(FName("ShapeComponent")); - // sphereComp2->bHiddenInGame = false; - // sphereComp2->Mobility = EComponentMobility::Movable; - // RootComponent = sphereComp2; - // - // sphereMesh2 = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation")); - // sphereMesh2->AttachTo(RootComponent); - // - // // static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereMeshAsset(TEXT("/VAPlugin/Shape_Cone.Shape_Cone")); - // - // static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereMeshAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cone.Shape_Cone")); - // - // // FString BaseDir = IPluginManager::Get().FindPlugin("VAPlugin")->GetBaseDir(); - // // FString pathFile = FPaths::Combine(*BaseDir, TEXT("Content/Shape_Cone.Shape_Cone")); - // // BaseDir.Append("/Content/Shape_Cone.Shape_Cone"); - // // static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereMeshAsset(*BaseDir); - // - // if (SphereMeshAsset.Succeeded()) { - // sphereMesh2->SetStaticMesh(SphereMeshAsset.Object); - // sphereMesh2->SetRelativeLocation(FVector(80.0f, 0.0f, 0.0f)); - // sphereMesh2->SetRelativeRotation(FRotator(90.0f, 0.0f, 0.0f)); - // sphereMesh2->SetWorldScale3D(FVector(0.8f)); - // } - // - // setVisibility(FVAPluginModule::isInDebugMode()); - sphereComp = CreateDefaultSubobject<USphereComponent>(FName("SphereComp")); sphereComp->bHiddenInGame = true; sphereComp->Mobility = EComponentMobility::Movable; diff --git a/Source/VAPlugin/Private/VAUtils.cpp b/Source/VAPlugin/Private/VAUtils.cpp index f748dd526cb4d894e6f15478dd519d6a4e6b2e38..9db5d872caac1882c8daa955cd81fd25b4cc289c 100644 --- a/Source/VAPlugin/Private/VAUtils.cpp +++ b/Source/VAPlugin/Private/VAUtils.cpp @@ -230,61 +230,4 @@ int VAUtils::EPlayActionToVAAction(EPlayAction action) } -/* -bool VAUtils::getViewingPos(FVector* vec, FQuat* quat) -{ - if (vec == NULL || quat == NULL) - return false; - - FRotator* rot = new FRotator(); - - //UHeadMountedDisplayFunctionLibrary::GetOrientationAndPosition(*rot, *vec); - *quat = rot->Quaternion(); - delete rot; - - return true; -} - -bool VAUtils::getViewingPos(VAVec3* vec, VAQuat* quat) -{ - if (vec == NULL || quat == NULL) - return false; - - FVector* vecF = new FVector(); - FQuat* quatF = new FQuat(); - FRotator* rot = new FRotator(); - - if(FVAPluginModule::isViewModeHMD()) - { - //UHeadMountedDisplayFunctionLibrary::GetOrientationAndPosition(*rot, *vecF); - } - - *quatF = rot->Quaternion(); - - fQuatToVAQuat(quatF, quat); - fVecToVAVec3(vecF, vec); - - delete vecF, quatF, rot; - return true; -} - -bool VAUtils::getViewingPosVA(VAVec3* vec, VAQuat* quat) -{ - if (vec == NULL || quat == NULL) - return false; - - FVector* vecF = new FVector(); - FQuat* quatF = new FQuat(); - FRotator* rot = new FRotator(); - - //UHeadMountedDisplayFunctionLibrary::GetOrientationAndPosition(*rot, *vecF); - *quatF = rot->Quaternion(); - - fQuatToVAQuatRot(quatF, quat); - fVecToVAVec3Rot(vecF, vec); - - delete vecF, quatF, rot; - return true; -} -*/ diff --git a/Source/VAPlugin/Public/VAReceiverActor.h b/Source/VAPlugin/Public/VAReceiverActor.h index 0e77ff09d78fe9f536d42a2e6592e69c16e075ff..0b1efc643695f5eb1c8a6344d2d2f7d744821aee 100644 --- a/Source/VAPlugin/Public/VAReceiverActor.h +++ b/Source/VAPlugin/Public/VAReceiverActor.h @@ -5,8 +5,8 @@ #include "VAPlugin.h" #include "VADirectivityManager.h" - -#include "Cluster/IDisplayClusterClusterManager.h" // For Events + +#include "Cluster/IDisplayClusterClusterManager.h" // For Events #include "Cluster/DisplayClusterClusterEvent.h" // For Events #include "CoreMinimal.h" // For Events @@ -80,7 +80,7 @@ public: // Factor for global output Gain UPROPERTY(EditAnywhere, meta = (DisplayName = "Name of ini file for directivities", Category = "Directivity Manager")) - FString dirName = "default.ini"; + FString dirName = "VADir_default.ini"; @@ -156,12 +156,12 @@ protected: // Event Listener Delegate - FOnClusterEventListener ClusterEventListenerDelegate; - - // Called on cluster Event emission - void HandleClusterEvent(const FDisplayClusterClusterEvent& Event); - - // "Compiler" + FOnClusterEventListener ClusterEventListenerDelegate; + + // Called on cluster Event emission + void HandleClusterEvent(const FDisplayClusterClusterEvent& Event); + + // "Compiler" void handleClusterCommand(FString command); diff --git a/config/directivities/default.ini b/config/directivities/default.ini deleted file mode 100644 index 7d98601e826a14b0b3e8c24a95ac9eeb193c5783..0000000000000000000000000000000000000000 --- a/config/directivities/default.ini +++ /dev/null @@ -1,24 +0,0 @@ -[DirectivityMapping] - -# Symbol the list is devided (default: ",") -listSymbol=, - -# Symbol the mapping is done (default ":") -mapToSymbol=: - -# Mapping in form: -# mapping=phoneme1,phoeneme2,phoneme3:file1 -# mapping=default,phoneme4:file2 -mapping=a,b,c:$(HumanDir) - - - -# old data, please ignore: -dirFolder= -default=defaultDir -dividingSymbol=, -pair=a,ab -pair=b,bb -pair=c,cb - -