Hey fine people of the forums!
I use the .wav file loading code to …well, load .wav files. Works great. I use a UAudioComponent with the resulting USoundWave like so:
AudioComp->SetSound(Sound);
AudioComp->Play(0);
That works like a charm. EXCEPT when I give the Play function a StartTime like so
AudioComp->Play(1.0f);
Now nothing plays anymore. I’ve tried to chase down the rabbit hole of the Unreal engine code to see what is need for the StartTime to work, but I couln’t figure it out. Any help/suggestions are greatly appreciated.
EDIT:
I found my mistake, pretty dumb but I’m leaving it here for completeness:
I did :
USoundWave* Sound;
Sound->RawData.Lock(LOCK_READ_WRITE);
void* LockedData = Sound->RawData.Realloc(RawData.Num());
FMemory::Memcpy(LockedData, WaveInfo.SampleDataStart, WaveInfo.SampleDataSize);
Sound->RawData.Unlock();
instead of :
USoundWave* Sound;
Sound->RawData.Lock(LOCK_READ_WRITE);
void* LockedData = Sound->RawData.Realloc(RawData.Num());
FMemory::Memcpy(LockedData, RawData.GetData(), WaveInfo.SampleDataSize);
Sound->RawData.Unlock();
and since ‘WaveInfo.SampleDataStart’ is null, the RawData in the Sound wave was also then a null pointer. Since the Unreal sound processing on relies on the Sound->RawData, meant Unreal could not do its thing.
So, totally my stupidity.
Thanks anyway, cheers.