-
Notifications
You must be signed in to change notification settings - Fork 1
Keep Rubberband Faster selected during testing a Rubberband V2 build #26
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
|
|
||
| #include "audio/frame.h" | ||
| #include "control/controlvalue.h" | ||
| #include "engine/bufferscalers/enginebufferscalerubberband.h" | ||
| #include "engine/cachingreader/cachingreader.h" | ||
| #include "engine/engineobject.h" | ||
| #include "engine/sync/syncable.h" | ||
|
|
@@ -74,6 +75,8 @@ class EngineBuffer : public EngineObject { | |
| }; | ||
| Q_DECLARE_FLAGS(SeekRequests, SeekRequest); | ||
|
|
||
| // This enum is also used in mixxx.cfg | ||
| // Don't remove or swap values to keep backward compatibility | ||
| enum KeylockEngine { | ||
| SOUNDTOUCH, | ||
| RUBBERBAND_FASTER, | ||
|
|
@@ -150,12 +153,32 @@ class EngineBuffer : public EngineObject { | |
| case RUBBERBAND_FASTER: | ||
| return tr("Rubberband (better)"); | ||
| case RUBBERBAND_FINER: | ||
| return tr("Rubberband R3 (near-hi-fi quality)"); | ||
| if (EngineBufferScaleRubberBand::isEngineFinerAvailable()) { | ||
| return tr("Rubberband R3 (near-hi-fi quality)"); | ||
| } | ||
| [[fallthrough]]; | ||
| default: | ||
| return tr("Unknown (bad value)"); | ||
| return tr("Unknown, using Rubberband (better)"); | ||
| } | ||
| } | ||
|
|
||
| static bool isKeylockEngineAvailable(KeylockEngine engine) { | ||
| switch (engine) { | ||
| case SOUNDTOUCH: | ||
| return true; | ||
| case RUBBERBAND_FASTER: | ||
| return true; | ||
| case RUBBERBAND_FINER: | ||
| return EngineBufferScaleRubberBand::isEngineFinerAvailable(); | ||
| default: | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| static KeylockEngine defaultKeylockEngine() { | ||
| return RUBBERBAND_FASTER; | ||
| } | ||
|
Comment on lines
+166
to
+180
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC, we allow compiling without rubberband or soundtouch, right? If so, we need the appropriate ifdefs here.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do we? How?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently Rubberband and Soundtouch are "required" in our CMakeList: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok nevermind. I thought I've read some code that handled the absence of a pitch-/timestretching algorithm that lead me to believe they were optional. |
||
|
|
||
| // Request that the EngineBuffer load a track. Since the process is | ||
| // asynchronous, EngineBuffer will emit a trackLoaded signal when the load | ||
| // has completed. | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -88,9 +88,11 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, | |||||
|
|
||||||
| keylockComboBox->clear(); | ||||||
| for (int i = 0; i < EngineBuffer::KEYLOCK_ENGINE_COUNT; ++i) { | ||||||
| keylockComboBox->addItem( | ||||||
| EngineBuffer::getKeylockEngineName( | ||||||
| static_cast<EngineBuffer::KeylockEngine>(i))); | ||||||
| auto engine = static_cast<EngineBuffer::KeylockEngine>(i); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, cherry-picked this (and same change below in |
||||||
| if (EngineBuffer::isKeylockEngineAvailable(engine)) { | ||||||
| keylockComboBox->addItem( | ||||||
| EngineBuffer::getKeylockEngineName(engine), i); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| m_pLatencyCompensation = new ControlProxy("[Master]", "microphoneLatencyCompensation", this); | ||||||
|
|
@@ -216,15 +218,6 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, | |||||
|
|
||||||
| m_pKeylockEngine = | ||||||
| new ControlProxy("[Master]", "keylock_engine", this); | ||||||
| // if EngineBuffer doesn't accept the new engine it resets to RubberBand v2 | ||||||
| m_pKeylockEngine->connectValueChanged( | ||||||
| this, | ||||||
| [this](double value) { | ||||||
| m_pSettings->set(ConfigKey("[Master]", "keylock_engine"), | ||||||
| ConfigValue(value)); | ||||||
| keylockComboBox->setCurrentIndex(static_cast<int>(value)); | ||||||
| }, | ||||||
| Qt::DirectConnection); | ||||||
|
|
||||||
| #ifdef __LINUX__ | ||||||
| qDebug() << "RLimit Cur " << RLimit::getCurRtPrio(); | ||||||
|
|
@@ -320,9 +313,9 @@ void DlgPrefSound::slotApply() { | |||||
| SoundDeviceError err = SOUNDDEVICE_ERROR_OK; | ||||||
| { | ||||||
| ScopedWaitCursor cursor; | ||||||
| m_pKeylockEngine->set(keylockComboBox->currentIndex()); | ||||||
| m_pKeylockEngine->set(keylockComboBox->currentData().toDouble()); | ||||||
| m_pSettings->set(ConfigKey("[Master]", "keylock_engine"), | ||||||
| ConfigValue(keylockComboBox->currentIndex())); | ||||||
| ConfigValue(keylockComboBox->currentData().toInt())); | ||||||
|
|
||||||
| err = m_pSoundManager->setConfig(m_config); | ||||||
| } | ||||||
|
|
@@ -505,10 +498,19 @@ void DlgPrefSound::loadSettings(const SoundManagerConfig &config) { | |||||
| engineClockComboBox->setCurrentIndex(0); | ||||||
| } | ||||||
|
|
||||||
| // Default keylock is Rubberband v2 | ||||||
| int keylock_engine = m_pSettings->getValue( | ||||||
| ConfigKey("[Master]", "keylock_engine"), 1); | ||||||
| keylockComboBox->setCurrentIndex(keylock_engine); | ||||||
| // Default keylock engine is Rubberband Faster (v2) | ||||||
| int keylock_engine = | ||||||
| m_pSettings->getValue(ConfigKey("[Master]", "keylock_engine"), | ||||||
| static_cast<int>(EngineBuffer::defaultKeylockEngine())); | ||||||
| int index = keylockComboBox->findData(keylock_engine); | ||||||
| if (index >= 0) { | ||||||
| keylockComboBox->setCurrentIndex(index); | ||||||
| } else { | ||||||
| auto engine = static_cast<EngineBuffer::KeylockEngine>(keylock_engine); | ||||||
| keylockComboBox->addItem( | ||||||
| EngineBuffer::getKeylockEngineName(engine), keylock_engine); | ||||||
| keylockComboBox->setCurrentIndex(keylockComboBox->count() - 1); | ||||||
| } | ||||||
|
|
||||||
| m_loading = false; | ||||||
| // DlgPrefSoundItem has it's own inhibit flag | ||||||
|
|
@@ -690,8 +692,14 @@ void DlgPrefSound::slotResetToDefaults() { | |||||
| SoundManagerConfig newConfig(m_pSoundManager.get()); | ||||||
| newConfig.loadDefaults(m_pSoundManager.get(), SoundManagerConfig::ALL); | ||||||
| loadSettings(newConfig); | ||||||
| keylockComboBox->setCurrentIndex(EngineBuffer::RUBBERBAND_FASTER); | ||||||
| m_pKeylockEngine->set(EngineBuffer::RUBBERBAND_FASTER); | ||||||
|
|
||||||
| int keylock_engine = static_cast<int>(EngineBuffer::defaultKeylockEngine()); | ||||||
| int index = keylockComboBox->findData(keylock_engine); | ||||||
| DEBUG_ASSERT(index >= 0); | ||||||
| if (index >= 0) { | ||||||
| keylockComboBox->setCurrentIndex(index); | ||||||
| } | ||||||
| m_pKeylockEngine->set(keylock_engine); | ||||||
|
|
||||||
| masterMixComboBox->setCurrentIndex(1); | ||||||
| m_pMasterEnabled->set(1.0); | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do I get that right:
besides the other improvements in this PR, including only the scaler header (instead of the rubberband header) is more efficient because of
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#pragma once is these days equal efficient than #ifndef RUBBERBAND_STRETCHER_H
The pure size might be an issue, but all this effect only the duration of the build run anyway.
My driver for this change was hiding of information. In the current solution the scaler combobox work without any hard coded knowledge about the available scaler.
There is however the issue with the "EngineBuffer::RUBBERBAND_FASTER" as default value. We may refactor this also into the engine buffer.
Than we are in the situation that we do not have to touch the preferences for any new scaler mode.
What do you think? Shall I add this change as well?