mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 00:34:59 +01:00
temporal: add TempoMap::{max,min}_notes_per_minute() API
This commit is contained in:
parent
cda0d6ce9f
commit
0266d98a3b
2 changed files with 35 additions and 0 deletions
|
|
@ -4756,6 +4756,38 @@ TempoMap::map_assert (bool expr, char const * exprstr, char const * file, int li
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
TempoMap::max_notes_per_minute() const
|
||||||
|
{
|
||||||
|
double npm = 0;
|
||||||
|
for (auto const & t : _tempos) {
|
||||||
|
if (t.note_types_per_minute() > npm) {
|
||||||
|
npm = t.note_types_per_minute();
|
||||||
|
}
|
||||||
|
if (t.end_note_types_per_minute() > npm) {
|
||||||
|
npm = t.end_note_types_per_minute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return npm;
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
TempoMap::min_notes_per_minute() const
|
||||||
|
{
|
||||||
|
double npm = std::numeric_limits<double>::max();
|
||||||
|
|
||||||
|
for (auto const & t : _tempos) {
|
||||||
|
if (t.note_types_per_minute() < npm) {
|
||||||
|
npm = t.note_types_per_minute();
|
||||||
|
}
|
||||||
|
if (t.end_note_types_per_minute() < npm) {
|
||||||
|
npm = t.end_note_types_per_minute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return npm;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -948,6 +948,9 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
|
||||||
LIBTEMPORAL_API TempoPoint const& tempo_at (Beats const & b) const { return _tempo_at (b, Point::beat_comparator()); }
|
LIBTEMPORAL_API TempoPoint const& tempo_at (Beats const & b) const { return _tempo_at (b, Point::beat_comparator()); }
|
||||||
LIBTEMPORAL_API TempoPoint const& tempo_at (BBT_Argument const & bbt) const { return _tempo_at (bbt, Point::bbt_comparator()); }
|
LIBTEMPORAL_API TempoPoint const& tempo_at (BBT_Argument const & bbt) const { return _tempo_at (bbt, Point::bbt_comparator()); }
|
||||||
|
|
||||||
|
LIBTEMPORAL_API double max_notes_per_minute() const;
|
||||||
|
LIBTEMPORAL_API double min_notes_per_minute() const;
|
||||||
|
|
||||||
/* convenience function that hides some complexities behind fetching
|
/* convenience function that hides some complexities behind fetching
|
||||||
* the bpm at position
|
* the bpm at position
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue