Skip to content

Commit

Permalink
- 0phase fixing automation curve rescaling over tempo changes...
Browse files Browse the repository at this point in the history
  • Loading branch information
rncbc committed Nov 17, 2023
1 parent a497104 commit 25565d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/qtractorTimeScaleCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bool qtractorTimeScaleNodeCommand::addNode (void)

const bool bRedoCurveEditCommands = m_curveEditCommands.isEmpty();
if (bRedoCurveEditCommands) {
addCurveEditCommands(pNode, fNewTempo, fOldTempo);
addCurveEditCommands(pNode->frame, fNewTempo, fOldTempo);
} else {
QListIterator<qtractorCurveEditCommand *> undos(m_curveEditCommands);
while (undos.hasNext())
Expand Down Expand Up @@ -190,7 +190,7 @@ bool qtractorTimeScaleNodeCommand::updateNode (void)

const bool bRedoCurveEditCommands = m_curveEditCommands.isEmpty();
if (bRedoCurveEditCommands) {
addCurveEditCommands(pNode, fNewTempo, fOldTempo);
addCurveEditCommands(pNode->frame, fNewTempo, fOldTempo);
} else {
QListIterator<qtractorCurveEditCommand *> undos(m_curveEditCommands);
while (undos.hasNext())
Expand Down Expand Up @@ -281,7 +281,7 @@ bool qtractorTimeScaleNodeCommand::removeNode (void)

const bool bRedoCurveEditCommands = m_curveEditCommands.isEmpty();
if (bRedoCurveEditCommands) {
addCurveEditCommands(pNode, fNewTempo, fOldTempo);
addCurveEditCommands(pNode->frame, fNewTempo, fOldTempo);
} else {
QListIterator<qtractorCurveEditCommand *> undos(m_curveEditCommands);
while (undos.hasNext())
Expand Down Expand Up @@ -384,18 +384,16 @@ qtractorClipCommand *qtractorTimeScaleNodeCommand::createClipCommand (

// Automation curve time-stretching command (static).
void qtractorTimeScaleNodeCommand::addCurveEditCommands (
qtractorTimeScale::Node *pNode, float fNewTempo, float fOldTempo )
unsigned long iFrame, float fNewTempo, float fOldTempo )
{
if (pNode == nullptr)
return;
if (fNewTempo == fOldTempo)
if (qAbs(fNewTempo - fOldTempo) < 0.01f)
return;

qtractorSession *pSession = qtractorSession::getInstance();
if (pSession == nullptr)
return;

const unsigned long iFrameStart = pNode->frame;
const unsigned long iFrameStart = iFrame;
const float fFactor = (fOldTempo / fNewTempo);
const bool bReverse = (fOldTempo > fNewTempo);

Expand Down
2 changes: 1 addition & 1 deletion src/qtractorTimeScaleCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class qtractorTimeScaleNodeCommand : public qtractorCommand

// Automation curve time-stretching command (static).
void addCurveEditCommands(
qtractorTimeScale::Node *pNode, float fOldTempo, float fNewTempo);
unsigned long iFrame, float fOldTempo, float fNewTempo);

private:

Expand Down

0 comments on commit 25565d9

Please sign in to comment.