From bdbc4a4f6ec9b8a76eb607033230c8f6d340a96d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 7 Jun 2014 18:35:37 +0200 Subject: [PATCH] remove some 1920 tick constants and leave notes for some others. --- gtk2_ardour/automation_line.cc | 6 ++++-- gtk2_ardour/quantize_dialog.cc | 2 +- libs/evoral/evoral/SMF.hpp | 1 + libs/evoral/evoral/types.hpp | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index b0cc6eeea3..670083e0d4 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -537,7 +537,8 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e) const framepos_t pos = e.pixel_to_sample(before_x); const Meter& meter = map.meter_at (pos); - const framecnt_t len = ceil(meter.frames_per_bar (map.tempo_at (pos), e.session()->frame_rate()) / 1920.0 / meter.divisions_per_bar()); + const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at (pos), e.session()->frame_rate()) + / (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()) ); const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len); before_x += one_tick_in_pixels; @@ -552,7 +553,8 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e) const framepos_t pos = e.pixel_to_sample(after_x); const Meter& meter = map.meter_at (pos); - const framecnt_t len = ceil(meter.frames_per_bar (map.tempo_at (pos), e.session()->frame_rate()) / 1920.0 / meter.divisions_per_bar()); + const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at (pos), e.session()->frame_rate()) + / (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar())); const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len); after_x -= one_tick_in_pixels; diff --git a/gtk2_ardour/quantize_dialog.cc b/gtk2_ardour/quantize_dialog.cc index 9cd3e23a9e..5e46981668 100644 --- a/gtk2_ardour/quantize_dialog.cc +++ b/gtk2_ardour/quantize_dialog.cc @@ -57,7 +57,7 @@ QuantizeDialog::QuantizeDialog (PublicEditor& e) , swing_adjustment (100.0, -130.0, 130.0, 1.0, 10.0) , swing_spinner (swing_adjustment) , swing_button (_("Swing")) - , threshold_adjustment (0.0, -1920.0, 1920.0, 1.0, 10.0) // XXX MAGIC TICK NUMBER FIX ME + , threshold_adjustment (0.0, -Timecode::BBT_Time::ticks_per_beat, Timecode::BBT_Time::ticks_per_beat, 1.0, 10.0) , threshold_spinner (threshold_adjustment) , threshold_label (_("Threshold (ticks)")) , snap_start_button (_("Snap note start")) diff --git a/libs/evoral/evoral/SMF.hpp b/libs/evoral/evoral/SMF.hpp index fe81b8f044..5b04e277b9 100644 --- a/libs/evoral/evoral/SMF.hpp +++ b/libs/evoral/evoral/SMF.hpp @@ -54,6 +54,7 @@ public: static bool test(const std::string& path); int open(const std::string& path, int track=1) THROW_FILE_ERROR; + // XXX 19200 = 10 * Timecode::BBT_Time::ticks_per_beat int create(const std::string& path, int track=1, uint16_t ppqn=19200) THROW_FILE_ERROR; void close() THROW_FILE_ERROR; diff --git a/libs/evoral/evoral/types.hpp b/libs/evoral/evoral/types.hpp index 7259a5c0de..b642fba4c2 100644 --- a/libs/evoral/evoral/types.hpp +++ b/libs/evoral/evoral/types.hpp @@ -42,7 +42,8 @@ const MusicalTime MaxMusicalTime = DBL_MAX; const MusicalTime MinMusicalTime = DBL_MIN; static inline bool musical_time_equal (MusicalTime a, MusicalTime b) { - /* acceptable tolerance is 1 tick. Nice if there was no magic number here */ + /* acceptable tolerance is 1 tick. Nice if there was no magic number here + * -> Timecode::BBT_Time::ticks_per_beat */ return fabs (a - b) <= (1.0/1920.0); }