From ccb2f73dc09a190380a6d8fe530af8cb36558f42 Mon Sep 17 00:00:00 2001 From: M374LX Date: Wed, 11 Nov 2015 22:49:23 -0200 Subject: [PATCH] Fix "Dummy" actually using ALSA --- include/Mixer.h | 5 +++++ src/core/Mixer.cpp | 17 ++++++++++------- src/gui/MainWindow.cpp | 7 ++++--- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/include/Mixer.h b/include/Mixer.h index 1b40e082108..9cf17ae8ddf 100644 --- a/include/Mixer.h +++ b/include/Mixer.h @@ -175,6 +175,10 @@ class EXPORT Mixer : public QObject { return m_audioDevName; } + inline bool audioDevStartFailed() const + { + return m_audioDevStartFailed; + } void setAudioDevice( AudioDevice * _dev ); void setAudioDevice( AudioDevice * _dev, @@ -421,6 +425,7 @@ class EXPORT Mixer : public QObject AudioDevice * m_audioDev; AudioDevice * m_oldAudioDev; QString m_audioDevName; + bool m_audioDevStartFailed; // MIDI device stuff MidiClient * m_midiClient; diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index 762ec65673c..19744064199 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -71,6 +71,7 @@ Mixer::Mixer( bool renderOnly ) : m_masterGain( 1.0f ), m_audioDev( NULL ), m_oldAudioDev( NULL ), + m_audioDevStartFailed( false ), m_globalMutex( QMutex::Recursive ), m_profiler(), m_metronomeActive(false) @@ -717,10 +718,7 @@ AudioDevice * Mixer::tryAudioDevices() AudioDevice * dev = NULL; QString dev_name = ConfigManager::inst()->value( "mixer", "audiodev" ); - if( dev_name == AudioDummy::name() ) - { - dev_name = ""; - } + m_audioDevStartFailed = false; #ifdef LMMS_HAVE_SDL if( dev_name == AudioSdl::name() || dev_name == "" ) @@ -828,9 +826,14 @@ AudioDevice * Mixer::tryAudioDevices() //} //delete dev - printf( "No audio-driver working - falling back to dummy-audio-" - "driver\nYou can render your songs and listen to the output " - "files...\n" ); + if( dev_name != AudioDummy::name() ) + { + printf( "No audio-driver working - falling back to dummy-audio-" + "driver\nYou can render your songs and listen to the output " + "files...\n" ); + + m_audioDevStartFailed = true; + } m_audioDevName = AudioDummy::name(); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 921b4694608..97f30a1ad2d 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -559,10 +559,11 @@ void MainWindow::finalize() SetupDialog sd; sd.exec(); } - // look whether mixer could use a audio-interface beside AudioDummy - else if( Engine::mixer()->audioDevName() == AudioDummy::name() ) + // look whether mixer failed to start the audio device selected by the + // user and is using AudioDummy as a fallback + else if( Engine::mixer()->audioDevStartFailed() ) { - // no, so we offer setup-dialog with audio-settings... + // if so, offer the audio settings section of the setup dialog SetupDialog sd( SetupDialog::AudioSettings ); sd.exec(); }