Skip to content

Commit

Permalink
Merge pull request #12399 from ronso0/pref-mixer-defaults
Browse files Browse the repository at this point in the history
minor Preferences fixes
  • Loading branch information
daschuer authored Dec 6, 2023
2 parents 9eda4c3 + 8668d92 commit 8df57b3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/controllers/legacycontrollermappingfilehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ QFileInfo findScriptFile(std::shared_ptr<LegacyControllerMapping> mapping,
// static
std::shared_ptr<LegacyControllerMapping> LegacyControllerMappingFileHandler::loadMapping(
const QFileInfo& mappingFile, const QDir& systemMappingsPath) {
if (mappingFile.path().isEmpty()) {
return nullptr;
}
if (!mappingFile.exists() || !mappingFile.isReadable()) {
qDebug() << "Mapping" << mappingFile.absoluteFilePath()
<< "does not exist or is unreadable.";
Expand Down
16 changes: 9 additions & 7 deletions src/preferences/dialog/dlgprefmixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ void DlgPrefMixer::slotResetToDefaults() {
EngineXfader::kTransformMax - EngineXfader::kTransformMin + 1,
SliderXFader->minimum(),
SliderXFader->maximum());
SliderXFader->setValue(static_cast<int>(sliderVal));
SliderXFader->setValue(static_cast<int>(std::round(sliderVal)));

m_xFaderMode = MIXXX_XFADER_ADDITIVE;
radioButtonAdditive->setChecked(true);
Expand Down Expand Up @@ -730,7 +730,7 @@ void DlgPrefMixer::slotUpdate() {
EngineXfader::kTransformMax - EngineXfader::kTransformMin + 1,
SliderXFader->minimum(),
SliderXFader->maximum());
SliderXFader->setValue(static_cast<int>(sliderVal + 0.5));
SliderXFader->setValue(static_cast<int>(std::round(sliderVal)));

m_xFaderMode = m_pConfig->getValueString(kXfaderModeKey).toInt();
if (m_xFaderMode == MIXXX_XFADER_CONSTPWR) {
Expand Down Expand Up @@ -905,12 +905,14 @@ void DlgPrefMixer::slotUpdateXFader() {

// m_transform is in the range of 1 to 1000 while 50 % slider results
// to ~2, which represents a medium rounded fader curve.
m_transform = RescalerUtils::linearToOneByX(
SliderXFader->value(),
SliderXFader->minimum(),
SliderXFader->maximum(),
EngineXfader::kTransformMax) -
double transform = RescalerUtils::linearToOneByX(
SliderXFader->value(),
SliderXFader->minimum(),
SliderXFader->maximum(),
EngineXfader::kTransformMax) -
1 + EngineXfader::kTransformMin;
// Round to 4 decimal places to avoid round-trip offsets with default 1.0
m_transform = std::round(transform * 10000) / 10000;
m_cal = EngineXfader::getPowerCalibration(m_transform);

drawXfaderDisplay();
Expand Down
11 changes: 4 additions & 7 deletions src/preferences/dialog/dlgprefmixerdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,20 @@
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
<number>100000</number>
</property>
<property name="singleStep">
<number>1</number>
<number>1000</number>
</property>
<property name="pageStep">
<number>1</number>
<number>1000</number>
</property>
<property name="value">
<number>50</number>
<number>50000</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickInterval">
<number>5</number>
</property>
</widget>
</item>
<item>
Expand Down

0 comments on commit 8df57b3

Please sign in to comment.