diff --git a/Plugins/eXiSoundVis/Source/eXiSoundVis/Private/AudioDecompressWorker.cpp b/Plugins/eXiSoundVis/Source/eXiSoundVis/Private/AudioDecompressWorker.cpp index ee4590d..7610d0e 100644 --- a/Plugins/eXiSoundVis/Source/eXiSoundVis/Private/AudioDecompressWorker.cpp +++ b/Plugins/eXiSoundVis/Source/eXiSoundVis/Private/AudioDecompressWorker.cpp @@ -67,37 +67,41 @@ uint32 FAudioDecompressWorker::Run() if (AudioInfo != NULL) { - FSoundQualityInfo QualityInfo = { 0 }; + try { + FSoundQualityInfo QualityInfo = { 0 }; - // Parse the audio header for the relevant information - if (!(SoundWaveRef->ResourceData)) - { - return 0; - } + // Parse the audio header for the relevant information + if (!(SoundWaveRef->ResourceData)) + { + return 0; + } - if (AudioInfo->ReadCompressedInfo(SoundWaveRef->ResourceData, SoundWaveRef->ResourceSize, &QualityInfo)) - { - FScopeCycleCounterUObject WaveObject(SoundWaveRef); + if (AudioInfo->ReadCompressedInfo(SoundWaveRef->ResourceData, SoundWaveRef->ResourceSize, &QualityInfo)) + { + FScopeCycleCounterUObject WaveObject(SoundWaveRef); - // Extract the data - SoundWaveRef->SampleRate = QualityInfo.SampleRate; - SoundWaveRef->NumChannels = QualityInfo.NumChannels; + // Extract the data + SoundWaveRef->SampleRate = QualityInfo.SampleRate; + SoundWaveRef->NumChannels = QualityInfo.NumChannels; - if (QualityInfo.Duration > 0.0f) - { - SoundWaveRef->Duration = QualityInfo.Duration; - } + if (QualityInfo.Duration > 0.0f) + { + SoundWaveRef->Duration = QualityInfo.Duration; + } - const uint32 PCMBufferSize = SoundWaveRef->Duration * SoundWaveRef->SampleRate * SoundWaveRef->NumChannels; + const uint32 PCMBufferSize = SoundWaveRef->Duration * SoundWaveRef->SampleRate * SoundWaveRef->NumChannels; - SoundWaveRef->CachedRealtimeFirstBuffer = new uint8[PCMBufferSize * 2]; + SoundWaveRef->CachedRealtimeFirstBuffer = new uint8[PCMBufferSize * 2]; - AudioInfo->SeekToTime(0.0f); - AudioInfo->ReadCompressedData(SoundWaveRef->CachedRealtimeFirstBuffer, false, PCMBufferSize * 2); - } - else if (SoundWaveRef->DecompressionType == DTYPE_RealTime || SoundWaveRef->DecompressionType == DTYPE_Native) - { - SoundWaveRef->RemoveAudioResource(); + AudioInfo->SeekToTime(0.0f); + AudioInfo->ReadCompressedData(SoundWaveRef->CachedRealtimeFirstBuffer, false, PCMBufferSize * 2); + } + else if (SoundWaveRef->DecompressionType == DTYPE_RealTime || SoundWaveRef->DecompressionType == DTYPE_Native) + { + SoundWaveRef->RemoveAudioResource(); + } + } catch (const std::exception&) { + // Yo, bad things happened } delete AudioInfo; diff --git a/Plugins/eXiSoundVis/Source/eXiSoundVis/Private/SoundVisComponent.cpp b/Plugins/eXiSoundVis/Source/eXiSoundVis/Private/SoundVisComponent.cpp index fee0d85..9a326c5 100644 --- a/Plugins/eXiSoundVis/Source/eXiSoundVis/Private/SoundVisComponent.cpp +++ b/Plugins/eXiSoundVis/Source/eXiSoundVis/Private/SoundVisComponent.cpp @@ -351,8 +351,12 @@ void USoundVisComponent::Notify_SoundDecompressed() // ..clear the timer and.. GetWorld()->GetTimerManager().ClearTimer(AudioDecompressTimer); - //..broadcast the result to the Blueprint - OnFileLoadCompleted.Broadcast(FAudioDecompressWorker::Runnable->GetSoundWaveRef()); + try { + //..broadcast the result to the Blueprint + OnFileLoadCompleted.Broadcast(FAudioDecompressWorker::Runnable->GetSoundWaveRef()); + } catch (const std::exception&) { + // Yo, bad things happened + } PrintLog(TEXT("Worker finished!")); } diff --git a/Plugins/eXiSoundVis/Source/eXiSoundVis/eXiSoundVis.Build.cs b/Plugins/eXiSoundVis/Source/eXiSoundVis/eXiSoundVis.Build.cs index 1e85bda..342b328 100644 --- a/Plugins/eXiSoundVis/Source/eXiSoundVis/eXiSoundVis.Build.cs +++ b/Plugins/eXiSoundVis/Source/eXiSoundVis/eXiSoundVis.Build.cs @@ -5,7 +5,9 @@ public class eXiSoundVis : ModuleRules { public eXiSoundVis(ReadOnlyTargetRules Target) : base(Target) { - PrivateIncludePaths.AddRange(new string[] { "eXiSoundVis/Private" }); + this.bEnableExceptions = true; + + PrivateIncludePaths.AddRange(new string[] { "eXiSoundVis/Private" }); PublicIncludePaths.AddRange(new string[] { "eXiSoundVis/Public" }); PublicDependencyModuleNames.AddRange(new string[] { "Engine", "Core", "CoreUObject", "InputCore", "RHI", "Kiss_FFT" });