Skip to content

Commit

Permalink
- Fixed initial session tempo override when importing
Browse files Browse the repository at this point in the history
  a standard MIDI file (as reported on issue #230).
  • Loading branch information
rncbc committed Oct 4, 2019
1 parent 87170d5 commit cb72c22
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ ChangeLog

GIT HEAD

- Fixed initial session tempo override when importing
a standard MIDI file (as reported on issue #230).

- An alternate time-signature/meter option is being
served to the MIDI clip editor (aka. piano-roll)
and allowing for some poly-rythm/meter scenarios
Expand Down
7 changes: 3 additions & 4 deletions src/qtractorMainForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7511,7 +7511,7 @@ void qtractorMainForm::fastTimerSlot (void)
updateTransportTime(iPlayHead);
m_pThumbView->updateThumb();
}
// Ensure the amin form is stable later on...
// Ensure the main form is stable later on...
++m_iStabilizeTimer;
// Done with transport tricks.
}
Expand Down Expand Up @@ -8627,9 +8627,8 @@ void qtractorMainForm::contentsChanged (void)
qDebug("qtractorMainForm::contentsChanged()");
#endif

// HACK: Force play-head position update...
// m_iPlayHead = 0;
m_pTempoCursor->clear();
// HACK: Force immediate stabilization later...
m_iStabilizeTimer = 0;

// Stabilize session toolbar widgets...
// m_pTempoSpinBox->setTempo(m_pSession->tempo(), false);
Expand Down
2 changes: 1 addition & 1 deletion src/qtractorMidiClip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ bool qtractorMidiClip::openMidiFile (
qtractorMidiFileTempo *pTempoMap = m_pFile->tempoMap();
if (pTempoMap) {
pTempoMap->intoTimeScale(pSession->timeScale(), t0);
pSession->updateTimeScale();
pSession->updateTimeScaleEx();
}
// Reset session flag now.
m_bSessionFlag = false;
Expand Down
10 changes: 10 additions & 0 deletions src/qtractorMidiFileTempo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,16 @@ void qtractorMidiFileTempo::intoTimeScale (

// Copy tempo-map nodes...
qtractorMidiFileTempo::Node *pNode = m_nodes.first();

// Very first node is kinda special...
if (pNode) {
pTimeScale->setTempo(pNode->tempo);
pTimeScale->setBeatsPerBar(pNode->beatsPerBar);
pTimeScale->setBeatDivisor(pNode->beatDivisor);
pNode = pNode->next();
}

// Now for all the rest...
while (pNode) {
const unsigned long iTime = uint64_t(pNode->tick) * p / q;
pTimeScale->addNode(
Expand Down
9 changes: 9 additions & 0 deletions src/qtractorSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,15 @@ void qtractorSession::updateTimeScale (void)
}


void qtractorSession::updateTimeScaleEx (void)
{
updateTimeScale();

if (m_pAudioEngine)
m_pAudioEngine->resetTimebase();
}


// Update time resolution divisor factors.
void qtractorSession::updateTimeResolution (void)
{
Expand Down
1 change: 1 addition & 0 deletions src/qtractorSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class qtractorSession

// Update time scale divisor factors.
void updateTimeScale();
void updateTimeScaleEx();

// Update time resolution divisor factors.
void updateTimeResolution();
Expand Down

0 comments on commit cb72c22

Please sign in to comment.