Skip to content

Commit 08010eb

Browse files
author
Milkii Brewster
committed
Add control for playback marker horizontal position
Implements control for adjusting the horizontal position of the playback marker/line over waveforms. - Adds [Waveform],PlayMarkerPosition control (0.0 = left, 1.0 = right) - Creates ControlPotmeter for smooth value adjustment - Exposes control in controller picker menu for MIDI/HID mapping - Adds tooltip for the control - Preserves existing playback marker position functionality Fixes #14288
1 parent 14f3cca commit 08010eb

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/controllers/controlpickermenu.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,11 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
15631563
tr("Reset the waveform zoom level to the default value selected in "
15641564
"Preferences -> Waveforms"),
15651565
pGuiMenu);
1566+
addControl("[Waveform]",
1567+
"play_marker_position",
1568+
tr("Playback Marker Position"),
1569+
tr("Adjust the position of the playback marker on the waveforms"),
1570+
pGuiMenu);
15661571

15671572
pGuiMenu->addSeparator();
15681573

src/skin/legacy/tooltips.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ void Tooltips::addStandardTooltips() {
7373
<< tr("Waveform Zoom")
7474
<< QString("%1").arg(resetToDefault);
7575

76+
add("[Waveform],play_marker_position")
77+
<< tr("Playback Marker Position")
78+
<< tr("Adjust the position of the playback marker on the waveforms.");
79+
7680
add("spinny")
7781
<< tr("Spinning Vinyl")
7882
<< tr("Rotates during playback and shows the position of a track.")

src/waveform/waveformwidgetfactory.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "waveform/waveformwidgetfactory.h"
22

3+
#include "control/controlpotmeter.h"
34
#include "waveform/renderers/waveformrendererabstract.h"
45
#include "waveform/waveform.h"
56

@@ -440,6 +441,21 @@ bool WaveformWidgetFactory::setConfig(UserSettingsPointer config) {
440441
WaveformWidgetRenderer::s_defaultPlayMarkerPosition);
441442
setPlayMarkerPosition(m_playMarkerPosition);
442443

444+
// Create control for playback marker position (0.0 = left, 1.0 = right)
445+
if (!m_pPlayMarkerPositionCO) {
446+
m_pPlayMarkerPositionCO = std::make_unique<ControlPotmeter>(
447+
ConfigKey(kWaveformGroup, QStringLiteral("play_marker_position")),
448+
0.0,
449+
1.0);
450+
connect(m_pPlayMarkerPositionCO.get(),
451+
&ControlObject::valueChanged,
452+
this,
453+
[this](double value) {
454+
setPlayMarkerPosition(value);
455+
});
456+
}
457+
m_pPlayMarkerPositionCO->set(m_playMarkerPosition);
458+
443459
int untilMarkShowBeats =
444460
m_config->getValueString(
445461
ConfigKey(kWaveformGroup, QStringLiteral("UntilMarkShowBeats")))
@@ -801,6 +817,9 @@ void WaveformWidgetFactory::setPlayMarkerPosition(double position) {
801817
m_config->setValue(ConfigKey(kWaveformGroup, QStringLiteral("PlayMarkerPosition")),
802818
m_playMarkerPosition);
803819
}
820+
if (m_pPlayMarkerPositionCO) {
821+
m_pPlayMarkerPositionCO->set(m_playMarkerPosition);
822+
}
804823

805824
for (const auto& holder : std::as_const(m_waveformWidgetHolders)) {
806825
holder.m_waveformWidget->setPlayMarkerPosition(m_playMarkerPosition);

src/waveform/waveformwidgetfactory.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class WWaveformViewer;
2121
class WaveformWidgetAbstract;
2222
class VSyncThread;
2323
class GuiTick;
24+
class ControlPotmeter;
2425
class VisualsManager;
2526
class ControlObject;
2627

@@ -377,4 +378,5 @@ class WaveformWidgetFactory : public QObject,
377378
double m_actualFrameRate;
378379
int m_vSyncType;
379380
double m_playMarkerPosition;
381+
std::unique_ptr<ControlPotmeter> m_pPlayMarkerPositionCO;
380382
};

0 commit comments

Comments
 (0)