diff --git a/README.md b/README.md index 1bca72e8ed300e666c5800f6d3a33e146d0b6a46..1ecf31e1a579758a5f2f35354ea754a9ed4497f6 100644 --- a/README.md +++ b/README.md @@ -5,21 +5,22 @@ This Plugin allows the user to use the [VA Server](http://www.virtualacoustics.o # Installation To install the Plugin, clone the repository into the "Plugins" folder of your Unreal Engine 4 Project. Moreover make sure to have the VA Server prepared. -The Server can either be used in its original form ([Link](http://www.virtualacoustics.org/)) or with the especially for this Plugin optimized Python Connection script ([Link](https://devhub.vr.rwth-aachen.de/VR-Group/vaserver), Recommended). -Using the Version with the Python script has the adventage of not needing to Restart the Server all the time manually and make sure to follow the instructions which are currently in its Readme file. +The Server can either be used in its original form ([Link](http://www.virtualacoustics.org/)) or with the especially for this Plugin optimized Python [VA Server Launcher](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/vaserverlauncher) script (Recommended). +Using the Version with the Python script has the advantage of not needing to Restart the Server all the time manually and make sure to follow the instructions which are currently in its Readme file. +Furthermore the Server Launcher Script can transfer used audio files from you Unreal project to the VAServer, so you don't have to do this manually. If you are using the automatic VAServer launching either have VAServer cloned out next to the folder of your project or specify the VALauncher Path in the Engine/Virtual Acoustics(VA) section of the project settings. -The Plugin requires to have the [nDisplayExtensions](https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/ndisplayextensions) installed. +The Plugin requires to have the [RWTH VR Toolkit](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/rwth-vr-toolkit) installed. ## Usage For a more detailed C++ / Blueprint usage and a Documentation of the Plugins public functions, please check out the matching wiki page for each public Class and Enum: -* [VAReceiverActor](https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/unreal-va-plugin/-/wikis/Documentation/VAReceiverActor) +* [VAReceiverActor](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/unreal-va-plugin/-/wikis/Documentation/VAReceiverActor) * Actor handling the Connection and Scene Settings for the current world, as well as the Position updates for the Receiver. If there is no Receiver Actor placed in the Scene, there will be created a new one with Default values at Runtime. -* [VAReflectionWall](https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/unreal-va-plugin/-/wikis/Documentation/VAReflectionWall) +* [VAReflectionWall](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/unreal-va-plugin/-/wikis/Documentation/VAReflectionWall) * Actor representing a wall on which the Sound Sources should reflect on. Make sure that its shape alligns with the wall. Please make sure to use symmetrical Directivities for the Sound Sources due to the fact that the directivities cannot be mirrored among the wall. -* [VASoundSourceComponent](https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/unreal-va-plugin/-/wikis/Documentation/VASoundSourceComponent) +* [VASoundSourceComponent](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/unreal-va-plugin/-/wikis/Documentation/VASoundSourceComponent) * Actor Component representing a Sound Source. Has to be attatched to something. It can have a graphical representation and reflecitons, which can be created with the Reflection Walls -* [VAEnums](https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/unreal-va-plugin/-/wikis/Documentation/VAEnmus) +* [VAEnums](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/unreal-va-plugin/-/wikis/Documentation/VAEnmus) * All Enums used within the Plugin. At current state, only the EPlayAction is used for the Interface functions \ No newline at end of file diff --git a/Source/VAPlugin/Private/SignalSources/VAAudioInputSignalSource.cpp b/Source/VAPlugin/Private/SignalSources/VAAudioInputSignalSource.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cc2389610aba4ef4954eb10da8a6d08ec1956cbf --- /dev/null +++ b/Source/VAPlugin/Private/SignalSources/VAAudioInputSignalSource.cpp @@ -0,0 +1,26 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "SignalSources/VAAudioInputSignalSource.h" + +#include "VAUtils.h" +#include "VAPlugin.h" + +void UVAAudioInputSignalSource::Initialize() +{ + if (bInitialized) + { + FVAUtils::LogStuff("[UVAAudioInputSignalSource::Initialize()]: Signal source is already initialized, aborting...", true); + return; + } + + + ID = FVAPlugin::GetAudioInputSignalSourceID(Channel); + if (!IsValidID(ID)) + { + FVAUtils::LogStuff("[UVAAudioInputSignalSource::Initialize()]: Error initializing Audio Input Signal Source", true); + return; + } + + bInitialized = true; +} diff --git a/Source/VAPlugin/Private/SoundSource/VAAudioInputSourceComponent.cpp b/Source/VAPlugin/Private/SoundSource/VAAudioInputSourceComponent.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9624a50d2316210816f65ee045e9699b5dcd09ba --- /dev/null +++ b/Source/VAPlugin/Private/SoundSource/VAAudioInputSourceComponent.cpp @@ -0,0 +1,12 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "SoundSource/VAAudioInputSourceComponent.h" + +#include "SignalSources/VAAudioInputSignalSource.h" + + +UVAAudioInputSourceComponent::UVAAudioInputSourceComponent() : Super() +{ + SignalSource = CreateDefaultSubobject<UVAAudioInputSignalSource>("AudioInputSignalSource"); +} diff --git a/Source/VAPlugin/Private/VAPlugin.cpp b/Source/VAPlugin/Private/VAPlugin.cpp index 80f3cf39995df16f0c8c9e4d90959c8ace15214e..1984b5f349e149df4fa6ea13260f8cf453607dc7 100644 --- a/Source/VAPlugin/Private/VAPlugin.cpp +++ b/Source/VAPlugin/Private/VAPlugin.cpp @@ -560,6 +560,25 @@ bool FVAPlugin::SetSignalSourceBufferLooping(const std::string& SignalSourceID, } } +std::string FVAPlugin::GetAudioInputSignalSourceID(const int Channel) +{ + if (!ShouldInteractWithServer()) + return VA_SLAVE_ID_STRING; + + const std::string SignalSourceID = "audioinput" + std::to_string(Channel); + + //TODO: Check if signal source really exist, otherwise return invalid ID + + //PSC: I was trying to use CVASignalSourceInfo for that. But when the local variable is destroyed, the program crashes. + //std::vector<CVASignalSourceInfo> Infos; + //VAServer->GetSignalSourceInfos(Infos); + //CVASignalSourceInfo Info = VAServer->GetSignalSourceInfo(SignalSourceID); + //if (false) + // return VA_INVALID_ID_STRING; + + return SignalSourceID; +} + std::string FVAPlugin::CreateSignalSourcePrototype(UVAAbstractSignalSource* SignalSource) { if (!ShouldInteractWithServer()) diff --git a/Source/VAPlugin/Private/VAPlugin.h b/Source/VAPlugin/Private/VAPlugin.h index 9aefa432aa49f20da83c80e89be109348437526a..d4874d279772cba27745b138d443a2fc9364993f 100644 --- a/Source/VAPlugin/Private/VAPlugin.h +++ b/Source/VAPlugin/Private/VAPlugin.h @@ -76,6 +76,9 @@ public: static bool SetSignalSourceBufferPlaybackPosition(const std::string& SignalSourceID, float Time); static bool SetSignalSourceBufferLooping(const std::string& SignalSourceID, bool bLoop); + // Returns the ID of the signal source referring the given audio input channel. Invalid ID, if channel does not exist + static std::string GetAudioInputSignalSourceID(const int Channel); + static std::string CreateSignalSourcePrototype(UVAAbstractSignalSource* SignalSource); // Deletes a signal source with given ID. Use with great care! static bool DeleteSignalSource(const std::string& SignalSourceID); diff --git a/Source/VAPlugin/Public/SignalSources/VAAudioInputSignalSource.h b/Source/VAPlugin/Public/SignalSources/VAAudioInputSignalSource.h new file mode 100644 index 0000000000000000000000000000000000000000..603e4d14d1575d2eb0618d1797d6291d89fa43d2 --- /dev/null +++ b/Source/VAPlugin/Public/SignalSources/VAAudioInputSignalSource.h @@ -0,0 +1,28 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "SignalSources/VAAbstractSignalSource.h" +#include "VAAudioInputSignalSource.generated.h" + +/** + * + */ +UCLASS(ClassGroup = (VA)) +class VAPLUGIN_API UVAAudioInputSignalSource : public UVAAbstractSignalSource +{ + GENERATED_BODY() + +protected: + // Input channel used to stream into signal source + UPROPERTY(EditAnywhere, meta = (DisplayName = "Input Channel ID", Category = "Audio Input", ClampMin = "1")) + int Channel = 1; + +public: + UVAAudioInputSignalSource() = default; + + // Creates the signal source in VA and sets the ID accordingly + void Initialize() override; + +}; diff --git a/Source/VAPlugin/Public/SoundSource/VAAudioInputSourceComponent.h b/Source/VAPlugin/Public/SoundSource/VAAudioInputSourceComponent.h new file mode 100644 index 0000000000000000000000000000000000000000..8c97ff80133f7a947db94ddd46ebe83bbb7d3ede --- /dev/null +++ b/Source/VAPlugin/Public/SoundSource/VAAudioInputSourceComponent.h @@ -0,0 +1,20 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "SoundSource/VAAbstractSourceComponent.h" +#include "VAAudioInputSourceComponent.generated.h" + +/** + * + */ +UCLASS(ClassGroup = (VA), meta = (BlueprintSpawnableComponent)) +class VAPLUGIN_API UVAAudioInputSourceComponent : public UVAAbstractSourceComponent +{ + GENERATED_BODY() +public: + + UVAAudioInputSourceComponent(); + +};