, ui_config (new UIConfiguration)
, gui_object_state (new GUIObjectState)
- , primary_clock (new MainClock (X_("primary"), false, X_("transport"), true, true, true, false, true))
- , secondary_clock (new MainClock (X_("secondary"), false, X_("secondary"), true, true, false, false, true))
+ , primary_clock (new MainClock (X_("primary"), X_("transport"), true ))
+ , secondary_clock (new MainClock (X_("secondary"), X_("secondary"), false))
/* big clock */
if (!_session) return;
if (editor && !editor->dragging_playhead()) {
- Clock (_session->audible_frame(), false, editor->get_preferred_edit_position()); /* EMIT_SIGNAL */
+ Clock (_session->audible_frame(), false, editor->get_preferred_edit_position (true)); /* EMIT_SIGNAL */
}
}
void
ARDOUR_UI::create_xrun_marker (framepos_t where)
{
- editor->mouse_add_new_marker (where, false, true);
+ if (_session) {
+ Location *location = new Location (*_session, where, where, _("xrun"), Location::IsMark);
+ _session->locations()->add (location);
+ }
}
void
ARDOUR_UI::update_transport_clocks (framepos_t pos)
{
if (ui_config->get_primary_clock_delta_edit_cursor()) {
- primary_clock->set (pos, false, editor->get_preferred_edit_position());
+ primary_clock->set (pos, false, editor->get_preferred_edit_position (true));
} else {
primary_clock->set (pos);
}
if (ui_config->get_secondary_clock_delta_edit_cursor()) {
- secondary_clock->set (pos, false, editor->get_preferred_edit_position());
+ secondary_clock->set (pos, false, editor->get_preferred_edit_position (true));
} else {
secondary_clock->set (pos);
}
static ARDOUR_UI *instance () { return theArdourUI; }
static UIConfiguration *config () { return theArdourUI->ui_config; }
- PublicEditor& the_editor(){return *editor;}
+ PublicEditor& the_editor() { return *editor;}
Mixer_UI* the_mixer() { return mixer; }
void new_midi_tracer_window ();
if (mode_based_info_ratio != 1.0) {
- double left_rect_width = round (((get_width() - separator_height) * mode_based_info_ratio) + 0.5);
+ double left_rect_width = get_left_rect_width();
if (_need_bg) {
if (corner_radius) {
protected:
void render (cairo_t*, cairo_rectangle_t*);
+ bool get_is_duration () const { return is_duration; } ;
virtual void build_ops_menu ();
Gtk::Menu *ops_menu;
+ bool on_button_press_event (GdkEventButton *ev);
+ bool on_button_release_event(GdkEventButton *ev);
+ bool is_lower_layout_click(int y) const {
+ return y > upper_height + separator_height;
+ }
+ bool is_right_layout_click(int x) const {
+ return x > x_leading_padding + get_left_rect_width() + separator_height;
+ }
+ double get_left_rect_width() const {
+ return round (((get_width() - separator_height) * mode_based_info_ratio) + 0.5);
+ }
private:
Mode _mode;
std::string _name;
bool on_key_press_event (GdkEventKey *);
bool on_key_release_event (GdkEventKey *);
bool on_scroll_event (GdkEventScroll *ev);
- bool on_button_press_event (GdkEventButton *ev);
- bool on_button_release_event(GdkEventButton *ev);
void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
void on_size_request (Gtk::Requisition* req);
bool on_motion_notify_event (GdkEventMotion *ev);
framepos_t where = 0;
EditPoint ep = _edit_point;
- if(Profile->get_mixbus())
+ if (Profile->get_mixbus())
if (ep == EditAtSelectedMarker)
- ep=EditAtPlayhead;
+ ep = EditAtPlayhead;
if (from_outside_canvas && (ep == EditAtMouse)) {
ep = EditAtPlayhead;
/* XXX not right but what can we do ? */
return 0;
}
- } else
+ } else {
where = _session->audible_frame();
+ }
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("GPEP: use playhead @ %1\n", where));
break;
void set_zoom_focus (Editing::ZoomFocus);
Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
framecnt_t get_current_zoom () const { return samples_per_pixel; }
- void cycle_zoom_focus ();
+ void cycle_zoom_focus ();
void temporal_zoom_step (bool coarser);
- void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
+ void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
void tav_zoom_step (bool coarser);
void tav_zoom_smooth (bool coarser, bool force_all);
void scroll_tracks_down_line ();
void scroll_tracks_up_line ();
- bool scroll_up_one_track (bool skip_child_views = false);
- bool scroll_down_one_track (bool skip_child_views = false);
+
+ bool scroll_up_one_track (bool skip_child_views = false);
+ bool scroll_down_one_track (bool skip_child_views = false);
void prepare_for_cleanup ();
void finish_cleanup ();
framepos_t& pos,
boost::shared_ptr<ARDOUR::PluginInfo> instrument = boost::shared_ptr<ARDOUR::PluginInfo>());
- void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions, bool src_comparison);
+ void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions, bool src_comparison);
void get_regionviews_by_id (PBD::ID const id, RegionSelection & regions) const;
void get_per_region_note_selection (std::list<std::pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > > >&) const;
return _drags;
}
- void maybe_autoscroll (bool, bool, bool);
- bool autoscroll_active() const;
+ void maybe_autoscroll (bool, bool, bool);
+ bool autoscroll_active() const;
Gdk::Cursor* get_canvas_cursor () const;
void metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
/* editing operations that need to be public */
- void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false);
+ void mouse_add_new_marker (framepos_t where, bool is_cd=false);
void split_regions_at (framepos_t, RegionSelection&);
void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
RegionSelection get_regions_from_selection_and_mouse (framepos_t);
+ void mouse_add_new_tempo_event (framepos_t where);
+ void mouse_add_new_meter_event (framepos_t where);
+ void edit_tempo_section (ARDOUR::TempoSection*);
+ void edit_meter_section (ARDOUR::MeterSection*);
+
protected:
void map_transport_state ();
void map_position_change (framepos_t);
void cancel_visual_state_op (uint32_t n);
framepos_t leftmost_frame;
- framecnt_t samples_per_pixel;
+ framecnt_t samples_per_pixel;
Editing::ZoomFocus zoom_focus;
void set_samples_per_pixel (framecnt_t);
*/
ArdourCanvas::Container* _drag_motion_group;
- /* a rect that sits at the bottom of all tracks to act as a drag-no-drop/clickable
+ /* a rect that sits at the bottom of all tracks to act as a drag-no-drop/clickable
* target area.
*/
- ArdourCanvas::Rectangle* _canvas_drop_zone;
- bool canvas_drop_zone_event (GdkEvent* event);
+ ArdourCanvas::Rectangle* _canvas_drop_zone;
+ bool canvas_drop_zone_event (GdkEvent* event);
enum RulerType {
ruler_metric_timecode = 0,
void update_just_timecode ();
void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
void update_fixed_rulers ();
- void update_tempo_based_rulers (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
+ void update_tempo_based_rulers (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
ARDOUR::TempoMap::BBTPointList::const_iterator& end);
void popup_ruler_menu (framepos_t where = 0, ItemType type = RegionItem);
void update_ruler_visibility ();
gint bbt_nmarks;
uint32_t bbt_bar_helper_on;
uint32_t bbt_accent_modulo;
- void compute_bbt_ruler_scale (framepos_t lower, framepos_t upper,
+ void compute_bbt_ruler_scale (framepos_t lower, framepos_t upper,
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin,
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end);
/** the adjustment that controls the overall editor vertical scroll position */
Gtk::Adjustment vertical_adjustment;
- Gtk::Adjustment horizontal_adjustment;
+ Gtk::Adjustment horizontal_adjustment;
- Gtk::Adjustment unused_adjustment; // yes, really; Gtk::Layout constructor requires refs
+ Gtk::Adjustment unused_adjustment; // yes, really; Gtk::Layout constructor requires refs
Gtk::Layout controls_layout;
bool control_layout_scroll (GdkEventScroll* ev);
void reset_controls_layout_width ();
static int _idle_visual_changer (void *arg);
int idle_visual_changer ();
- void visual_changer (const VisualChange&);
+ void visual_changer (const VisualChange&);
void ensure_visual_change_idle_handler ();
/* track views */
void register_actions ();
void register_region_actions ();
- void load_bindings ();
- Gtkmm2ext::ActionMap editor_action_map;
- Gtkmm2ext::Bindings key_bindings;
+ void load_bindings ();
+ Gtkmm2ext::ActionMap editor_action_map;
+ Gtkmm2ext::Bindings key_bindings;
/* CUT/COPY/PASTE */
boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
- void toggle_midi_input_active (bool flip_others);
+ void toggle_midi_input_active (bool flip_others);
ARDOUR::InterThreadInfo* current_interthread_info;
ArdourCanvas::Container* time_line_group;
void hide_measures ();
- void draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
+ void draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
ARDOUR::TempoMap::BBTPointList::const_iterator& end);
void new_tempo_section ();
- void mouse_add_new_tempo_event (framepos_t where);
- void mouse_add_new_meter_event (framepos_t where);
void remove_tempo_marker (ArdourCanvas::Item*);
void remove_meter_marker (ArdourCanvas::Item*);
gint real_remove_tempo_marker (ARDOUR::TempoSection*);
gint real_remove_meter_marker (ARDOUR::MeterSection*);
- void edit_tempo_section (ARDOUR::TempoSection*);
- void edit_meter_section (ARDOUR::MeterSection*);
void edit_tempo_marker (TempoMarker&);
void edit_meter_marker (MeterMarker&);
void edit_control_point (ArdourCanvas::Item*);
void remove_metric_marks ();
void draw_metric_marks (const ARDOUR::Metrics& metrics);
- void compute_current_bbt_points (framepos_t left, framepos_t right,
+ void compute_current_bbt_points (framepos_t left, framepos_t right,
ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
ARDOUR::TempoMap::BBTPointList::const_iterator& end);
ArdourDropdown visible_tracks_selector;
ArdourDropdown zoom_preset_selector;
- int32_t _visible_track_count;
- void build_track_count_menu ();
- void set_visible_track_count (int32_t);
-
- void set_zoom_preset(int64_t);
+ int32_t _visible_track_count;
+ void build_track_count_menu ();
+ void set_visible_track_count (int32_t);
+
+ void set_zoom_preset(int64_t);
Gtk::VBox toolbar_clock_vbox;
Gtk::VBox toolbar_selection_clock_vbox;
SelectionMemento* _selection_memento;
void time_selection_changed ();
- void update_time_selection_display ();
+ void update_time_selection_display ();
void track_selection_changed ();
void region_selection_changed ();
sigc::connection editor_regions_selection_changed_connection;
/* autoscrolling */
- sigc::connection autoscroll_connection;
- bool autoscroll_horizontal_allowed;
- bool autoscroll_vertical_allowed;
- uint32_t autoscroll_cnt;
- Gtk::Widget* autoscroll_widget;
- ArdourCanvas::Rect autoscroll_boundary;
+ sigc::connection autoscroll_connection;
+ bool autoscroll_horizontal_allowed;
+ bool autoscroll_vertical_allowed;
+ uint32_t autoscroll_cnt;
+ Gtk::Widget* autoscroll_widget;
+ ArdourCanvas::Rect autoscroll_boundary;
bool autoscroll_canvas ();
- void start_canvas_autoscroll (bool allow_horiz, bool allow_vert, const ArdourCanvas::Rect& boundary);
+ void start_canvas_autoscroll (bool allow_horiz, bool allow_vert, const ArdourCanvas::Rect& boundary);
void stop_canvas_autoscroll ();
/* trimming */
/* Drag-n-Drop */
int convert_drop_to_paths (
- std::vector<std::string>& paths,
- const Glib::RefPtr<Gdk::DragContext>& context,
- gint x,
- gint y,
- const Gtk::SelectionData& data,
- guint info,
- guint time);
+ std::vector<std::string>& paths,
+ const Glib::RefPtr<Gdk::DragContext>& context,
+ gint x,
+ gint y,
+ const Gtk::SelectionData& data,
+ guint info,
+ guint time);
void track_canvas_drag_data_received (
- const Glib::RefPtr<Gdk::DragContext>& context,
- gint x,
- gint y,
- const Gtk::SelectionData& data,
- guint info,
- guint time);
+ const Glib::RefPtr<Gdk::DragContext>& context,
+ gint x,
+ gint y,
+ const Gtk::SelectionData& data,
+ guint info,
+ guint time);
void drop_paths (
- const Glib::RefPtr<Gdk::DragContext>& context,
- gint x,
- gint y,
- const Gtk::SelectionData& data,
- guint info,
- guint time);
+ const Glib::RefPtr<Gdk::DragContext>& context,
+ gint x,
+ gint y,
+ const Gtk::SelectionData& data,
+ guint info,
+ guint time);
void drop_regions (
- const Glib::RefPtr<Gdk::DragContext>& context,
- gint x,
- gint y,
- const Gtk::SelectionData& data,
- guint info,
- guint time);
+ const Glib::RefPtr<Gdk::DragContext>& context,
+ gint x,
+ gint y,
+ const Gtk::SelectionData& data,
+ guint info,
+ guint time);
void drop_routes (
- const Glib::RefPtr<Gdk::DragContext>& context,
- gint x,
- gint y,
- const Gtk::SelectionData& data,
- guint info,
- guint time);
+ const Glib::RefPtr<Gdk::DragContext>& context,
+ gint x,
+ gint y,
+ const Gtk::SelectionData& data,
+ guint info,
+ guint time);
/* audio export */
void duplicate_range (bool with_dialog);
- /** computes the timeline frame (sample) of an event whose coordinates
+ /** computes the timeline frame (sample) of an event whose coordinates
* are in canvas units (pixels, scroll offset included).
*/
framepos_t canvas_event_sample (GdkEvent const *, double* px = 0, double* py = 0) const;
- /** computes the timeline frame (sample) of an event whose coordinates
+ /** computes the timeline frame (sample) of an event whose coordinates
* are in window units (pixels, no scroll offset).
*/
framepos_t window_event_sample (GdkEvent const *, double* px = 0, double* py = 0) const;
bool _following_mixer_selection;
int time_fx (ARDOUR::RegionList&, float val, bool pitching);
- void note_edit_done (int, EditNoteDialog*);
+ void note_edit_done (int, EditNoteDialog*);
void toggle_sound_midi_notes ();
/** Flag for a bit of a hack wrt control point selection; see set_selected_control_point_from_click */
}
void
-Editor::mouse_add_new_marker (framepos_t where, bool is_cd, bool is_xrun)
+Editor::mouse_add_new_marker (framepos_t where, bool is_cd)
{
- string markername, markerprefix;
+ string markername;
int flags = (is_cd ? Location::IsCDMarker|Location::IsMark : Location::IsMark);
- if (is_xrun) {
- markerprefix = "xrun";
- flags = Location::IsMark;
- } else {
- markerprefix = "mark";
- }
-
if (_session) {
- _session->locations()->next_available_name(markername, markerprefix);
- if (!is_xrun && !choose_new_marker_name(markername)) {
+ _session->locations()->next_available_name(markername, _("mark"));
+ if (!choose_new_marker_name(markername)) {
return;
}
Location *location = new Location (*_session, where, where, markername, (Location::Flags) flags);
switch (t) {
case MarkerBarItem:
- ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, false, false)));
+ ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, false)));
ruler_items.push_back (MenuElem (_("Clear all locations"), sigc::mem_fun(*this, &Editor::clear_markers)));
ruler_items.push_back (MenuElem (_("Unhide locations"), sigc::mem_fun(*this, &Editor::unhide_markers)));
ruler_items.push_back (SeparatorElem ());
case CdMarkerBarItem:
// TODO
- ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, true, false)));
+ ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, true)));
break;
#include "ardour_ui.h"
#include "main_clock.h"
+#include "public_editor.h"
#include "i18n.h"
+#include "ardour/tempo.h"
+
using namespace Gtk;
MainClock::MainClock (
const std::string& clock_name,
- bool is_transient,
const std::string& widget_name,
- bool editable,
- bool follows_playhead,
- bool primary,
- bool duration,
- bool with_info
+ bool primary
)
- : AudioClock (clock_name, is_transient, widget_name, editable, follows_playhead, duration, with_info)
+ : AudioClock (clock_name, false, widget_name, true, true, false, true)
, _primary (primary)
{
c->set_active (true);
}
}
+
+ ops_items.push_back (SeparatorElem());
+ ops_items.push_back (MenuElem (_("Edit Tempo"), sigc::mem_fun(*this, &MainClock::edit_current_tempo)));
+ ops_items.push_back (MenuElem (_("Edit Meter"), sigc::mem_fun(*this, &MainClock::edit_current_meter)));
+ ops_items.push_back (MenuElem (_("Insert Tempo Change"), sigc::mem_fun(*this, &MainClock::insert_new_tempo)));
+ ops_items.push_back (MenuElem (_("Insert Meter Change"), sigc::mem_fun(*this, &MainClock::insert_new_meter)));
+}
+
+framepos_t
+MainClock::absolute_time () const
+{
+ if (get_is_duration ()) {
+ // delta to edit cursor
+ return current_time () + PublicEditor::instance().get_preferred_edit_position (true);
+ } else {
+ return current_time ();
+ }
}
void
ARDOUR_UI::config()->set_secondary_clock_delta_edit_cursor (!ARDOUR_UI::config()->get_secondary_clock_delta_edit_cursor ());
}
}
+
+void
+MainClock::edit_current_tempo ()
+{
+ ARDOUR::TempoSection ts = PublicEditor::instance().session()->tempo_map().tempo_section_at (absolute_time());
+ PublicEditor::instance().edit_tempo_section (&ts);
+}
+
+void
+MainClock::edit_current_meter ()
+{
+ ARDOUR::MeterSection ms = PublicEditor::instance().session()->tempo_map().meter_section_at (absolute_time());
+ PublicEditor::instance().edit_meter_section (&ms);
+}
+
+void
+MainClock::insert_new_tempo ()
+{
+ PublicEditor::instance().mouse_add_new_tempo_event (absolute_time ());
+}
+
+void
+MainClock::insert_new_meter ()
+{
+ PublicEditor::instance().mouse_add_new_meter_event (absolute_time ());
+}
+
+bool
+MainClock::on_button_press_event (GdkEventButton *ev)
+{
+ if (ev->button == 1) {
+ if (mode() == BBT) {
+ if (is_lower_layout_click(ev->y)) {
+ if (is_right_layout_click(ev->x)) {
+ // meter on the right
+ edit_current_meter();
+ } else {
+ // tempo on the left
+ edit_current_tempo();
+ }
+ return true;
+ }
+ }
+ }
+
+ return AudioClock::on_button_press_event (ev);
+}
+
#include "audio_clock.h"
-/** A simple subclass of AudioClock that adds the `display delta to edit cursor' option to its context menu */
+/** A simple subclass of AudioClock that adds a few things to its context menu:
+ * `display delta to edit cursor' and edit/change tempo/meter
+ */
class MainClock : public AudioClock
{
public:
- MainClock (const std::string &, bool, const std::string &, bool, bool, bool primary, bool duration = false, bool with_info = false);
+ MainClock (const std::string& clock_name, const std::string& widget_name, bool primary);
private:
+ // Editor *_editor;
+
void build_ops_menu ();
void display_delta_to_edit_cursor ();
+ void edit_current_tempo ();
+ void edit_current_meter ();
+ void insert_new_tempo ();
+ void insert_new_meter ();
+ framepos_t absolute_time () const;
bool _primary;
+
+ bool on_button_press_event (GdkEventButton *ev);
};
virtual void toggle_meter_updating() = 0;
virtual void split_regions_at (framepos_t, RegionSelection&) = 0;
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0;
- virtual void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false) = 0;
+ virtual void mouse_add_new_marker (framepos_t where, bool is_cd=false) = 0;
virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;
virtual void add_to_idle_resize (TimeAxisView*, int32_t) = 0;
virtual framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next) = 0;
virtual void get_regionviews_by_id (PBD::ID const id, RegionSelection & regions) const = 0;
virtual void get_per_region_note_selection (std::list<std::pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > > >&) const = 0;
+ virtual void mouse_add_new_tempo_event (framepos_t where) = 0;
+ virtual void mouse_add_new_meter_event (framepos_t where) = 0;
+ virtual void edit_tempo_section (ARDOUR::TempoSection*) = 0;
+ virtual void edit_meter_section (ARDOUR::MeterSection*) = 0;
+
/// Singleton instance, set up by Editor::Editor()
static PublicEditor* _instance;
when_beat_entry.signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &TempoDialog::response), RESPONSE_ACCEPT));
when_beat_entry.signal_key_release_event().connect (sigc::mem_fun (*this, &TempoDialog::entry_key_release), false);
pulse_selector.signal_changed().connect (sigc::mem_fun (*this, &TempoDialog::pulse_change));
- tap_tempo_button.signal_clicked().connect (sigc::mem_fun (*this, &TempoDialog::tap_tempo));
+ tap_tempo_button.signal_button_press_event().connect (sigc::mem_fun (*this, &TempoDialog::tap_tempo_button_press), false);
+ tap_tempo_button.signal_focus_out_event().connect (sigc::mem_fun (*this, &TempoDialog::tap_tempo_focus_out));
+
+ tapped = false;
}
bool
set_response_sensitive (RESPONSE_ACCEPT, is_user_input_valid());
}
-void
-TempoDialog::tap_tempo ()
+bool
+TempoDialog::tap_tempo_button_press (GdkEventButton *ev)
{
gint64 now;
now = g_get_monotonic_time (); // microseconds
- if (last_tap > 0) {
+ if (tapped) {
double interval, bpm;
static const double decay = 0.5;
interval = (now - last_tap) * 1.0e-6;
if (interval <= 6.0) {
- // >= 10 bpm, say
+ // <= 6 seconds (say): >= 10 bpm
if (average_interval > 0) {
+ if (average_interval > interval / 1.2 && average_interval < interval * 1.2) {
average_interval = interval * decay
+ average_interval * (1.0-decay);
+ } else {
+ average_interval = 0;
+ }
} else {
average_interval = interval;
}
- bpm = 60.0 / average_interval;
- bpm_spinner.set_value (bpm);
+ if (average_interval > 0) {
+ bpm = 60.0 / average_interval;
+ bpm_spinner.set_value (bpm);
+ }
} else {
average_interval = 0;
}
} else {
average_interval = 0;
+ tapped = true;
}
last_tap = now;
}
+bool
+TempoDialog::tap_tempo_focus_out (GdkEventFocus* )
+{
+ tapped = false;
+ return false;
+}
+
MeterDialog::MeterDialog (TempoMap& map, framepos_t frame, const string&)
: ArdourDialog (_("New Meter"))
{
bool bpm_button_release (GdkEventButton* );
bool entry_key_release (GdkEventKey* );
void pulse_change ();
- void tap_tempo ();
+ bool tap_tempo_button_press (GdkEventButton* );
+ bool tap_tempo_focus_out (GdkEventFocus* );
typedef std::map<std::string,float> NoteTypes;
NoteTypes note_types;
+ bool tapped; // whether the tap-tempo button has been clicked
gint64 last_tap;
double average_interval;
const Meter& meter_at (framepos_t) const;
const TempoSection& tempo_section_at (framepos_t) const;
+ const MeterSection& meter_section_at (framepos_t) const;
void add_tempo (const Tempo&, Timecode::BBT_Time where);
void add_meter (const Meter&, Timecode::BBT_Time where);
return m.tempo();
}
+const MeterSection&
+TempoMap::meter_section_at (framepos_t frame) const
+{
+ Glib::Threads::RWLock::ReaderLock lm (lock);
+ Metrics::const_iterator i;
+ MeterSection* prev = 0;
+
+ for (i = metrics.begin(); i != metrics.end(); ++i) {
+ MeterSection* t;
+
+ if ((t = dynamic_cast<MeterSection*> (*i)) != 0) {
+
+ if ((*i)->frame() > frame) {
+ break;
+ }
+
+ prev = t;
+ }
+ }
+
+ if (prev == 0) {
+ fatal << endmsg;
+ abort(); /*NOTREACHED*/
+ }
+
+ return *prev;
+}
const Meter&
TempoMap::meter_at (framepos_t frame) const
#elif PLATFORM_WINDOWS
+<<<<<<< HEAD
const std::vector<std::string> WavesAudioBackend::__available_midi_options = boost::assign::list_of ("System MIDI (MME)") ("None");
+=======
+const std::vector<std::string> WavesAudioBackend::__available_midi_options = boost::assign::list_of ("Multimedia Extensions") ("None");
+>>>>>>> remotes/origin/tempo-marker-from-clock
#endif