gtreshchev / RuntimeAudioImporter

Runtime Audio Importer plugin for Unreal Engine. Importing audio of various formats at runtime.
MIT License
308 stars 67 forks source link

Audio Device Play StartTime is getting ignored because of empty cooked data #26

Closed CarstenZarbock closed 1 year ago

CarstenZarbock commented 1 year ago

Hello, i'm trying to play an imported sound wave per AudioDevice->Play(some start time) but the start time is always getting ignored and the sound playback starts at 0.0

As far as i can see it's because of

USoundWave::CookedSpectralTimeData and USoundWave::CookedEnvelopeTimeData being empty in USoundWave::GetSoundWavesWithCookedAnalysisData

Called from UAudioComponent::PlayInternal

// Setup audio component cooked analysis data playback data set if (AudioDevice->IsBakedAnalaysisQueryingEnabled()) { TArray<USoundWave*> SoundWavesWithCookedData; NewActiveSound.bUpdatePlaybackTime = Sound->GetSoundWavesWithCookedAnalysisData(SoundWavesWithCookedData);

bUpdatePlaybackTime will be false, resulting in FActiveSound::UpdateWaveInstances not updating the playback time.

I'm importing the audio from a buffer transmitted per network using URuntimeAudioImporterLibrary::ImportAudioFromBuffer (Audio works perfect besides the start time) RuntimeAudioImporter->ImportAudioFromBuffer(track.Buffer, EAudioFormat::OggVorbis)

CarstenZarbock commented 1 year ago

Should have read the documentation.

https://github.com/gtreshchev/RuntimeAudioImporter/wiki/Example-for-playing-sound-waves