Skip to content
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
6 changes: 5 additions & 1 deletion src/mixxxmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,11 @@ void MixxxMainWindow::initialize() {
// 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().isEmpty()) {
while (m_pCoreServices->getSoundManager()
->getConfig()
.getOutputs()
.isEmpty() &&
!m_pCoreServices->getSoundManager()->pipewireSkipConfig()) {
// Exit when we press the Exit button in the noSoundDlg dialog
// only call it if result != OK
bool continueClicked = false;
Expand Down
54 changes: 41 additions & 13 deletions src/preferences/dialog/dlgprefsound.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "preferences/dialog/dlgprefsound.h"

#include <QBoxLayout>
#include <QCheckBox>
#include <QGroupBox>
#include <QMessageBox>
#include <QtDebug>
#include <algorithm>
Expand Down Expand Up @@ -37,6 +39,8 @@ const ConfigKey kKeylockMultiThreadingCfgkey =
ConfigKey(kAppGroup, QStringLiteral("keylock_multithreading"));
const ConfigKey kPipeWire =
ConfigKey(kAppGroup, QStringLiteral("pipewire"));
const ConfigKey kPipeWirePatchbay =
ConfigKey(kAppGroup, QStringLiteral("pipewire_patchbay_sync"));

bool soundItemAlreadyExists(const AudioPath& output, const QWidget& widget) {
for (const QObject* pObj : widget.children()) {
Expand Down Expand Up @@ -119,6 +123,11 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent,
this,
&DlgPrefSound::updateDeviceChannels);

connect(m_pSoundManager.get(),
&SoundManager::configInvalidated,
this,
&DlgPrefSound::invalidateConfig);

apiComboBox->clear();
apiComboBox->addItem(SoundManagerConfig::kEmptyComboBox,
SoundManagerConfig::kAPINone);
Expand Down Expand Up @@ -225,17 +234,39 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent,
apiHBox->addWidget(m_pipewireCheckBox.get());

connect(m_pipewireCheckBox,
&QCheckBox::toggled,
this,
[this](bool) {
m_settingsModified = true;
QMessageBox::information(this,
tr("Information"),
tr("Mixxx must be restarted for the PipeWire "
"API selection to take effect."));
});
}

if (m_pSoundManager->isPipewireSelected()) {
m_pipewirePatchbayCheckBox = make_parented<QCheckBox>(this);
m_pipewirePatchbayCheckBox->setText(tr("Sync with external patchbay"));
m_pPipewirePatchbay = make_parented<ControlProxy>(
kPipeWirePatchbay.group, kPipeWirePatchbay.item, this);
connect(m_pipewirePatchbayCheckBox,
&QCheckBox::toggled,
this,
[this](bool checked) {
m_pSettings->setValue(kPipeWirePatchbay, checked);
m_pPipewirePatchbay->set(checked);
ioTabs->setDisabled(checked);
m_settingsModified = true;
if (m_pSoundManager->isPipewireSelected() xor checked) {
QMessageBox::information(this,
tr("Information"),
tr("Mixxx must be restarted for the PipeWire "
"API selection to take effect."));
}
});

auto pipewireGroupBox = make_parented<QGroupBox>("PipeWire Settings", this);
auto pipewireSettings = make_parented<QVBoxLayout>(pipewireGroupBox);
verticalLayout_2->insertWidget(2, pipewireGroupBox.get());

bool checked = m_pSettings->getValue(kPipeWirePatchbay, false);
m_pipewirePatchbayCheckBox->setChecked(checked);
pipewireSettings->addWidget(m_pipewirePatchbayCheckBox.get());
}
#endif

Expand Down Expand Up @@ -575,7 +606,6 @@ void DlgPrefSound::connectSoundItem(DlgPrefSoundItem* pItem) {
&DlgPrefSound::deviceChannelsUpdated,
pItem,
&DlgPrefSoundItem::updateDeviceChannels);
connect(this, &DlgPrefSound::deviceRouteUpdated, pItem, &DlgPrefSoundItem::updateDeviceRoute);
}

void DlgPrefSound::insertItem(DlgPrefSoundItem *pItem, QVBoxLayout *pLayout) {
Expand Down Expand Up @@ -699,12 +729,6 @@ void DlgPrefSound::loadSettings(const SoundManagerConfig& config) {
}
}

#ifdef __PIPEWIRE__
if (CmdlineArgs::Instance().getDeveloper()) {
m_pipewireCheckBox->setChecked(m_pSoundManager->isPipewireSelected());
}
#endif

m_loading = false;
// DlgPrefSoundItem has it's own inhibit flag
emit loadPaths(m_config);
Expand Down Expand Up @@ -1234,3 +1258,7 @@ void DlgPrefSound::updateSampleRates(const QList<mixxx::audio::SampleRate>& samp
}
}
}

