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

Multi Preview Fix #3382

Merged
merged 21 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
58310ee
Only allow one previewing hotcue at the time. This is required for a …
daschuer Nov 20, 2020
5fd6d41
discard cued seek action after a new track has been loaded
daschuer Nov 21, 2020
10f9e9d
Remove redundant handling of the Main cue
daschuer Nov 21, 2020
9f1b93c
Improve locking
daschuer Nov 21, 2020
8b0614d
Add function overload to createAndAddCue() to initalize the cue as well
daschuer Nov 29, 2020
3e6775a
Add Cue::setStartAndEndPosition() for setting both under one locking …
daschuer Nov 29, 2020
39ff078
Create and initalize Cues at once to avoid sending singlas with halve…
daschuer Nov 29, 2020
7159a99
get rid of hotCueFound
daschuer Nov 29, 2020
234f90b
remove now unused createAndAddCue() that creates an invalid Cue
daschuer Nov 29, 2020
c38fd68
Remove unused Cue() default constructor
daschuer Nov 29, 2020
15e10bb
make m_iHotCue const
daschuer Nov 29, 2020
2d75861
Added getStartAndEndPosition() to query both in one locking scope.
daschuer Nov 29, 2020
ffcb727
Use getStartAndEndPosition() to be sure the two values match.
daschuer Nov 29, 2020
ad7a2b2
Improve API for storing of the inital preview state.
daschuer Nov 29, 2020
d72f2b4
fix typos
daschuer Dec 16, 2020
bac1956
Merge remote-tracking branch 'upstream/main' into hotcue_focus_off_by…
daschuer Dec 16, 2020
90342c4
Make a local copy of m_pCurrentSavedLoopControl to make sur it doe no…
daschuer Dec 16, 2020
512573d
rename storePreviewingActivateData() to cachePreviewingStartState() a…
daschuer Dec 16, 2020
58f9939
Reorder member variables
daschuer Dec 16, 2020
4114b16
swap if else logic
daschuer Dec 16, 2020
ad9bddb
narrow locking scope
daschuer Dec 16, 2020
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
Prev Previous commit
Next Next commit
Improve API for storing of the inital preview state.
  • Loading branch information
daschuer committed Nov 29, 2020
commit ad7a2b2439ba07ab2d7ae925e712b1248944db11
24 changes: 12 additions & 12 deletions src/engine/controls/cuecontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,18 +1008,17 @@ void CueControl::hotcueActivate(HotcueControl* pControl, double value, HotcueSet

void CueControl::hotcueActivatePreview(HotcueControl* pControl, double value) {
CuePointer pCue = pControl->getCue();
int index = pControl->getHotcueIndex();
if (value > 0) {
if (pCue) {
double position = pCue->getPosition();
mixxx::CueType type = pCue->getType();
int index = pControl->getHotcueIndex();
if (m_currentlyPreviewingIndex != index) {
pControl->storePreviewingActivateData();
double position = pControl->getPreviewingPosition();
mixxx::CueType type = pControl->getPreviewingType();
;
if (type != mixxx::CueType::Invalid &&
position != Cue::kNoPosition &&
m_currentlyPreviewingIndex != index) {
position != Cue::kNoPosition) {
updateCurrentlyPreviewingIndex(index);
m_bypassCueSetByPlay = true;
pControl->setPreviewingType(type);
pControl->setPreviewingPosition(position);
if (type == mixxx::CueType::Loop) {
setCurrentSavedLoopControlAndActivate(pControl);
} else if (pControl->getStatus() == HotcueControl::Status::Set) {
Expand All @@ -1029,7 +1028,7 @@ void CueControl::hotcueActivatePreview(HotcueControl* pControl, double value) {
m_pPlay->set(1.0);
}
}
} else if (m_currentlyPreviewingIndex == pControl->getHotcueIndex()) {
} else if (m_currentlyPreviewingIndex == index) {
// This is a release of a previewing hotcue
double position = pControl->getPreviewingPosition();
updateCurrentlyPreviewingIndex(Cue::kNoHotCue);
Expand Down Expand Up @@ -2169,9 +2168,7 @@ ConfigKey HotcueControl::keyForControl(const QString& name) {
HotcueControl::HotcueControl(const QString& group, int hotcueIndex)
: m_group(group),
m_hotcueIndex(hotcueIndex),
m_pCue(nullptr),
m_previewingType(mixxx::CueType::Invalid),
m_previewingPosition(-1) {
m_pCue(nullptr) {
m_hotcuePosition = std::make_unique<ControlObject>(keyForControl(QStringLiteral("position")));
connect(m_hotcuePosition.get(),
&ControlObject::valueChanged,
Expand Down Expand Up @@ -2310,6 +2307,9 @@ HotcueControl::HotcueControl(const QString& group, int hotcueIndex)
this,
&HotcueControl::slotHotcueClear,
Qt::DirectConnection);

m_previewingType.setValue(mixxx::CueType::Invalid);
m_previewingPosition.setValue(Cue::kNoPosition);
}

HotcueControl::~HotcueControl() = default;
Expand Down
20 changes: 11 additions & 9 deletions src/engine/controls/cuecontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,18 @@ class HotcueControl : public QObject {
// Used for caching the preview state of this hotcue control
// for the case the cue is deleted during preview.
mixxx::CueType getPreviewingType() const {
return m_previewingType;
}
void setPreviewingType(mixxx::CueType type) {
m_previewingType = type;
return m_previewingType.getValue();
}
double getPreviewingPosition() const {
return m_previewingPosition;
return m_previewingPosition.getValue();
}
void setPreviewingPosition(double position) {
m_previewingPosition = position;
void storePreviewingActivateData() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the function does not tell me what it is actually doing. What is "activate data"?

if (m_pCue) {
m_previewingPosition.setValue(m_pCue->getPosition());
m_previewingType.setValue(m_pCue->getType());
} else {
m_previewingType.setValue(mixxx::CueType::Invalid);
}
}

private slots:
Expand Down Expand Up @@ -176,8 +178,8 @@ class HotcueControl : public QObject {
std::unique_ptr<ControlPushButton> m_hotcueActivatePreview;
std::unique_ptr<ControlPushButton> m_hotcueClear;

mixxx::CueType m_previewingType;
double m_previewingPosition;
ControlValueAtomic<mixxx::CueType> m_previewingType;
ControlValueAtomic<double> m_previewingPosition;
};

class CueControl : public EngineControl {
Expand Down