diff --git a/include/core/audioapi.hpp b/include/core/audioapi.hpp index ef536dd0..3f8b4245 100644 --- a/include/core/audioapi.hpp +++ b/include/core/audioapi.hpp @@ -283,6 +283,11 @@ void audioapi_driver_init() throw(); */ void audioapi_driver_quit() throw(); +/** + * Panic notification. + */ +void audioapi_panicing() throw(); + /** * Enable or disable sound. * diff --git a/src/core/audioapi.cpp b/src/core/audioapi.cpp index 03fd9740..4a04c7a9 100644 --- a/src/core/audioapi.cpp +++ b/src/core/audioapi.cpp @@ -18,6 +18,7 @@ namespace { + bool paniced = false; const unsigned voicep_bufsize = 65536; const unsigned voicer_bufsize = 65536; const unsigned music_bufsize = 8192; @@ -506,6 +507,8 @@ void audioapi_vumeter::operator()(float* asamples, size_t count, bool stereo, do void audioapi_vumeter::update_vu() { + if(paniced) + return; if(!samples) { vu = -999.0; accumulator = 0; @@ -522,6 +525,11 @@ void audioapi_vumeter::update_vu() CORE().dispatch->vu_change(); } +void audioapi_panicing() throw() +{ + paniced = true; +} + //VU values. audioapi_vumeter audioapi_vu_mleft; audioapi_vumeter audioapi_vu_mright; diff --git a/src/core/window.cpp b/src/core/window.cpp index 8b8d153a..0038d8e8 100644 --- a/src/core/window.cpp +++ b/src/core/window.cpp @@ -228,6 +228,7 @@ void platform::fatal_error() throw() system_log << "-----------------------------------------------------------------------" << std::endl; system_log.close(); graphics_driver_fatal_error(); + audioapi_panicing(); //Don't call update VU, as that crashes. exit(1); }