Getting this error in a .cpp file trying to create an FVorbisAudioInfo object.
LogPlayLevel: C:~~~~~\Source\Turf\Private\ImportAudioToSoundWave.cpp(113): error C2065: ‘FVorbisAudioInfo’: undeclared identifier
LogPlayLevel: Error: C:~~~~~\Source\Turf\Private\ImportAudioToSoundWave.cpp(113): error C2146: syntax error: missing ‘;’ before identifier ‘vorbis_obj’
LogPlayLevel: C:~~~~~\Source\Turf\Private\ImportAudioToSoundWave.cpp(113): error C2065: ‘vorbis_obj’: undeclared identifier
LogPlayLevel: C:~~~~~~\Source\Private\ImportAudioToSoundWave.cpp(117): error C2065: ‘vorbis_obj’: undeclared identifier
What reason could there be for this error? I’ve searched everywhere and come up empty.
#include "ImportAudioToSoundWave.h"
#include "Runtime/Engine/Classes/Sound/SoundWave.h"
#include "Runtime/Engine/Public/VorbisAudioInfo.h"
#include "Developer/TargetPlatform/Public/Interfaces/IAudioFormat.h"
USoundWave* UImportAudioToSoundWave::GetSoundWaveFromRawOGGData(TArray<uint8> Bytes)
{
TArray <uint8> rawFile; //creates rawFile TArray on the stack
rawFile = Bytes; //pulls passed in paramters TArray to the TArray on the stack
UE_LOG(LogTemp, Log, TEXT("Raw File Data Size-> %u"), rawFile.Num());
**(113)FVorbisAudioInfo vorbis_obj;**
FSoundQualityInfo SoundQualityInfo;
**(117)if (vorbis_obj.ReadCompressedInfo(rawFile.GetData(), rawFile.Num(), &SoundQualityInfo))**
{
USoundWave* sw = NewObject<USoundWave>(USoundWave::StaticClass()); //creates a placeholder SoundWave on the stack
if (!sw)
{
UE_LOG(LogTemp, Error, TEXT("There was a nullptr when creating the USoundWave object."));
return nullptr; //checks to be sure it was created, if not return NullPtr
}
// Fill in all the Data we have
//sw->DecompressionType = EDecompressionType::DTYPE_RealTime;
sw->SoundGroup = ESoundGroup::SOUNDGROUP_Default;
sw->NumChannels = SoundQualityInfo.NumChannels;
sw->Duration = SoundQualityInfo.Duration;
sw->RawPCMDataSize = SoundQualityInfo.SampleDataSize;
sw->SetSampleRate(SoundQualityInfo.SampleRate);
FByteBulkData* BulkData = &sw->CompressedFormatData.GetFormat(FName("OGG")); // Get Pointer to the Compressed OGG Data
BulkData->Lock(LOCK_READ_WRITE); // Set the Lock of the BulkData to ReadWrite
FMemory::Memmove(BulkData->Realloc(rawFile.Num()), rawFile.GetData(), rawFile.Num()); // Copy compressed RawFile Data to the Address of the OGG Data of the SW File
BulkData->Unlock(); // Unlock the BulkData again
return sw;//returns the stack allocated sound wave, and following end of function, releases it from memory??????
}
else
{
UE_LOG(LogTemp, Error, TEXT("There was an error reading from the Vorbis Converion Information"));
return nullptr; //checks to be sure it was created, if not return NullPtr
}
}