Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't wipe inapplicable sound config immediately #4544

Merged
merged 1 commit into from
Nov 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/mixxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include "skin/legacy/legacyskinparser.h"
#include "skin/skinloader.h"
#include "soundio/soundmanager.h"
#include "soundio/soundmanagerconfig.h"
#include "sources/soundsourceproxy.h"
#include "track/track.h"
#include "util/db/dbconnectionpooled.h"
Expand Down Expand Up @@ -640,7 +641,9 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
// https://bugs.launchpad.net/mixxx/+bug/1758189
m_pPlayerManager->loadSamplers();

// 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 @@ -658,11 +661,10 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
}
} 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_pSoundManager->getConfig().getOutputs().count() == 0) {
// Exit when we press the Exit button in the noSoundDlg dialog
// only call it if result != OK
Expand All @@ -673,7 +675,10 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
if (continueClicked) {
break;
}
}
}
// The user has either reconfigured devices or accepted no outputs,
// so it's now safe to write the new config to disk.
m_pSoundManager->getConfig().writeToDisk();

// Load tracks in args.qlMusicFiles (command line arguments) into player
// 1 and 2:
Expand Down Expand Up @@ -1035,6 +1040,7 @@ QDialog::DialogCode MixxxMainWindow::soundDeviceErrorDlg(
m_pSoundManager->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
1 change: 1 addition & 0 deletions src/mixxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class SettingsManager;
class BroadcastManager;
class SkinLoader;
class SoundManager;
class SoundManagerConfig;
class VinylControlManager;
class WMainMenuBar;

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