void DlgPrefSound::invalidateConfig() {
m_settingsModified = true;
}
6 changes: 5 additions & 1 deletion src/preferences/dialog/dlgprefsound.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "preferences/usersettings.h"
#include "soundio/sounddevice.h"
#include "soundio/soundmanagerconfig.h"
#include "soundio/soundmanagerutil.h"
#include "util/parented_ptr.h"

class ControlObject;
Expand Down Expand Up @@ -37,6 +38,7 @@ class DlgPrefSound : public DlgPreferencePage, public Ui::DlgPrefSoundDlg {

signals:
void loadPaths(const SoundManagerConfig &config);
void writePath(const AudioPath* pPath, SoundManagerConfig* config);
void writePaths(SoundManagerConfig *config);
void refreshOutputDevices(const QList<SoundDevicePointer>& devices);
void refreshInputDevices(const QList<SoundDevicePointer>& devices);
Expand All @@ -46,7 +48,6 @@ class DlgPrefSound : public DlgPreferencePage, public Ui::DlgPrefSoundDlg {
void removeInputDevice(SoundDevicePointer pDevice);
void updatingAPI();
void updatedAPI();
void deviceRouteUpdated(const SoundDeviceId& device, const AudioPath* pPath);
void deviceChannelsUpdated(SoundDevicePointer devices);

public slots:
Expand Down Expand Up @@ -91,6 +92,7 @@ class DlgPrefSound : public DlgPreferencePage, public Ui::DlgPrefSoundDlg {
void removeDevice(SoundDevicePointer pDevice);
void updateDeviceChannels(SoundDevicePointer pDevice);
void updateSampleRates(const QList<mixxx::audio::SampleRate>& sampleRates);
void invalidateConfig();

private:
void initializePaths();
Expand Down Expand Up @@ -127,5 +129,7 @@ class DlgPrefSound : public DlgPreferencePage, public Ui::DlgPrefSoundDlg {

#ifdef __PIPEWIRE__
parented_ptr<QCheckBox> m_pipewireCheckBox;
parented_ptr<QCheckBox> m_pipewirePatchbayCheckBox;
parented_ptr<ControlProxy> m_pPipewirePatchbay;
#endif
};
31 changes: 0 additions & 31 deletions src/preferences/dialog/dlgprefsounditem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,7 @@ void DlgPrefSoundItem::refreshDevices(const QList<SoundDevicePointer>& devices)
}

void DlgPrefSoundItem::addDevice(const SoundDevicePointer pDevice) {
// SoundDeviceId oldDev =
// deviceComboBox->itemData(deviceComboBox->currentIndex()).value<SoundDeviceId>();
deviceComboBox->addItem(pDevice->getDisplayName(), QVariant::fromValue(pDevice->getDeviceId()));

// int newIndex = deviceComboBox->findData(QVariant::fromValue(oldDev));
// deviceComboBox->setCurrentIndex(newIndex);

m_devices.push_back(pDevice);
}

Expand Down Expand Up @@ -116,31 +110,6 @@ void DlgPrefSoundItem::updateDeviceChannels(SoundDevicePointer pDevice) {
}
}

void DlgPrefSoundItem::updateDeviceRoute(const SoundDeviceId& id, const AudioPath* pPath) {
if (pPath->getType() != m_type || pPath->getIndex() != m_index) {
return;
}

// qWarning() << "DlgPrefSoundItem::updateDevice" << id.name;
int index = deviceComboBox->findData(QVariant::fromValue(id));

VERIFY_OR_DEBUG_ASSERT(index >= 0) {
return;
}

if (index != deviceComboBox->currentIndex()) {
deviceComboBox->blockSignals(true);
deviceComboBox->setCurrentIndex(index);
deviceComboBox->blockSignals(false);
deviceChanged(index);
}

auto channelGroup = pPath->getChannelGroup();
QPoint point = QPoint(channelGroup.getChannelBase(), channelGroup.getChannelCount());
int channelIndex = channelComboBox->findData(QVariant::fromValue(point));
channelComboBox->setCurrentIndex(channelIndex);
}

/// Slot called when the device combo box selection changes. Updates the channel
/// combo box.
void DlgPrefSoundItem::deviceChanged(int index) {
Expand Down
1 change: 0 additions & 1 deletion src/preferences/dialog/dlgprefsounditem.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class DlgPrefSoundItem : public QWidget, public Ui::DlgPrefSoundItem {
void addDevice(SoundDevicePointer pDevice);
void removeDevice(SoundDevicePointer pDevice);
void updateDeviceChannels(SoundDevicePointer pDevice);
void updateDeviceRoute(const SoundDeviceId& pDevice, const AudioPath* pPath);

private:
SoundDevicePointer getDevice() const; // if this returns NULL, we don't have a valid AudioPath
Expand Down
Loading
Loading