diff --git a/include/Song.h b/include/Song.h index 569b3ad14af..eacd2114fdd 100644 --- a/include/Song.h +++ b/include/Song.h @@ -283,7 +283,6 @@ class LMMS_EXPORT Song : public TrackContainer bpm_t getTempo(); - AutomationClip * tempoAutomationClip() override; AutomationTrack * globalAutomationTrack() { @@ -352,6 +351,11 @@ class LMMS_EXPORT Song : public TrackContainer return m_timeSigModel; } + IntModel& tempoModel() + { + return m_tempoModel; + } + void exportProjectMidi(QString const & exportFileName) const; inline void setLoadOnLaunch(bool value) { m_loadOnLaunch = value; } diff --git a/include/TrackContainer.h b/include/TrackContainer.h index d947094f7cd..ca9964e300a 100644 --- a/include/TrackContainer.h +++ b/include/TrackContainer.h @@ -63,12 +63,6 @@ class LMMS_EXPORT TrackContainer : public Model, public JournallingObject void loadSettings( const QDomElement & _this ) override; - - virtual AutomationClip * tempoAutomationClip() - { - return nullptr; - } - int countTracks( Track::TrackTypes _tt = Track::NumTrackTypes ) const; diff --git a/plugins/MidiImport/MidiImport.cpp b/plugins/MidiImport/MidiImport.cpp index 6a0314966d9..6836060f3fa 100644 --- a/plugins/MidiImport/MidiImport.cpp +++ b/plugins/MidiImport/MidiImport.cpp @@ -358,7 +358,11 @@ bool MidiImport::readSMF( TrackContainer* tc ) pd.setValue( 2 ); // Tempo stuff - AutomationClip * tap = tc->tempoAutomationClip(); + auto tt = dynamic_cast(Track::create(Track::AutomationTrack, Engine::getSong())); + tt->setName(tr("Tempo")); + auto tap = new AutomationClip(tt); + tap->setDisplayName(tr("Tempo")); + tap->addObject(&Engine::getSong()->tempoModel()); if( tap ) { tap->clear(); diff --git a/src/core/Song.cpp b/src/core/Song.cpp index ab4ac940bd7..82388268f7b 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -837,14 +837,6 @@ bpm_t Song::getTempo() } - - -AutomationClip * Song::tempoAutomationClip() -{ - return AutomationClip::globalAutomationClip( &m_tempoModel ); -} - - AutomatedValueMap Song::automatedValuesAt(TimePos time, int clipNum) const { return TrackContainer::automatedValuesFromTracks(TrackList{m_globalAutomationTrack} << tracks(), time, clipNum);