Skip to content

Commit

Permalink
Merge remote-tracking branch 'mixxx/2.3' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Nov 28, 2021
2 parents 1fb9645 + bbb70de commit e9681f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/mixxxmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ void MixxxMainWindow::initialize() {
checkDirectRendering();
}

// Try open player device If that fails, the preference panel is opened.
// Sound hardware setup
// Try to open configured devices. If that fails, display dialogs
// that allow to either retry, reconfigure devices or exit.
bool retryClicked;
do {
retryClicked = false;
Expand All @@ -266,11 +268,10 @@ void MixxxMainWindow::initialize() {
}
} while (retryClicked);

// test for at least one out device, if none, display another dlg that
// says "mixxx will barely work with no outs"
// In case persisting errors, the user has already received a message
// box from the preferences dialog above. So we can watch here just the
// output count.
// Test for at least one output device. If none, display another dialog
// that says "mixxx will barely work with no outs".
// In case of persisting errors, the user has already received a message
// above. So we can just check the output count here.
while (m_pCoreServices->getSoundManager()->getConfig().getOutputs().count() == 0) {
// Exit when we press the Exit button in the noSoundDlg dialog
// only call it if result != OK
Expand All @@ -283,6 +284,10 @@ void MixxxMainWindow::initialize() {
}
}

// The user has either reconfigured devices or accepted no outputs,
// so it's now safe to write the new config to disk.
m_pCoreServices->getSoundManager()->getConfig().writeToDisk();

// this has to be after the OpenGL widgets are created or depending on a
// million different variables the first waveform may be horribly
// corrupted. See bug 521509 -- bkgood ?? -- vrince
Expand Down Expand Up @@ -467,6 +472,7 @@ QDialog::DialogCode MixxxMainWindow::soundDeviceErrorDlg(
m_pCoreServices->getSoundManager()->clearAndQueryDevices();
// This way of opening the dialog allows us to use it synchronously
m_pPrefDlg->setWindowModality(Qt::ApplicationModal);
// Open preferences, sound hardware page is selected (default on first call)
m_pPrefDlg->exec();
if (m_pPrefDlg->result() == QDialog::Accepted) {
return QDialog::Accepted;
Expand Down
5 changes: 4 additions & 1 deletion src/soundio/soundmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ SoundManager::SoundManager(UserSettingsPointer pConfig,
m_config.loadDefaults(this, SoundManagerConfig::ALL);
}
checkConfig();
m_config.writeToDisk(); // in case anything changed by applying defaults
// Don't write config to disk, yet -- it may be reset to defaults in case
// previously configured devices were not found.
// Write new config after MixxxMainWindow::noOutputDlg where the user has
// a chance to keep the previous sound config (exit).
}

SoundManager::~SoundManager() {
Expand Down

0 comments on commit e9681f2

Please sign in to comment.