Hello! I’m working on my own project, and I’m trying to find out how to save a midi file to an array, which is similar to what is discussed in lecture 69 with saving a text file to an array. I have the implementation setup, but I can’t figure out why my UE_LOGs aren’t working. Is there a problem with my code? Any help or advice is appreciated.
// Called when the game starts or when spawned
void APianoBase::BeginPlay()
{
Super::BeginPlay();
//Setup of midifile path
const FString MidiFilePath = FPaths::ProjectContentDir() / TEXT("MidiFiles/test.mid");
//Filemanager used to deal with the file
IPlatformFile& FileManager = FPlatformFileManager::Get().GetPlatformFile();
//Load midi binary file to array
if (FileManager.FileExists(*MidiFilePath))
{
if(FFileHelper::LoadFileToArray(MidiFile, *MidiFilePath))
{
UE_LOG(LogTemp, Warning, TEXT("FILE MANIPULATION: File Loaded Successfully"));
return;
}
else
{
UE_LOG(LogTemp, Warning, TEXT("FILE MANIPULATION: Did not load text from file"));
}
}
else
{
UE_LOG(LogTemp, Warning, TEXT("FILE MANIPULATION ERROR: Can not read the file because it was not found."));
UE_LOG(LogTemp, Warning, TEXT("FILE MANIPULATION ERROR: Expected file location at %s"), *MidiFilePath);
}
}
Output Log: