Hi,
I’m trying to import OGG files in UE5 and use them as a Metasound source. I cannot use the Runtime Audio Importer plugin, since it’s incompatible with MS. I tried using some existing solutions for UE4, but they don’t seem to work anymore:
TArray<uint8> Data;
FFileHelper::LoadFileToArray(Data, *Path);
FSoundQualityInfo QualityInfo;
FVorbisAudioInfo AudioInfo;
AudioInfo.ReadCompressedInfo(Data.GetData(), Data.Num(), &QualityInfo);
const auto NewSound = NewObject<USoundWave>();
NewSound->DecompressionType = EDecompressionType::DTYPE_RealTime;
NewSound->SoundGroup = ESoundGroup::SOUNDGROUP_Music;
NewSound->NumChannels = QualityInfo.NumChannels;
NewSound->Duration = QualityInfo.Duration;
NewSound->RawPCMDataSize = QualityInfo.SampleDataSize;
NewSound->SetSampleRate(QualityInfo.SampleRate);
const auto BulkData = NewSound->GetCompressedData("OGG");
BulkData->Lock(LOCK_READ_WRITE);
FMemory::Memcpy(BulkData->Realloc(Data.Num()), Data.GetData(), Data.Num());
BulkData->Unlock();
The problem here is that NewSound->GetCompressedData("OGG");
returns nullptr. Is there any way to do this?