Skip to content
Snippets Groups Projects
Commit c745aa3c authored by Marius Schmeling's avatar Marius Schmeling
Browse files

Directivities compiler, Walls are now represented as planes again, Shut down...

Directivities compiler, Walls are now represented as planes again, Shut down RL pos output, Changed the optical representation of reflected cones and its functionality (but has none functioning yet)
parent eb307978
No related branches found
No related tags found
1 merge request!4Release
Notes from VAPlugin:
/*
// Get the base directory of this plugin
FString BaseDir = IPluginManager::Get().FindPlugin("VAPlugin")->GetBaseDir();
// Add on the relative location of the third party dll and load it
FString LibraryPath;
#if PLATFORM_WINDOWS
LibraryPath = FPaths::Combine(*BaseDir, TEXT("Binaries/ThirdParty/VAPluginLibrary/Win64/ExampleLibrary.dll"));
#elif PLATFORM_MAC
LibraryPath = FPaths::Combine(*BaseDir, TEXT("Source/ThirdParty/VAPluginLibrary/Mac/Release/libExampleLibrary.dylib"));
#endif // PLATFORM_WINDOWS
ExampleLibraryHandle = !LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath) : nullptr;
if (ExampleLibraryHandle)
{
// Call the test function in the third party library that opens a message box
ExampleLibraryFunction();
}
else
{
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("ThirdPartyLibraryError", "Failed to load example third party library"));
}
*/
/*
moduleManager = &FModuleManager::Get();
EModuleLoadResult failureReason;
moduleInterface = moduleManager->LoadModuleWithFailureReason("VALibrary", failureReason);
if (failureReason == EModuleLoadResult::Success) {
UE_LOG(LogTemp, Warning, TEXT("Loaded VALibrary"));
}
else {
UE_LOG(LogTemp, Warning, TEXT("Failed loading VALibrary"));
}
*/
/*
libDir zu konfi
if (!LoadDependency(LibDir, TEXT("libvlc"), LibHandle)) {
return false;
}
*/
####################
In Shutdown:
/*
// Free the dll handle
FPlatformProcess::FreeDllHandle(ExampleLibraryHandle);
ExampleLibraryHandle = nullptr;
*/
\ No newline at end of file
Reading Directivities correctly
Make Wall to plane
Ausgabe RL Pos
Spawn Cones in Source Component
TODO: Set Input for Debug Mode
\ No newline at end of file
......@@ -40,6 +40,7 @@ int FVAPluginModule::defaultDirID;
TArray<AVAReflectionWall*> FVAPluginModule::reflectionWalls;
bool FVAPluginModule::useVA;
bool FVAPluginModule::debugMode = true; // TODO: Change here
void* FVAPluginModule::LibraryHandleNet;
......@@ -59,6 +60,7 @@ VAQuat* FVAPluginModule::tmpQuat = new VAQuat();
VAVec3* FVAPluginModule::tmpVec = new VAVec3();
TArray<FString> FVAPluginModule::listOfPhonemes;
TArray<FString> FVAPluginModule::listOfPairs;
TArray<FString> FVAPluginModule::listOfDirectivities;
TMap<FString, FString> FVAPluginModule::dirMapping;
TMap<FString, int> FVAPluginModule::dirMappingToInt;
......@@ -100,7 +102,7 @@ void FVAPluginModule::StartupModule()
// ++ Check Handles ++ //
if (!checkLibraryHandles(true))
{
VAUtils::openMessageBoxV("stop initialzing because of incomplete libraryHandles", true);
VAUtils::openMessageBox("stop initialzing because of incomplete libraryHandles");
return;
}
......@@ -156,7 +158,7 @@ bool FVAPluginModule::connectServer(FString hostF, int port)
return true;
}
VAUtils::openMessageBox("Connecting to VAServer. Be sure to have it switched on");
VAUtils::logStuff("Connecting to VAServer. Be sure to have it switched on");
try {
pVANet = IVANetClient::Create();
......@@ -200,7 +202,16 @@ bool FVAPluginModule::initializeServer(FString host, int port)
return false;
}
EAppReturnType::Type ret = FMessageDialog::Open(EAppMsgType::YesNo, FText::FromString("Use VA Server?"));
EAppReturnType::Type ret = FMessageDialog::Open(EAppMsgType::YesNo, FText::FromString("Use VA Server? If yes, make sure to have it switched on."));
EAppReturnType::Type retD = FMessageDialog::Open(EAppMsgType::YesNo, FText::FromString("Start in Debug mode?"));
if (ret == EAppReturnType::Type::Yes) {
debugMode = true;
}
else {
debugMode = false;
}
if (ret == EAppReturnType::Type::No) {
useVA = false;
return false;
......@@ -210,6 +221,7 @@ bool FVAPluginModule::initializeServer(FString host, int port)
useVA = false;
return false;
}
return true;
}
......@@ -313,7 +325,7 @@ void FVAPluginModule::playTestSound(bool loop)
}
*/
int FVAPluginModule::initializeSoundWithReflections(FString soundNameF, FVector soundPos, FRotator soundRot, float gainFactor, bool loop, float soundOffset, int action)
int FVAPluginModule::initializeSoundWithReflections(FString soundNameF, FVector soundPos, FRotator soundRot, float gainFactor, bool loop, float soundOffset, int action, UVASourceComponent* sourceComp)
{
// first initialize real sound
......@@ -344,7 +356,10 @@ int FVAPluginModule::initializeSoundWithReflections(FString soundNameF, FVector
matchingReflectionWalls.Add(id, wall);
reflectionArrayIDs.Add(id);
wall->spawnSphere(pos_new, rot_new); // TODO: delete
if(sourceComp != nullptr && isInDebugMode()){
sourceComp->createReflectedSourceRepresentation(wall, pos_new, rot_new);
}
// wall->spawnSphere(pos_new, rot_new); // TODO: delete
FString text = "orig pos: ";
text.Append(FString::FromInt(soundPos.X)).Append("/").Append(FString::FromInt(soundPos.Y)).Append("/").Append(FString::FromInt(soundPos.Z));
......@@ -366,7 +381,7 @@ int FVAPluginModule::initializeSoundWithReflections(FString soundNameF, FVector
return iSoundSourceID;
}
int FVAPluginModule::initializeSound(FString soundNameF, FVector soundPos, FRotator soundRot, float gainFactor, bool loop, float soundOffset, int action)
int FVAPluginModule::initializeSound(FString soundNameF, FVector soundPos, FRotator soundRot, float gainFactor, bool loop, float soundOffset, int action, UVASourceComponent* sourceComp)
{
soundPos = VAUtils::toVACoordinateSystem(soundPos);
soundRot = VAUtils::toVACoordinateSystem(soundRot);
......@@ -433,7 +448,7 @@ bool FVAPluginModule::processSoundQueue()
if (uninitializedSoundComponents.Num() != 0)
{
VAUtils::openMessageBox("Sound Queue is not empty!");
VAUtils::logStuff("processSoundQueue(): Sound Queue is not empty!");
}
for (auto iter = uninitializedSoundComponents.CreateIterator(); iter; iter++)
......@@ -868,38 +883,38 @@ bool FVAPluginModule::checkLibraryHandles(bool einzeln)
if (einzeln == true)
{
if (LibraryHandleNet) {
VAUtils::openMessageBoxV("loaded Net");
VAUtils::logStuff("loaded Net");
}
else {
VAUtils::openMessageBox("could not load Net", true);
VAUtils::logStuff("could not load Net");
}
if (LibraryHandleBase) {
VAUtils::openMessageBoxV("loaded Base");
VAUtils::logStuff("loaded Base");
}
else {
VAUtils::openMessageBox("could not load Base", true);
VAUtils::logStuff("could not load Base");
}
if (LibraryHandleVistaAspects) {
VAUtils::openMessageBoxV("loaded Vista Aspects");
VAUtils::logStuff("loaded Vista Aspects");
}
else {
VAUtils::openMessageBox("could not load Vista Aspects", true);
VAUtils::logStuff("could not load Vista Aspects");
}
if (LibraryHandleVistaBase) {
VAUtils::openMessageBoxV("loaded Vista Base");
VAUtils::logStuff("loaded Vista Base");
}
else {
VAUtils::openMessageBox("could not load Vista Base", true);
VAUtils::logStuff("could not load Vista Base");
}
if (LibraryHandleVistaInterProcComm) {
VAUtils::openMessageBoxV("loaded Vista InterProcComm");
VAUtils::logStuff("loaded Vista InterProcComm");
}
else {
VAUtils::openMessageBox("could not load Vista InterProcComm", true);
VAUtils::logStuff("could not load Vista InterProcComm");
}
}
......@@ -907,11 +922,11 @@ bool FVAPluginModule::checkLibraryHandles(bool einzeln)
LibraryHandleVistaAspects && LibraryHandleVistaBase && LibraryHandleVistaInterProcComm)
{
// all fine
VAUtils::openMessageBoxV("all fine");
VAUtils::logStuff("all fine");
return true;
}
else {
VAUtils::openMessageBox("could not load all dll", true);
VAUtils::logStuff("could not load all dll");
return false;
}
......@@ -995,26 +1010,47 @@ bool FVAPluginModule::readDirFile(FString dirName)
}
listOfPhonemes.Empty();
listOfPairs.Empty();
dirMapping.Empty();
listOfDirectivities.Empty();
FString divideSymbol;
config->GetArray(TEXT("DirectivityMapping"), TEXT("ListOfPhonemesArray"), listOfPhonemes);
//config->GetArray(TEXT("DirectivityMapping"), TEXT("ListOfPhonemesArray"), listOfPhonemes);
config->GetArray(TEXT("DirectivityMapping"), TEXT("pair"), listOfPairs);
config->GetString(TEXT("DirectivityMapping"), TEXT("dividingSymbol"), divideSymbol);
// FString listOfdir;
// config->GetString(TEXT("DirectivityMapping"), TEXT("ListOfPhonemesString"), listOfDir);
VAUtils::logStuff("The following inputs for dirs were registered: ");
FString tmpS;
FString tmpS, tmpP, tmp; // tmpS = Name of directivity, tmpP = Name of input Phenome "name"
int tmpPos;
FString test = "Hallo";
for (auto entry : listOfPhonemes) {
config->GetString(TEXT("DirectivityMapping"), *entry, tmpS);
for (auto entry : listOfPairs) {
//for (auto entry : listOfPhonemes) {
// When using a=ad
// b = bd
// config->GetString(TEXT("DirectivityMapping"), *entry, tmpS);
// When using Mapping=a,ad
// Mapping = b,bd
tmpPos = entry.Find(divideSymbol);
if (!entry.Contains(divideSymbol)) {
UE_LOG(LogTemp, Warning, TEXT(" Directivity %s has a wrong format!"), *entry);
continue;
}
tmp = *entry;
tmp.Split(divideSymbol, &tmpP, &tmpS);
if (tmpS.IsEmpty()) {
UE_LOG(LogTemp, Warning, TEXT(" Directivity for %s is empty!"), *entry);
if (tmpS.IsEmpty() || tmpP.IsEmpty()) {
UE_LOG(LogTemp, Warning, TEXT(" Directivity %s has a wrong format!"), *entry);
continue;
}
// dirMapping.Add(entry, tmpS);
// UE_LOG(LogTemp, Warning, TEXT(" %s --> %s"), *entry, *tmpS);
dirMapping.Add(entry, tmpS);
UE_LOG(LogTemp, Warning, TEXT(" %s --> %s"), *entry, *tmpS);
dirMapping.Add(tmpP, tmpS);
UE_LOG(LogTemp, Warning, TEXT(" %s --> %s"), *tmpP, *tmpS);
......@@ -1023,16 +1059,39 @@ bool FVAPluginModule::readDirFile(FString dirName)
listOfDirectivities.Add(tmpS);
}
}
VAUtils::logStuff("------------------");
// Do default!
config->GetString(TEXT("DirectivityMapping"), TEXT("default"), tmpS);
dirMapping.Add("default", tmpS);
UE_LOG(LogTemp, Warning, TEXT(" default --> %s"), *tmpS);
VAUtils::logStuff("------------------");
VAUtils::logStuff("Finished reading Dir File");
FString folder;
config->GetString(TEXT("DirectivityMapping"), TEXT("dirFolder"), folder);
// First do default
std::string dirD(TCHAR_TO_UTF8(*(folder + tmpS)));
try {
iHRIR = pVA->CreateDirectivityFromFile(dirD);
dirMappingToInt.Add(tmpS, iHRIR);
}
catch (CVAException& e) {
// VAUtils::openMessageBox("Hallo");
// processExeption("readDirFile", FString(*e.ToString().c_str()));
// VAUtils::logStuff(FString("Could not read Directivity from phenmoes config: " + *e.ToString().c_str()));
if (&e == nullptr)
{
}
}
// ************ //
int iHRIR;
FString tmp;
for (auto entry : listOfDirectivities) {
// tmp = folder;
// tmp.Append(entry);
......@@ -1050,9 +1109,10 @@ bool FVAPluginModule::readDirFile(FString dirName)
}
continue;
}
}
// Do default
return true;
}
......@@ -1111,6 +1171,11 @@ bool FVAPluginModule::resetAll()
return false;
}
bool FVAPluginModule::isInDebugMode()
{
return debugMode;
}
/*
void FVAPluginModule::openMessageBox(char* text, bool error)
......
......@@ -197,7 +197,7 @@ bool AVAReceiverActor::updateRealWorldPosition()
FRotator rot = shutterRot - originRot;
// log positions
VAUtils::logStuff(FString("RL pos: " + pos.ToString() + "RL rot: " + rot.ToString()));
// VAUtils::logStuff(FString("RL pos: " + pos.ToString() + "RL rot: " + rot.ToString()));
return FVAPluginModule::updateReceiverRealWorldPos(pos, rot);
......@@ -270,7 +270,7 @@ FString AVAReceiverActor::getIPAdress()
return "10.0.1.240";
}
VAUtils::openMessageBox("could not evaluate IP Adress. Returning localhost (AVAReceiverActor::getIPAdress())", true);
VAUtils::logStuff("could not evaluate IP Adress. Returning localhost (AVAReceiverActor::getIPAdress())");
return "localhost";
}
......
......@@ -2,6 +2,7 @@
#include "VAReflectionWall.h"
#include "VAUtils.h"
#include "VAPlugin.h"
#include "EngineUtils.h"
#include "Engine/StaticMeshActor.h"
#include "Components/BoxComponent.h"
......@@ -22,22 +23,32 @@ AVAReflectionWall::AVAReflectionWall()
planeComp = CreateDefaultSubobject<UBoxComponent>(TEXT("PlaneComp"));
planeComp->InitBoxExtent(FVector(1, 100, 100));
planeComp->SetVisibility(true);
planeComp->SetRelativeLocation(FVector(0, 0, 0));
// planeComp = CreateDefaultSubobject<UBoxComponent>(TEXT("PlaneComp"));q
// planeComp->InitBoxExtent(FVector(100, 100, 100));
// planeComp->SetVisibility(true);
// planeComp->SetRelativeLocation(FVector(0, 0, 0));
//
//
// // reflection Sphere
// sphereComp = CreateDefaultSubobject<USphereComponent>(FName("SphereComp"));
// sphereComp->bHiddenInGame = !FVAPluginModule::isInDebugMode();
// sphereComp->Mobility = EComponentMobility::Movable;
// sphereComp->SetRelativeScale3D(FVector(1, 1, 1));
// RootComponent = sphereComp;
//
// SphereMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
// SphereMesh->AttachTo(RootComponent);
// static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereMeshAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
// if (SphereMeshAsset.Succeeded()) {
// SphereMesh->SetStaticMesh(SphereMeshAsset.Object);
// SphereMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
// SphereMesh->SetWorldScale3D(FVector(0.8f));
// SphereMesh->SetVisibility(FVAPluginModule::isInDebugMode());
// }
// reflection Sphere
sphereComp = CreateDefaultSubobject<USphereComponent>(FName("SphereComp"));
sphereComp->bHiddenInGame = true;
sphereComp->Mobility = EComponentMobility::Movable;
RootComponent = sphereComp;
SphereMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
SphereMesh->AttachTo(RootComponent);
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereMeshAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
if (SphereMeshAsset.Succeeded()) {
SphereMesh->SetStaticMesh(SphereMeshAsset.Object);
SphereMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
SphereMesh->SetWorldScale3D(FVector(0.8f));
}
}
......@@ -83,27 +94,28 @@ void AVAReflectionWall::computePlaneData()
void AVAReflectionWall::spawnSphere(FVector pos, FRotator rot)
{
FVector offset(0, 0, 40);
SphereMesh->SetWorldLocation(pos - offset);
VAUtils::openMessageBox("in spawnSphere of Reflection Wall, thats wrong");
// FVector offset(0, 0, 40);
// SphereMesh->SetWorldLocation(pos - offset);
// SphereMesh->SetVisibility(FVAPluginModule::isInDebugMode());
//SphereMesh->SetRelativeLocation(pos);
//SphereMesh->Set
return;
AStaticMeshActor *Mesh = nullptr;
int counter = 0;
for (TActorIterator<AStaticMeshActor> ActorItr(GetWorld()); ActorItr; ++ActorItr)
{
Mesh = *ActorItr;
if (Mesh->GetName() == "ReflectionSphere") {
Mesh->SetActorLocationAndRotation(pos, rot.Quaternion());
counter++;
}
}
FString text = "Counter: ";
text.Append(FString::FromInt(counter));
VAUtils::openMessageBox(text);
// AStaticMeshActor *Mesh = nullptr;
// int counter = 0;
// for (TActorIterator<AStaticMeshActor> ActorItr(GetWorld()); ActorItr; ++ActorItr)
// {
// Mesh = *ActorItr;
// if (Mesh->GetName() == "ReflectionSphere") {
// Mesh->SetActorLocationAndRotation(pos, rot.Quaternion());
// counter++;
// }
// }
// FString text = "Counter: ";
// text.Append(FString::FromInt(counter));
// VAUtils::logStuff(text);
// SphereMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("SphereMeshz"));
// //this->SphereMesh->AttachTo(GetRootComponent());
......
......@@ -13,6 +13,48 @@ UVASourceComponent::UVASourceComponent()
//
// skeletal_mesh_component = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("SkeletalMeshCmp"));
// skeletal_mesh_component->SetupAttachment(root_component);
sphereComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
sphereComp->bHiddenInGame = true;
sphereComp->Mobility = EComponentMobility::Movable;
sphereComp->SetRelativeScale3D(FVector(1, 1, 1));
static ConstructorHelpers::FObjectFinder<UStaticMesh> ConeMeshAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cone.Shape_Cone"));
TArray<AActor*> wallsA;
UGameplayStatics::GetAllActorsOfClass(this->GetWorld(), AVAReflectionWall::StaticClass(), wallsA);
TArray<AVAReflectionWall*> walls;
for (AActor* actor : wallsA) {
walls.Add((AVAReflectionWall*)actor);
}
for (auto wall : walls)
{
VAUtils::openMessageBox("In walls loop");
class UStaticMeshComponent *coneMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
coneMesh->AttachTo(sphereComp);
if (ConeMeshAsset.Succeeded()) {
VAUtils::openMessageBox("ConeMeshAsset succeded");
coneMesh->SetStaticMesh(ConeMeshAsset.Object);
coneMesh->SetMobility(EComponentMobility::Movable);
coneMesh->SetWorldScale3D(FVector(0.8f));
coneMesh->SetVisibility(true); // FVAPluginModule::isInDebugMode());
coneMesh->SetWorldLocation(FVector(100,100,100));
// coneMesh->SetWorldRotation(rot);
coneMeshMap.Add(wall, coneMesh);
}
}
initialized = true;
for (auto& Elem : conesTodo)
{
createReflectedSourceRepresentation(Elem.Key, Elem.Value.GetLocation(), Elem.Value.GetRotation().Rotator());
}
}
......@@ -29,7 +71,7 @@ void UVASourceComponent::BeginPlay()
bool UVASourceComponent::sendSoundData()
{
if (alreadySent) {
VAUtils::openMessageBox("Send Sound data for multiple times");
VAUtils::logStuff("Send Sound data for multiple times");
return false;
}
......@@ -65,7 +107,7 @@ bool UVASourceComponent::sendSoundData()
VAUtils::logStuff(FString("pos for ini: " + pos.ToString()));
// soundID = FVAPluginModule::initializeSound(vSoundName, pos, rot, vGainOffset, vLoop, vDelay, vActionP);
soundID = FVAPluginModule::initializeSoundWithReflections(vSoundName, pos, rot, vGainFactor * vGainFactor, vLoop, vDelay, IVAInterface::VA_PLAYBACK_ACTION_STOP);
soundID = FVAPluginModule::initializeSoundWithReflections(vSoundName, pos, rot, vGainFactor * vGainFactor, vLoop, vDelay, IVAInterface::VA_PLAYBACK_ACTION_STOP, this);
return true;
}
......@@ -83,7 +125,7 @@ void UVASourceComponent::initialize()
if (skeletal_mesh_component != nullptr && skeletal_mesh_component->DoesSocketExist(face_bone_name)) {
vMovement = EMovement::Human;
VAUtils::openMessageBox("Human detected");
VAUtils::logStuff("Human detected");
}
......@@ -239,6 +281,84 @@ void UVASourceComponent::TickComponent(float DeltaTime, ELevelTick TickType, FAc
FRotator rot = getRotation();
FVAPluginModule::updateSourcePos(soundID, pos, rot);
}
}
bool UVASourceComponent::createReflectedSourceRepresentation(AVAReflectionWall *wall, FVector pos, FRotator rot)
{
// sceneComp = CreateDefaultSubobject<USphereComponent>(FName("SphereComp"));
// sceneComp->bHiddenInGame = !FVAPluginModule::isInDebugMode();
// sceneComp->Mobility = EComponentMobility::Movable;
// sceneComp->SetRelativeScale3D(FVector(1, 1, 1));
// class UStaticMeshComponent* NewComponent = ConstructObject<UStaticMeshComponent>(UStaticMeshComponent::StaticClass(), this, TEXT("SphereComp"));
// NewComponent->RegisterComponent();
// NewComponent->OnComponentCreated(); // Might need this line, might not.
// NewComponent->AttachTo(GetRootComponent(), SocketName /* NAME_None */);
//
// class UStaticMeshComponent *coneMesh = NewObject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
// coneMesh->AttachTo(sphereComp);
// static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereMeshAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cone.Shape_Cone"));
//
// if (SphereMeshAsset.Succeeded()) {
// coneMesh->SetStaticMesh(SphereMeshAsset.Object);
// coneMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
// coneMesh->SetWorldLocation(pos);
// coneMesh->SetWorldRotation(rot);
// coneMesh->SetWorldScale3D(FVector(0.8f));
// coneMesh->SetVisibility(FVAPluginModule::isInDebugMode());
// }
// coneMeshMap.Add(wall, coneMesh);
// class UStaticMeshComponent tmpMesh = dynamic_cast<UStaticMeshComponent>(coneMeshMap.Find(wall));
if (initialized == false) {
FTransform trans;
trans.SetLocation(pos);
trans.SetRotation(rot.Quaternion());
conesTodo.Add(wall, trans);
return true;
}
class UStaticMeshComponent *tmpMesh = *(coneMeshMap.Find(wall));
//tmpMesh->
// tmpMesh->SetWorldLocation(pos);
// tmpMesh->SetWorldRotation(rot);
return true;
// class UStaticMeshComponent *coneMesh;
// coneMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
// coneMesh->SetStaticMesh(coneStaticMesh)
// coneMash->AttachTo(sceneComp);
// coneMash->
//coneMeshMap.Add(*wall, comp);
}
// // reflection Sphere
// sphereComp = CreateDefaultSubobject<USphereComponent>(FName("SphereComp"));
// sphereComp->bHiddenInGame = !FVAPluginModule::isInDebugMode();
// sphereComp->Mobility = EComponentMobility::Movable;
// sphereComp->SetRelativeScale3D(FVector(1, 1, 1));
// RootComponent = sphereComp;
//
// SphereMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
// SphereMesh->AttachTo(RootComponent);
// static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereMeshAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
// if (SphereMeshAsset.Succeeded()) {
// SphereMesh->SetStaticMesh(SphereMeshAsset.Object);
// SphereMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
// SphereMesh->SetWorldScale3D(FVector(0.8f));
// SphereMesh->SetVisibility(FVAPluginModule::isInDebugMode());
// }
......@@ -62,11 +62,11 @@ public:
// initialize sound Sources with their Reflections
static int initializeSoundWithReflections(FString soundNameF, FVector soundPos = FVector(0, 0, 0), FRotator soundRot = FRotator(0, 0, 0),
float gain = 0.0f, bool loop = false, float soundOffset = 0.0f, int action = IVAInterface::VA_PLAYBACK_ACTION_PAUSE);
float gain = 0.0f, bool loop = false, float soundOffset = 0.0f, int action = IVAInterface::VA_PLAYBACK_ACTION_PAUSE, UVASourceComponent* sourceComp = nullptr);
// initialize sound Source at VA Server //
static int initializeSound(FString soundNameF, FVector soundPos = FVector(0, 0, 0), FRotator soundRot = FRotator(0, 0, 0),
float gain = 0.0f, bool loop = false, float soundOffset = 0.0f, int action = IVAInterface::VA_PLAYBACK_ACTION_PAUSE);
float gain = 0.0f, bool loop = false, float soundOffset = 0.0f, int action = IVAInterface::VA_PLAYBACK_ACTION_PAUSE, UVASourceComponent* sourceComp = nullptr);
// enque Sound Component to prevent initialize bevor the connection to VA Server is established //
static bool enqueueSound(UVASourceComponent* soundComponent);
......@@ -158,6 +158,8 @@ public:
// read Dir file //
static bool readDirFile(FString dirName);
// returns if is in Debug Mode //
static bool isInDebugMode();
// TODO: //
......@@ -245,9 +247,15 @@ protected:
// bool if VA is used //
static bool useVA;
// bool if is in Debug Mode //
static bool debugMode;
// List of all registered input Phonemes //
static TArray<FString> listOfPhonemes;
// List of all registered input Pairs //
static TArray<FString> listOfPairs;
// List of all actual dirs//
static TArray<FString> listOfDirectivities;
......@@ -257,6 +265,8 @@ protected:
// Mapping of all phenomes to their int value @VA Server //
static TMap<FString, int> dirMappingToInt;
// bool runServerTest();
......
......@@ -15,15 +15,6 @@ class VAPLUGIN_API AVAReflectionWall : public AActor
UPROPERTY(VisibleDefaultsOnly, Category = ReflectionWall)
class UBoxComponent* planeComp;
UPROPERTY(VisibleDefaultsOnly, Category = ReflectionWall)
class USphereComponent* sphereComp;
UPROPERTY(VisibleDefaultsOnly, Category = ReflectionWall)
class USphereComponent* dirComp;
UPROPERTY(VisibleDefaultsOnly, Category = ReflectionWall)
class UStaticMeshComponent* SphereMesh;
// In- or decrease Gain Offset
UPROPERTY(EditAnywhere, meta = (DisplayName = "Reflection Factor", ClampMin = "0.0", ClampMax = "1.0", UIMin = "0.0", UIMax = "1.0"))
float vR = 1;
......
......@@ -3,6 +3,7 @@
#pragma once
#include "VAPlugin.h"
#include "VAReflectionWall.h"
#include "CoreMinimal.h"
#include "Array.h"
#include "Components/ActorComponent.h"
......@@ -77,6 +78,25 @@ class VAPLUGIN_API UVASourceComponent : public UActorComponent
UPROPERTY(EditAnywhere, meta = (DisplayName = "Offset"))
FVector vOffset = FVector(0, 0, 0);
// UPROPERTY(VisibleDefaultsOnly)
// class USceneComponent* sceneComp;
//
// UPROPERTY(VisibleDefaultsOnly)
// TMap<AVAReflectionWall*, class UStaticMeshComponent*> coneMeshMap;
UPROPERTY(VisibleDefaultsOnly)
class USphereComponent *sphereComp;
UPROPERTY(VisibleDefaultsOnly)
TMap<AVAReflectionWall*, class UStaticMeshComponent*> coneMeshMap;
//UPROPERTY(VisibleDefaultsOnly)
// TMap<AVAReflectionWall*, class UStaticMeshComponent*> sphereMeshMapBig;
//
//UPROPERTY(VisibleDefaultsOnly)
// TMap<AVAReflectionWall*, class UStaticMeshComponent*> sphereMeshMapSmall;
// Manual Rotation (if used)
// UPROPERTY(EditAnywhere, meta = (DisplayName = "Offset Rotation"))
// bool vOffsetRot = false;
......@@ -141,6 +161,10 @@ public:
UFUNCTION(BlueprintCallable)
bool setDirectivity_Phoneme(FString phoneme);
// set directivity of sound source with reflections //
UFUNCTION(BlueprintCallable)
bool createReflectedSourceRepresentation(AVAReflectionWall *wall, FVector pos, FRotator rot);
protected:
......@@ -174,6 +198,12 @@ protected:
// root component
USphereComponent* root_component;
// if sound source has run BeginPlay() //
bool initialized = false;
// Map of all cones that have to be placed at their position
TMap<AVAReflectionWall*, FTransform> conesTodo;
public:
// Called every frame
......
[DirectivityMapping]
dirFolder=
default=default
a=ad
b=ad
c=ad
d=ad
e=ad
f=ad
g=bd
h=bd
i=
j=jd
k=kd
l=ld
m=md
n=nd
o=od
p=pd
q=wd
r=rd
s=sd
t=td
u=ud
v=vd
w=wd
x=xd
y=yd
z=zd
ListOfPhonemesString=a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
ListOfPhonemesArray=default
ListOfPhonemesArray=a
ListOfPhonemesArray=b
ListOfPhonemesArray=c
ListOfPhonemesArray=d
ListOfPhonemesArray=e
ListOfPhonemesArray=f
ListOfPhonemesArray=g
ListOfPhonemesArray=h
ListOfPhonemesArray=i
ListOfPhonemesArray=j
ListOfPhonemesArray=k
ListOfPhonemesArray=l
ListOfPhonemesArray=m
ListOfPhonemesArray=n
ListOfPhonemesArray=o
ListOfPhonemesArray=p
ListOfPhonemesArray=q
ListOfPhonemesArray=r
ListOfPhonemesArray=s
ListOfPhonemesArray=t
ListOfPhonemesArray=u
ListOfPhonemesArray=v
ListOfPhonemesArray=w
ListOfPhonemesArray=x
ListOfPhonemesArray=y
ListOfPhonemesArray=z
default=defaultDir
dividingSymbol=,
pair=a,ab
pair=b,bb
pair=c,cb
[DirectivityMapping]
dirFolder=
default=default
a=ad
b=ad
c=ad
d=ad
e=ad
f=ad
g=bd
h=bd
i=
j=jd
k=kd
l=ld
m=md
n=nd
o=od
p=pd
q=wd
r=rd
s=sd
t=td
u=ud
v=vd
w=wd
x=xd
y=yd
z=zd
ListOfPhonemesString=a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
ListOfPhonemesArray=default
ListOfPhonemesArray=a
ListOfPhonemesArray=b
ListOfPhonemesArray=c
ListOfPhonemesArray=d
ListOfPhonemesArray=e
ListOfPhonemesArray=f
ListOfPhonemesArray=g
ListOfPhonemesArray=h
ListOfPhonemesArray=i
ListOfPhonemesArray=j
ListOfPhonemesArray=k
ListOfPhonemesArray=l
ListOfPhonemesArray=m
ListOfPhonemesArray=n
ListOfPhonemesArray=o
ListOfPhonemesArray=p
ListOfPhonemesArray=q
ListOfPhonemesArray=r
ListOfPhonemesArray=s
ListOfPhonemesArray=t
ListOfPhonemesArray=u
ListOfPhonemesArray=v
ListOfPhonemesArray=w
ListOfPhonemesArray=x
ListOfPhonemesArray=y
ListOfPhonemesArray=z
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment