Skip to content

Commit

Permalink
add halve/double controls for beatjump size
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Sep 7, 2021
1 parent 169cd3e commit 7a0e794
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/engine/controls/loopingcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@ LoopingControl::LoopingControl(const QString& group,
this, &LoopingControl::slotBeatJump, Qt::DirectConnection);
m_pCOBeatJumpSize = new ControlObject(ConfigKey(group, "beatjump_size"),
true, false, false, 4.0);

m_pCOBeatJumpSizeHalve = new ControlPushButton(ConfigKey(group, "beatjump_size_halve"));
connect(m_pCOBeatJumpSizeHalve,
&ControlObject::valueChanged,
this,
&LoopingControl::slotBeatJumpSizeHalve);
m_pCOBeatJumpSizeDouble = new ControlPushButton(ConfigKey(group, "beatjump_size_double"));
connect(m_pCOBeatJumpSizeDouble,
&ControlObject::valueChanged,
this,
&LoopingControl::slotBeatJumpSizeDouble);

m_pCOBeatJumpForward = new ControlPushButton(ConfigKey(group, "beatjump_forward"));
connect(m_pCOBeatJumpForward, &ControlObject::valueChanged,
this, &LoopingControl::slotBeatJumpForward);
Expand Down Expand Up @@ -1431,6 +1443,18 @@ void LoopingControl::slotBeatJump(double beats) {
}
}

void LoopingControl::slotBeatJumpSizeHalve(double pressed) {
if (pressed != 0) {
m_pCOBeatJumpSize->set(m_pCOBeatJumpSize->get() / 2);
}
}

void LoopingControl::slotBeatJumpSizeDouble(double pressed) {
if (pressed != 0) {
m_pCOBeatJumpSize->set(m_pCOBeatJumpSize->get() * 2);
}
}

void LoopingControl::slotBeatJumpForward(double pressed) {
if (pressed != 0) {
slotBeatJump(m_pCOBeatJumpSize->get());
Expand Down
4 changes: 4 additions & 0 deletions src/engine/controls/loopingcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class LoopingControl : public EngineControl {

// Jump forward or backward by beats.
void slotBeatJump(double beats);
void slotBeatJumpSizeHalve(double pressed);
void slotBeatJumpSizeDouble(double pressed);
void slotBeatJumpForward(double pressed);
void slotBeatJumpBackward(double pressed);

Expand Down Expand Up @@ -180,6 +182,8 @@ class LoopingControl : public EngineControl {

ControlObject* m_pCOBeatJump;
ControlObject* m_pCOBeatJumpSize;
ControlPushButton* m_pCOBeatJumpSizeHalve;
ControlPushButton* m_pCOBeatJumpSizeDouble;
ControlPushButton* m_pCOBeatJumpForward;
ControlPushButton* m_pCOBeatJumpBackward;
QList<BeatJumpControl*> m_beatJumps;
Expand Down

0 comments on commit 7a0e794

Please sign in to comment.