Skip to content
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

Show "passthrough" on Waveform Overviews if enabled #2575

Merged
merged 4 commits into from
Mar 31, 2020
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
28 changes: 28 additions & 0 deletions src/widget/woverview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ WOverview::WOverview(
m_group(group),
m_pConfig(pConfig),
m_endOfTrack(false),
m_bPassthroughEnabled(false),
m_pCueMenuPopup(make_parented<WCueMenuPopup>(pConfig, this)),
m_bShowCueTimes(true),
m_iPosSeconds(0),
Expand All @@ -80,6 +81,11 @@ WOverview::WOverview(
m_trackSamplesControl =
new ControlProxy(m_group, "track_samples", this);
m_playpositionControl = new ControlProxy(m_group, "playposition", this);
m_pPassthroughControl =
new ControlProxy(m_group, "passthrough", this);
m_pPassthroughControl->connectValueChanged(this, &WOverview::onPassthroughChange);
onPassthroughChange(m_pPassthroughControl->get());

setAcceptDrops(true);

setMouseTracking(true);
Expand Down Expand Up @@ -236,6 +242,12 @@ void WOverview::onConnectedControlChanged(double dParameter, double dValue) {

void WOverview::slotWaveformSummaryUpdated() {
//qDebug() << "WOverview::slotWaveformSummaryUpdated()";

// Do not draw the waveform when passthrough is enabled
if (m_bPassthroughEnabled) {
return;
}

TrackPointer pTrack(m_pCurrentTrack);
if (!pTrack) {
return;
Expand Down Expand Up @@ -342,6 +354,17 @@ void WOverview::onRateRatioChange(double v) {
update();
}

void WOverview::onPassthroughChange(double v) {
m_bPassthroughEnabled = static_cast<bool>(v);

if (!m_bPassthroughEnabled) {
slotWaveformSummaryUpdated();
}

// Always call this to trigger a repaint even if not track is loaded
update();
}

void WOverview::updateCues(const QList<CuePointer> &loadedCues) {
m_marksToRender.clear();
for (CuePointer currentCue: loadedCues) {
Expand Down Expand Up @@ -540,6 +563,11 @@ void WOverview::paintEvent(QPaintEvent* pEvent) {
painter.drawPixmap(rect(), m_backgroundPixmap);
}

if (m_bPassthroughEnabled) {
paintText(tr("Passthrough"), &painter);
return;
}

if (m_pCurrentTrack) {
// Refer to util/ScopePainter.h to understand the semantics of
// ScopePainter.
Expand Down
23 changes: 12 additions & 11 deletions src/widget/woverview.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,23 @@
#ifndef WOVERVIEW_H
#define WOVERVIEW_H

#include <QPaintEvent>
#include <QMouseEvent>
#include <QPixmap>
#include <QColor>
#include <QList>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QPixmap>

#include "analyzer/analyzerprogress.h"
#include "skin/skincontext.h"
#include "track/track.h"
#include "widget/wcuemenupopup.h"
#include "widget/trackdroptarget.h"
#include "widget/wwidget.h"

#include "util/color/color.h"
#include "util/parented_ptr.h"

#include "waveform/renderers/waveformsignalcolors.h"
#include "waveform/renderers/waveformmarkset.h"
#include "waveform/renderers/waveformmarkrange.h"
#include "skin/skincontext.h"
#include "waveform/renderers/waveformmarkset.h"
#include "waveform/renderers/waveformsignalcolors.h"
#include "widget/trackdroptarget.h"
#include "widget/wcuemenupopup.h"
#include "widget/wwidget.h"

class PlayerManager;
class PainterScope;
Expand Down Expand Up @@ -99,6 +97,7 @@ class WOverview : public WWidget, public TrackDropTarget {
void onMarkChanged(double v);
void onMarkRangeChange(double v);
void onRateRatioChange(double v);
void onPassthroughChange(double v);
void receiveCuesUpdated();

void slotWaveformSummaryUpdated();
Expand Down Expand Up @@ -133,10 +132,12 @@ class WOverview : public WWidget, public TrackDropTarget {
UserSettingsPointer m_pConfig;
ControlProxy* m_endOfTrackControl;
bool m_endOfTrack;
bool m_bPassthroughEnabled;
ControlProxy* m_pRateRatioControl;
ControlProxy* m_trackSampleRateControl;
ControlProxy* m_trackSamplesControl;
ControlProxy* m_playpositionControl;
ControlProxy* m_pPassthroughControl;

// Current active track
TrackPointer m_pCurrentTrack;
Expand Down