Skip to content

Commit

Permalink
Merge pull request #2376 from M374LX/dummyaudio
Browse files Browse the repository at this point in the history
Partially fix "Dummy" actually using ALSA
  • Loading branch information
tresf committed Nov 12, 2015
2 parents 2284a8c + ccb2f73 commit 34821f9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
5 changes: 5 additions & 0 deletions include/Mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
17 changes: 10 additions & 7 deletions src/core/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 == "" )
Expand Down Expand Up @@ -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();

Expand Down
7 changes: 4 additions & 3 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 34821f9

Please sign in to comment.