file SequnceAudio.Build.cs as follows:
using UnrealBuildTool;
public class SequnceAudio : ModuleRules
{
public SequnceAudio(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Guide", "SoundVisualizations" });
PrivateDependencyModuleNames.AddRange(new string[] { "SoundVisualizations" });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}
And my code file is:
if (AudioSection->GetStartTime() <= TimeCursorPosition && AudioSection->GetEndTime() >= TimeCursorPosition)
{
USoundBase* SoundBase = AudioSection->GetSound();
USoundWave* Sound = Cast<USoundWave>(SoundBase);
if (Guide)
{
UStaticMeshComponent* GuideMesh = Guide->Mesh;
UMaterialInterface* MaterialInterface = GuideMesh->GetMaterial(2);
UMaterialInstanceDynamic* MaterialInstanceDynamic = GuideMesh->CreateDynamicMaterialInstance(2, MaterialInterface);
TArray<float> OutAmplitudes;
USoundVisualizationStatics::GetAmplitude(Sound, false, TimeCursorPosition - AudioSection->GetStartTime(), 0.01, 1, OutAmplitudes);
float Amplitude = AmplitudeNormalization(AmplitudeAverage(OutAmplitudes));
MaterialInstanceDynamic->SetScalarParameterValue(FName("Amplitude"), Amplitude);
MaterialInstanceDynamic->SetScalarParameterValue(FName("Mode"), 1);
GuideMesh->SetMaterial(2, MaterialInstanceDynamic);
UE_LOG(LogTemp, Error, TEXT("Guide: %s"), *Guide->GetActorLabel());
}
UE_LOG(LogTemp, Error, TEXT("Sound Name: %s"), *UKismetSystemLibrary::GetObjectName(Sound));
}
However, when I compile it, it brings one linker error. As follows,
error LNK2019: Cannot resolve the external symbol "public: static void __cdecl USoundVisualizationStatics::GetAmplitude(class USoundWave *,int,float,float,int,class TArray<float,class FDefaultAllocator> &)" (?GetAmplitude@USoundVisualizationStatics@@SAXPEAVUSoundWave@@HMMHAEAV?$TArray@MVFDefaultAllocator@@@@@Z),The symbol in the function "private: void __cdecl AGuideCineActor::AudioVisualization(void)" (?AudioVisualization@AGuideCineActor@@AEAAXXZ) is referenced
2>E:\Unreal Projects\SequnceAudio\Binaries\Win64\UE4Editor-SequnceAudio-407.dll : fatal error LNK1120: 1 unresolve external commands
Is there anything wrong with my code?