diff --git a/aegisub/src/audio_provider.cpp b/aegisub/src/audio_provider.cpp index 72517bc8a..1482a56d6 100644 --- a/aegisub/src/audio_provider.cpp +++ b/aegisub/src/audio_provider.cpp @@ -61,21 +61,7 @@ #include void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) const { - try { - GetAudio(buf,start,count); - } - catch (AudioDecodeError const& e) { - LOG_E("audio_provider") << e.GetChainedMessage(); - memset(buf, 0, count*bytes_per_sample); - return; - } - catch (...) { - // FIXME: Poor error handling though better than none, to patch issue #800. - // Just return blank audio if real provider fails. - LOG_E("audio_provider") << "Unknown audio decoding error"; - memset(buf, 0, count*bytes_per_sample); - return; - } + GetAudio(buf,start,count); if (volume == 1.0) return; @@ -128,8 +114,23 @@ void AudioProvider::GetAudio(void *buf, int64_t start, int64_t count) const { memset(zero_buf, 0, zero_count * bytes_per_sample * channels); } - if (count > 0) - FillBuffer(buf, start, count); + if (count > 0) { + try { + FillBuffer(buf, start, count); + } + catch (AudioDecodeError const& e) { + LOG_E("audio_provider") << e.GetChainedMessage(); + memset(buf, 0, count*bytes_per_sample); + return; + } + catch (...) { + // FIXME: Poor error handling though better than none, to patch issue #800. + // Just return blank audio if real provider fails. + LOG_E("audio_provider") << "Unknown audio decoding error"; + memset(buf, 0, count*bytes_per_sample); + return; + } + } } AudioProvider *AudioProviderFactory::GetProvider(wxString const& filename, int cache) {