temporal: add TempoMap::{max,min}_notes_per_minute() API
This commit is contained in:
parent
cda0d6ce9f
commit
0266d98a3b
@ -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
|
||||
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 (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
|
||||
* the bpm at position
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user