Hey, I cant seem to figure out how to access the PCM data in a packaged build
this works in the editor but fails in a packaged build because SoundWave->GetCompressedData returns NULL
bool InitFromSoundWave(USoundWave* SoundWave)
{
if (SoundWave->bProcedural)
{
return false;
}
if (SoundWave->RawPCMData == NULL)
{
FAudioDevice* AudioDevice = GEngine->GetMainAudioDeviceRaw();
if (AudioDevice)
{
EDecompressionType DecompressionType = SoundWave->DecompressionType;
SoundWave->DecompressionType = DTYPE_Native;
FName format = AudioDevice->GetRuntimeFormat(SoundWave);
FByteBulkData* Bulk = SoundWave->GetCompressedData(format, SoundWave->GetPlatformCompressionOverridesForCurrentPlatform());
if (Bulk)
{
SoundWave->InitAudioResource(*Bulk);
if (SoundWave->DecompressionType != DTYPE_RealTime || SoundWave->CachedRealtimeFirstBuffer == nullptr)
{
FAsyncAudioDecompress TempDecompress(SoundWave, 128, AudioDevice);
TempDecompress.StartSynchronousTask();
}
}
SoundWave->DecompressionType = DecompressionType;
}
}
UE_LOG(LogTemp, Warning, TEXT("RawPCMDataSize: %d"), SoundWave->RawPCMDataSize);
return InitFromShortSamples(TArrayView<SHORT>((SHORT*)SoundWave->RawPCMData, SoundWave->RawPCMDataSize / 2),
SoundWave->GetSampleRateForCurrentPlatform(), SoundWave->NumChannels);
}
Does anyone have any ideas for how to access the data in a packaged build?