Skip to content

Commit

Permalink
chore: Rename members to match new output_latency_ms CO name
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Sep 29, 2023
1 parent 1248105 commit f85acc5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
17 changes: 9 additions & 8 deletions src/engine/enginemixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,17 @@ EngineMixer::EngineMixer(
m_pWorkerScheduler->start(QThread::HighPriority);

// Main sample rate
m_pMainSampleRate = new ControlObject(
m_pSampleRate = new ControlObject(
ConfigKey(kAppGroup, QStringLiteral("samplerate")), true, true);
m_pMainSampleRate->addAlias(ConfigKey(group, QStringLiteral("samplerate")));
m_pMainSampleRate->set(44100.);
m_pSampleRate->addAlias(ConfigKey(group, QStringLiteral("samplerate")));
m_pSampleRate->set(44100.);

// Latency control
m_pMainLatency = new ControlObject(ConfigKey(kAppGroup, QStringLiteral("output_latency_ms")),
m_pOutputLatencyMs = new ControlObject(
ConfigKey(kAppGroup, QStringLiteral("output_latency_ms")),
true,
true); // reported latency (sometimes correct)
m_pMainLatency->addAlias(ConfigKey(kLegacyGroup, QStringLiteral("latency")));
m_pOutputLatencyMs->addAlias(ConfigKey(kLegacyGroup, QStringLiteral("latency")));
m_pAudioLatencyOverloadCount = new ControlObject(
ConfigKey(kAppGroup, QStringLiteral("audio_latency_overload_count")));
m_pAudioLatencyOverloadCount->addAlias(ConfigKey(
Expand Down Expand Up @@ -236,8 +237,8 @@ EngineMixer::~EngineMixer() {
delete m_pXFaderMode;

delete m_pEngineSync;
delete m_pMainSampleRate;
delete m_pMainLatency;
delete m_pSampleRate;
delete m_pOutputLatencyMs;
delete m_pAudioLatencyOverloadCount;
delete m_pAudioLatencyUsage;
delete m_pAudioLatencyOverload;
Expand Down Expand Up @@ -418,7 +419,7 @@ void EngineMixer::process(const int iBufferSize) {
bool boothEnabled = m_pBoothEnabled->toBool();
bool headphoneEnabled = m_pHeadphoneEnabled->toBool();

m_sampleRate = mixxx::audio::SampleRate::fromDouble(m_pMainSampleRate->get());
m_sampleRate = mixxx::audio::SampleRate::fromDouble(m_pSampleRate->get());
// TODO: remove assumption of stereo buffer
constexpr unsigned int kChannels = 2;
const unsigned int iFrames = iBufferSize / kChannels;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/enginemixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ class EngineMixer : public QObject, public AudioSource {
ControlObject* m_pMainGain;
ControlObject* m_pBoothGain;
ControlObject* m_pHeadGain;
ControlObject* m_pMainSampleRate;
ControlObject* m_pMainLatency;
ControlObject* m_pSampleRate;
ControlObject* m_pOutputLatencyMs;
ControlObject* m_pAudioLatencyOverloadCount;
ControlObject* m_pAudioLatencyUsage;
ControlObject* m_pAudioLatencyOverload;
Expand Down
6 changes: 3 additions & 3 deletions src/preferences/dialog/dlgprefsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent,
new ControlProxy(kAppGroup, QStringLiteral("audio_latency_overload_count"), this);
m_pAudioLatencyOverloadCount->connectValueChanged(this, &DlgPrefSound::bufferUnderflow);

m_pMainLatency = new ControlProxy(kAppGroup, QStringLiteral("output_latency_ms"), this);
m_pMainLatency->connectValueChanged(this, &DlgPrefSound::mainLatencyChanged);
m_pOutputLatencyMs = new ControlProxy(kAppGroup, QStringLiteral("output_latency_ms"), this);
m_pOutputLatencyMs->connectValueChanged(this, &DlgPrefSound::outputLatencyChanged);

// TODO: remove this option by automatically disabling/enabling the main mix
// when recording, broadcasting, headphone, and main outputs are enabled/disabled
Expand Down Expand Up @@ -732,7 +732,7 @@ void DlgPrefSound::bufferUnderflow(double count) {
update();
}

void DlgPrefSound::mainLatencyChanged(double latency) {
void DlgPrefSound::outputLatencyChanged(double latency) {
currentLatency->setText(QString("%1 ms").arg(latency));
update();
}
Expand Down
4 changes: 2 additions & 2 deletions src/preferences/dialog/dlgprefsound.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class DlgPrefSound : public DlgPreferencePage, public Ui::DlgPrefSoundDlg {
void slotApply() override; // called on ok button
void slotResetToDefaults() override;
void bufferUnderflow(double count);
void mainLatencyChanged(double latency);
void outputLatencyChanged(double latency);
void latencyCompensationSpinboxChanged(double value);
void mainDelaySpinboxChanged(double value);
void headDelaySpinboxChanged(double value);
Expand Down Expand Up @@ -86,7 +86,7 @@ class DlgPrefSound : public DlgPreferencePage, public Ui::DlgPrefSoundDlg {
UserSettingsPointer m_pSettings;
SoundManagerConfig m_config;
ControlProxy* m_pAudioLatencyOverloadCount;
ControlProxy* m_pMainLatency;
ControlProxy* m_pOutputLatencyMs;
ControlProxy* m_pHeadDelay;
ControlProxy* m_pMainDelay;
ControlProxy* m_pBoothDelay;
Expand Down

0 comments on commit f85acc5

Please sign in to comment.