summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-12-12 14:00:44 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-12-12 14:00:44 +0000
commit4a0c798242dec33e83eb4f5bfad728c1b7c1053d (patch)
tree09875ce19dac9c5f5533b5f282f89c6147a40b16 /libs
parenta107b95307658af9f881e453362c1388ffac2463 (diff)
fundamentally alter how we compute frames_per_beat(). this follows much discussion on IRC. fundamentally, tempo and ONLY tempo affects the computation of frames_per_beat(), meter has no effect at all. However, following typical DAW conventions, we continue to want the "grid" to show metric divisions, not fixed beats, so add a new method (Meter::frames_per_division()) that retains the old math which takes meter into account. This commit will alter the behaviour of MIDI notes in any session with multiple time signatures. They will likely break. Unfortunately, there is no alternative to this breakage at this time.
git-svn-id: svn://localhost/ardour2/branches/3.0@10988 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/tempo.h1
-rw-r--r--libs/ardour/tempo.cc12
2 files changed, 10 insertions, 3 deletions
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h
index 05d65602cf..631b709a28 100644
--- a/libs/ardour/ardour/tempo.h
+++ b/libs/ardour/ardour/tempo.h
@@ -61,6 +61,7 @@ class Meter {
double note_divisor() const { return _note_type; }
double frames_per_bar (const Tempo&, framecnt_t sr) const;
+ double frames_per_division (const Tempo&, framecnt_t sr) const;
protected:
/** The number of beats in a bar. This is a real value because
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index dc811aff83..3231e56327 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -47,7 +47,7 @@ Tempo TempoMap::_default_tempo (120.0);
double Tempo::frames_per_beat (framecnt_t sr, const Meter& meter) const
{
- return ((60.0 * sr) / (_beats_per_minute * meter.note_divisor()/_note_type));
+ return (60.0 * sr) / _beats_per_minute;
}
/***********************************************************************/
@@ -58,6 +58,12 @@ Meter::frames_per_bar (const Tempo& tempo, framecnt_t sr) const
return ((60.0 * sr * _beats_per_bar) / (tempo.beats_per_minute() * _note_type/tempo.note_type()));
}
+double
+Meter::frames_per_division (const Tempo& tempo, framecnt_t sr) const
+{
+ return ((60.0 * sr) / (tempo.beats_per_minute() * _note_type/tempo.note_type()));
+}
+
/***********************************************************************/
const string TempoSection::xml_state_node_name = "Tempo";
@@ -1402,7 +1408,7 @@ TempoMap::get_points (framepos_t lower, framepos_t upper) const
beats_per_bar = meter->beats_per_bar ();
frames_per_bar = meter->frames_per_bar (*tempo, _frame_rate);
- beat_frames = tempo->frames_per_beat (_frame_rate, *meter);
+ beat_frames = meter->frames_per_division (*tempo,_frame_rate);
if (meter->frame() > tempo->frame()) {
bar = meter->start().bars;
@@ -1530,7 +1536,7 @@ TempoMap::get_points (framepos_t lower, framepos_t upper) const
beats_per_bar = meter->beats_per_bar ();
frames_per_bar = meter->frames_per_bar (*tempo, _frame_rate);
- beat_frames = tempo->frames_per_beat (_frame_rate, *meter);
+ beat_frames = meter->frames_per_division (*tempo, _frame_rate);
++i;
}