|
|
|
@ -15,43 +15,68 @@ public:
|
|
|
|
|
virtual void draw() const = 0;
|
|
|
|
|
virtual void recalculate(const microsec& timestamp) = 0;
|
|
|
|
|
|
|
|
|
|
inline void setBPMSections(const std::set<BPMSection, BPMSectionCompt>& sections) noexcept
|
|
|
|
|
void setBPMSections(const std::set<BPMSection, BPMSectionCompt>& sections) noexcept
|
|
|
|
|
{
|
|
|
|
|
_bpm_sections = sections;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void setBPMSections(std::set<BPMSection, BPMSectionCompt>&& sections) noexcept
|
|
|
|
|
void setBPMSections(std::set<BPMSection, BPMSectionCompt>&& sections) noexcept
|
|
|
|
|
{
|
|
|
|
|
_bpm_sections = std::move(sections);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void insertBPMSection(const BPMSection& section)
|
|
|
|
|
bool insertBPMSection(const BPMSection& section)
|
|
|
|
|
{
|
|
|
|
|
_bpm_sections.insert(section);
|
|
|
|
|
return _bpm_sections.insert(section).second;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void insertBPMSection(BPMSection&& section)
|
|
|
|
|
bool insertBPMSection(BPMSection&& section)
|
|
|
|
|
{
|
|
|
|
|
_bpm_sections.insert(std::move(section));
|
|
|
|
|
return _bpm_sections.insert(std::move(section)).second;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*void removeBPMSectionAt(const microsec& offset)
|
|
|
|
|
bool removeBPMSectionAt(const microsec& offset)
|
|
|
|
|
{
|
|
|
|
|
const auto section_it = std::find_if(_bpm_sections.rbegin(), _bpm_sections.rend(),
|
|
|
|
|
[offset](const auto& section)
|
|
|
|
|
{
|
|
|
|
|
return section.start_offset < offset;
|
|
|
|
|
});
|
|
|
|
|
auto section_it = std::find_if(_bpm_sections.rbegin(), _bpm_sections.rend(),
|
|
|
|
|
[offset](const auto& section)
|
|
|
|
|
{
|
|
|
|
|
return section.offset_start < offset;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (section_it != _bpm_sections.rend())
|
|
|
|
|
_bpm_sections.erase((section_it + 1).base());
|
|
|
|
|
}*/
|
|
|
|
|
{
|
|
|
|
|
++section_it;
|
|
|
|
|
_bpm_sections.erase(section_it.base());
|
|
|
|
|
|
|
|
|
|
inline void clearBPMSections() noexcept
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BPMSection getBPMSectionAt(const microsec& offset) const
|
|
|
|
|
{
|
|
|
|
|
auto section_it = std::find_if(_bpm_sections.rbegin(), _bpm_sections.rend(),
|
|
|
|
|
[offset](const auto& section)
|
|
|
|
|
{
|
|
|
|
|
return section.offset_start < offset;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (section_it != _bpm_sections.rend())
|
|
|
|
|
{
|
|
|
|
|
++section_it;
|
|
|
|
|
return *section_it.base();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return BPMSection();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void clearBPMSections() noexcept
|
|
|
|
|
{
|
|
|
|
|
_bpm_sections.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
std::set<BPMSection, BPMSectionCompt> _bpm_sections;
|
|
|
|
|
std::set<microsec> _ticks;
|
|
|
|
|
};
|
|
|
|
|