getting editor_drag.cc to compile

This commit is contained in:
Paul Davis 2020-10-14 23:09:22 -06:00
parent 5f4afa6a0e
commit 5b2a435e02
28 changed files with 1136 additions and 749 deletions

View File

@ -215,13 +215,13 @@ void
AutomationController::start_touch() AutomationController::start_touch()
{ {
_grabbed = true; _grabbed = true;
_controllable->start_touch (_controllable->session().transport_sample()); _controllable->start_touch (timepos_t (_controllable->session().transport_sample()));
} }
void void
AutomationController::end_touch () AutomationController::end_touch ()
{ {
_controllable->stop_touch (_controllable->session().transport_sample()); _controllable->stop_touch (timepos_t (_controllable->session().transport_sample()));
if (_grabbed) { if (_grabbed) {
_grabbed = false; _grabbed = false;
display_effective_value (); display_effective_value ();

View File

@ -299,8 +299,6 @@ AutomationTimeAxisView::AutomationTimeAxisView (
assert (_control); assert (_control);
#warning NUTEMPO new tempo map API required
#if 0
boost::shared_ptr<AutomationLine> line ( boost::shared_ptr<AutomationLine> line (
new AutomationLine ( new AutomationLine (
ARDOUR::EventTypeMap::instance().to_symbol(_parameter), ARDOUR::EventTypeMap::instance().to_symbol(_parameter),
@ -308,7 +306,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (
*_canvas_display, *_canvas_display,
_control->alist(), _control->alist(),
_control->desc(), _control->desc(),
Temporal::DistanceMeasure (_session->tempo_map(), timepos_t()) /* default distance measure, origin at absolute zero */ Temporal::DistanceMeasure (timepos_t()) /* default distance measure, origin at absolute zero */
) )
); );
@ -316,7 +314,6 @@ AutomationTimeAxisView::AutomationTimeAxisView (
line->set_fill (true); line->set_fill (true);
line->queue_reset (); line->queue_reset ();
add_line (line); add_line (line);
#endif 0
} }
/* make sure labels etc. are correct */ /* make sure labels etc. are correct */

View File

@ -101,7 +101,7 @@ public:
void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double top, double bot, std::list<Selectable *>&, bool within = false); void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double top, double bot, std::list<Selectable *>&, bool within = false);
void get_inverted_selectables (Selection&, std::list<Selectable*>& results); void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
void show_timestretch (samplepos_t /*start*/, samplepos_t /*end*/, int /*layers*/, int /*layer*/) {} void show_timestretch (Temporal::timepos_t const &/*start*/, Temporal::timepos_t const & /*end*/, int /*layers*/, int /*layer*/) {}
void hide_timestretch () {} void hide_timestretch () {}
/* editing operations */ /* editing operations */

View File

@ -2596,10 +2596,10 @@ Editor::trackview_by_y_position (double y, bool trackview_relative_offset) const
} }
void void
Editor::set_snapped_cursor_position (samplepos_t pos) Editor::set_snapped_cursor_position (timepos_t const & pos)
{ {
if (_edit_point == EditAtMouse) { if (_edit_point == EditAtMouse) {
_snapped_cursor->set_position(pos); snapped_cursor->set_position (pos.samples());
} }
} }

View File

@ -491,7 +491,7 @@ public:
Temporal::RoundMode direction = Temporal::RoundNearest, Temporal::RoundMode direction = Temporal::RoundNearest,
ARDOUR::SnapPref gpref = ARDOUR::SnapToAny_Visual); ARDOUR::SnapPref gpref = ARDOUR::SnapToAny_Visual);
void set_snapped_cursor_position (samplepos_t pos); void set_snapped_cursor_position (Temporal::timepos_t const & pos);
void begin_selection_op_history (); void begin_selection_op_history ();
void begin_reversible_selection_op (std::string cmd_name); void begin_reversible_selection_op (std::string cmd_name);
@ -2016,7 +2016,7 @@ private:
void stop_canvas_autoscroll (); void stop_canvas_autoscroll ();
/* trimming */ /* trimming */
void point_trim (GdkEvent*, samplepos_t); void point_trim (GdkEvent*, Temporal::timepos_t const &);
void trim_region_front(); void trim_region_front();
void trim_region_back(); void trim_region_back();

File diff suppressed because it is too large Load Diff

View File

@ -118,7 +118,12 @@ public:
/** @return current pointer sample */ /** @return current pointer sample */
ARDOUR::samplepos_t current_pointer_sample () const { ARDOUR::samplepos_t current_pointer_sample () const {
return _current_pointer_sample; return _current_pointer_time.samples();
}
/** @return current pointer time */
Temporal::timepos_t current_pointer_time () const {
return _current_pointer_time;
} }
/** return drag-motion displays video-frame of drag-location */ /** return drag-motion displays video-frame of drag-location */
@ -130,7 +135,7 @@ private:
bool _ending; ///< true if end_grab or abort is in progress, otherwise false bool _ending; ///< true if end_grab or abort is in progress, otherwise false
double _current_pointer_x; ///< canvas-coordinate space x of the current pointer double _current_pointer_x; ///< canvas-coordinate space x of the current pointer
double _current_pointer_y; ///< canvas-coordinate space y of the current pointer double _current_pointer_y; ///< canvas-coordinate space y of the current pointer
ARDOUR::samplepos_t _current_pointer_sample; ///< sample that the pointer is now at Temporal::timepos_t _current_pointer_time; ///< time that the pointer is now at
bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started
}; };
@ -154,8 +159,8 @@ public:
bool motion_handler (GdkEvent*, bool); bool motion_handler (GdkEvent*, bool);
void abort (); void abort ();
ARDOUR::MusicSample adjusted_sample (ARDOUR::samplepos_t, GdkEvent const *, bool snap = true) const; Temporal::timepos_t adjusted_time (Temporal::timepos_t const &, GdkEvent const *, bool snap = true) const;
ARDOUR::samplepos_t adjusted_current_sample (GdkEvent const *, bool snap = true) const; Temporal::timepos_t adjusted_current_time (GdkEvent const *, bool snap = true) const;
bool was_double_click() const { return _was_double_click; } bool was_double_click() const { return _was_double_click; }
void set_double_click (bool yn) { _was_double_click = yn; } void set_double_click (bool yn) { _was_double_click = yn; }
@ -197,9 +202,9 @@ public:
return _preview_video; return _preview_video;
} }
/** @return minimum number of pixels (x, y) that should be considered a movement */ /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
virtual std::pair<int, int> move_threshold () const { std::pair<Temporal::timecnt_t,int> move_threshold () const {
return std::make_pair (1, 1); return std::make_pair (Temporal::timecnt_t (1, Temporal::AudioTime), 1);
} }
virtual bool allow_vertical_autoscroll () const { virtual bool allow_vertical_autoscroll () const {
@ -220,14 +225,15 @@ public:
return _initially_vertical; return _initially_vertical;
} }
/** Set up the _pointer_sample_offset */ /** Set up the _pointer_offset */
virtual void setup_pointer_sample_offset () { virtual void setup_pointer_offset () {
_pointer_sample_offset = 0; _pointer_offset = Temporal::timecnt_t();
} }
/** Set up the _video_sample_offset - relative to _current_pointer_sample */ /** Set up the _video_offset - relative to _current_pointer_time */
virtual void setup_video_sample_offset () { virtual void setup_video_offset () {
_video_sample_offset = 0; /* video offset is always in audio time */
_video_offset = Temporal::timecnt_t (Temporal::AudioTime);
_preview_video = false; _preview_video = false;
} }
@ -243,12 +249,16 @@ protected:
return _grab_y; return _grab_y;
} }
ARDOUR::samplepos_t raw_grab_sample () const { Temporal::timepos_t raw_grab_time () const {
return _raw_grab_sample; return _raw_grab_time;
} }
ARDOUR::samplepos_t grab_sample () const { ARDOUR::samplepos_t grab_sample () const {
return _grab_sample; return _grab_time.samples();
}
Temporal::timepos_t grab_time () const {
return _grab_time;
} }
double last_pointer_x () const { double last_pointer_x () const {
@ -260,31 +270,35 @@ protected:
} }
ARDOUR::samplepos_t last_pointer_sample () const { ARDOUR::samplepos_t last_pointer_sample () const {
return _last_pointer_sample; return _last_pointer_time.samples();
} }
ARDOUR::sampleoffset_t snap_delta (guint const) const; Temporal::timepos_t last_pointer_time () const {
double snap_delta_music (guint const) const; return _last_pointer_time;
}
Temporal::timecnt_t snap_delta (guint const) const;
Temporal::Beats snap_delta_music (guint const) const;
double current_pointer_x () const; double current_pointer_x () const;
double current_pointer_y () const; double current_pointer_y () const;
/* sets snap delta from unsnapped pos */ /* sets snap delta from unsnapped pos */
void setup_snap_delta (ARDOUR::MusicSample pos); void setup_snap_delta (Temporal::timepos_t const & pos);
boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*, bool commit); boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*, bool commit);
void show_verbose_cursor_time (samplepos_t); void show_verbose_cursor_time (Temporal::timepos_t const &);
void show_verbose_cursor_duration (samplepos_t, samplepos_t, double xoffset = 0); void show_verbose_cursor_duration (Temporal::timepos_t const & , Temporal::timepos_t const & , double xoffset = 0);
void show_verbose_cursor_text (std::string const &); void show_verbose_cursor_text (std::string const &);
void show_view_preview (samplepos_t); void show_view_preview (Temporal::timepos_t const &);
Editor* _editor; ///< our editor Editor* _editor; ///< our editor
DragManager* _drags; DragManager* _drags;
ArdourCanvas::Item* _item; ///< our item ArdourCanvas::Item* _item; ///< our item
/** Offset from the mouse's position for the drag to the start of the thing that is being dragged */ /** Offset from the mouse's position for the drag to the start of the thing that is being dragged */
ARDOUR::samplecnt_t _pointer_sample_offset; Temporal::timecnt_t _pointer_offset;
ARDOUR::samplecnt_t _video_sample_offset; Temporal::timecnt_t _video_offset;
bool _preview_video; bool _preview_video;
bool _x_constrained; ///< true if x motion is constrained, otherwise false bool _x_constrained; ///< true if x motion is constrained, otherwise false
bool _y_constrained; ///< true if y motion is constrained, otherwise false bool _y_constrained; ///< true if y motion is constrained, otherwise false
@ -301,15 +315,15 @@ private:
double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true
double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred
ARDOUR::samplepos_t _raw_grab_sample; ///< unsnapped sample that the mouse was at when start_grab was called, or 0 Temporal::timepos_t _raw_grab_time; ///< unsnapped time that the mouse was at when start_grab was called, or 0
ARDOUR::samplepos_t _grab_sample; ///< adjusted_sample that the mouse was at when start_grab was called, or 0 Temporal::timepos_t _grab_time; ///< adjusted_time that the mouse was at when start_grab was called, or 0
ARDOUR::samplepos_t _last_pointer_sample; ///< adjusted_sample the last time a motion occurred Temporal::timepos_t _last_pointer_time; ///< adjusted_time the last time a motion occurred
/* difference between some key position's snapped and unsnapped /* difference between some key position's snapped and unsnapped
* samplepos. used for relative snap. * samplepos. used for relative snap.
*/ */
samplepos_t _snap_delta; Temporal::timecnt_t _snap_delta;
double _snap_delta_music; Temporal::Beats _snap_delta_music;
CursorContext::Handle _cursor_ctx; ///< cursor change context CursorContext::Handle _cursor_ctx; ///< cursor change context
bool _constraint_pressed; ///< if the keyboard indicated constraint modifier was pressed on start_grab() bool _constraint_pressed; ///< if the keyboard indicated constraint modifier was pressed on start_grab()
int _grab_button; int _grab_button;
@ -334,8 +348,8 @@ public:
*/ */
double layer; double layer;
double initial_y; ///< the initial y position of the view before any reparenting double initial_y; ///< the initial y position of the view before any reparenting
samplepos_t initial_position; ///< initial position of the region Temporal::timepos_t initial_position; ///< initial position of the region
samplepos_t initial_end; ///< initial end position of the region Temporal::timepos_t initial_end; ///< initial end position of the region
samplepos_t anchored_fade_length; ///< fade_length when anchored during drag samplepos_t anchored_fade_length; ///< fade_length when anchored during drag
boost::shared_ptr<ARDOUR::Playlist> initial_playlist; boost::shared_ptr<ARDOUR::Playlist> initial_playlist;
TimeAxisView* initial_time_axis_view; TimeAxisView* initial_time_axis_view;
@ -362,7 +376,7 @@ protected:
int _visible_y_high; int _visible_y_high;
uint32_t _ntracks; uint32_t _ntracks;
void setup_video_sample_offset (); void setup_video_offset ();
friend class DraggingView; friend class DraggingView;
@ -426,12 +440,12 @@ public:
protected: protected:
double compute_x_delta (GdkEvent const *, ARDOUR::MusicSample *); double compute_x_delta (GdkEvent const *, Temporal::timepos_t &);
virtual bool y_movement_allowed (int, double, int skip_invisible = 0) const; virtual bool y_movement_allowed (int, double, int skip_invisible = 0) const;
void collect_ripple_views (); void collect_ripple_views ();
bool _ignore_video_lock; bool _ignore_video_lock;
ARDOUR::MusicSample _last_position; ///< last position of the thing being dragged Temporal::timepos_t _last_position; ///< last position of the thing being dragged
double _total_x_delta; double _total_x_delta;
int _last_pointer_time_axis_view; int _last_pointer_time_axis_view;
double _last_pointer_layer; double _last_pointer_layer;
@ -463,28 +477,24 @@ public:
return true; return true;
} }
std::pair<int, int> move_threshold () const { std::pair<Temporal::timecnt_t,int> move_threshold () const {
if (_copy) { return std::make_pair (Temporal::timecnt_t (4, Temporal::AudioTime), 4);
return std::make_pair (6, 4);
} else {
return std::make_pair (2, 4);
}
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
private: private:
void finished_no_copy ( void finished_no_copy (
bool const, bool const,
bool const, bool const,
ARDOUR::MusicSample, Temporal::timepos_t const &,
int32_t const ev_state int32_t const ev_state
); );
void finished_copy ( void finished_copy (
bool const, bool const,
bool const, bool const,
ARDOUR::MusicSample, Temporal::timepos_t const &,
int32_t const ev_state int32_t const ev_state
); );
@ -492,8 +502,7 @@ private:
boost::shared_ptr<ARDOUR::Region>, boost::shared_ptr<ARDOUR::Region>,
RouteTimeAxisView*, RouteTimeAxisView*,
ARDOUR::layer_t, ARDOUR::layer_t,
ARDOUR::MusicSample, Temporal::timepos_t const &,
double quarter_note,
PlaylistSet&, PlaylistSet&,
bool for_music = false bool for_music = false
); );
@ -516,7 +525,7 @@ private:
class RegionInsertDrag : public RegionMotionDrag class RegionInsertDrag : public RegionMotionDrag
{ {
public: public:
RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::samplepos_t); RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, Temporal::timepos_t const &);
void finished (GdkEvent *, bool); void finished (GdkEvent *, bool);
void aborted (bool); void aborted (bool);
@ -526,6 +535,35 @@ public:
} }
}; };
/** Region drag in ripple mode */
class RegionRippleDrag : public RegionMoveDrag
{
public:
RegionRippleDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
~RegionRippleDrag () { delete exclude; }
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
void aborted (bool);
protected:
bool y_movement_allowed (int delta_track, double delta_layer, int skip_invisible = 0) const;
private:
TimeAxisView *prev_tav; // where regions were most recently dragged from
TimeAxisView *orig_tav; // where drag started
Temporal::timecnt_t prev_amount;
Temporal::timepos_t prev_position;
Temporal::timecnt_t selection_length;
bool allow_moves_across_tracks; // only if all selected regions are on one track
ARDOUR::RegionList *exclude;
void add_all_after_to_views (TimeAxisView *tav, Temporal::timepos_t const & where, const RegionSelection &exclude, bool drag_in_progress);
void remove_unselected_from_views (Temporal::timecnt_t const & amount, bool move_regions);
std::list<boost::shared_ptr<ARDOUR::Region> > _orig_tav_ripples;
};
/** "Drag" to cut a region (action only on button release) */
class RegionCutDrag : public Drag class RegionCutDrag : public Drag
{ {
public: public:
@ -597,14 +635,14 @@ public:
private: private:
Temporal::Beats total_dx (GdkEvent * event) const; // total movement in quarter notes Temporal::timecnt_t total_dx (GdkEvent * event) const; // total movement in quarter notes
int8_t total_dy () const; int8_t total_dy () const;
MidiRegionView* _region; MidiRegionView* _region;
NoteBase* _primary; NoteBase* _primary;
double _cumulative_dx; Temporal::timecnt_t _cumulative_dx;
double _cumulative_dy; double _cumulative_dy;
double _earliest; // earliest quarter note in note selection Temporal::timepos_t _earliest; // earliest note in note selection
bool _was_selected; bool _was_selected;
double _note_height; double _note_height;
bool _copy; bool _copy;
@ -635,16 +673,16 @@ public:
private: private:
double y_to_region (double) const; double y_to_region (double) const;
ARDOUR::samplecnt_t grid_samples (samplepos_t) const; Temporal::Beats grid_aligned_beats (Temporal::timepos_t const & pos, GdkEvent const * event) const;
/** @return minimum number of pixels (x, y) that should be considered a movement */ /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
virtual std::pair<int, int> move_threshold () const { std::pair<Temporal::timecnt_t,int> move_threshold () const {
return std::make_pair (0, 0); return std::make_pair (Temporal::timecnt_t (0, Temporal::AudioTime), 0);
} }
MidiRegionView* _region_view; MidiRegionView* _region_view;
ArdourCanvas::Rectangle* _drag_rect; ArdourCanvas::Rectangle* _drag_rect;
samplepos_t _note[2]; Temporal::timepos_t _note[2];
}; };
class HitCreateDrag : public Drag class HitCreateDrag : public Drag
@ -668,11 +706,10 @@ public:
private: private:
double y_to_region (double) const; double y_to_region (double) const;
ARDOUR::samplecnt_t grid_samples (samplepos_t) const;
/** @return minimum number of pixels (x, y) that should be considered a movement */ /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
virtual std::pair<int, int> move_threshold () const { std::pair<Temporal::timecnt_t,int> move_threshold () const {
return std::make_pair (0, 0); return std::make_pair (Temporal::timecnt_t::zero (Temporal::AudioTime), 0);
} }
MidiRegionView* _region_view; MidiRegionView* _region_view;
@ -699,7 +736,7 @@ public:
return false; return false;
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
private: private:
MidiRegionView* _region_view; MidiRegionView* _region_view;
@ -770,7 +807,7 @@ public:
return false; return false;
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
private: private:
@ -799,7 +836,7 @@ public:
return false; return false;
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
private: private:
MeterMarker* _marker; MeterMarker* _marker;
@ -830,7 +867,7 @@ public:
return true; return true;
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
private: private:
TempoMarker* _marker; TempoMarker* _marker;
@ -862,7 +899,7 @@ public:
return false; return false;
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
private: private:
double _grab_qn; double _grab_qn;
@ -890,7 +927,7 @@ public:
return true; return true;
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
private: private:
double _grab_qn; double _grab_qn;
@ -921,7 +958,7 @@ public:
return true; return true;
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
private: private:
double _grab_qn; double _grab_qn;
@ -982,7 +1019,7 @@ public:
return false; return false;
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
}; };
/** Region fade-out drag */ /** Region fade-out drag */
@ -1004,7 +1041,7 @@ public:
return false; return false;
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
}; };
/** Marker drag */ /** Marker drag */
@ -1027,8 +1064,8 @@ public:
return false; return false;
} }
void setup_pointer_sample_offset (); void setup_pointer_offset ();
void setup_video_sample_offset (); void setup_video_offset ();
private: private:
void update_item (ARDOUR::Location *); void update_item (ARDOUR::Location *);
@ -1136,22 +1173,21 @@ public:
void finished (GdkEvent *, bool); void finished (GdkEvent *, bool);
void aborted (bool); void aborted (bool);
/** @return minimum number of pixels (x, y) that should be considered a movement */ std::pair<Temporal::timecnt_t,int> move_threshold () const {
std::pair<int, int> move_threshold () const { return std::make_pair (Temporal::timecnt_t (8, Temporal::AudioTime), 1);
return std::make_pair (1, 1);
} }
void do_select_things (GdkEvent *, bool); void do_select_things (GdkEvent *, bool);
/** Select some things within a rectangle. /** Select some things within a rectangle.
* @param button_state The button state from the GdkEvent. * @param button_state The button state from the GdkEvent.
* @param x1 The left-hand side of the rectangle in session samples. * @param x1 The left-hand side of the rectangle as a timepos_t
* @param x2 The right-hand side of the rectangle in session samples. * @param x2 The right-hand side of the rectangle as a timepos_t.
* @param y1 The top of the rectangle in trackview coordinates. * @param y1 The top of the rectangle in trackview coordinates.
* @param y2 The bottom of the rectangle in trackview coordinates. * @param y2 The bottom of the rectangle in trackview coordinates.
* @param drag_in_progress true if the drag is currently happening. * @param drag_in_progress true if the drag is currently happening.
*/ */
virtual void select_things (int button_state, samplepos_t x1, samplepos_t x2, double y1, double y2, bool drag_in_progress) = 0; virtual void select_things (int button_state, Temporal::timepos_t const & x1, Temporal::timepos_t const & x2, double y1, double y2, bool drag_in_progress) = 0;
virtual void deselect_things () = 0; virtual void deselect_things () = 0;
@ -1165,7 +1201,7 @@ class EditorRubberbandSelectDrag : public RubberbandSelectDrag
public: public:
EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *); EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
void select_things (int, samplepos_t, samplepos_t, double, double, bool); void select_things (int, Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, bool);
void deselect_things (); void deselect_things ();
}; };
@ -1175,7 +1211,7 @@ class MidiRubberbandSelectDrag : public RubberbandSelectDrag
public: public:
MidiRubberbandSelectDrag (Editor *, MidiRegionView *); MidiRubberbandSelectDrag (Editor *, MidiRegionView *);
void select_things (int, samplepos_t, samplepos_t, double, double, bool); void select_things (int, Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, bool);
void deselect_things (); void deselect_things ();
private: private:
@ -1188,7 +1224,7 @@ class MidiVerticalSelectDrag : public RubberbandSelectDrag
public: public:
MidiVerticalSelectDrag (Editor *, MidiRegionView *); MidiVerticalSelectDrag (Editor *, MidiRegionView *);
void select_things (int, samplepos_t, samplepos_t, double, double, bool); void select_things (int, Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, bool);
void deselect_things (); void deselect_things ();
private: private:
@ -1238,15 +1274,15 @@ public:
void finished (GdkEvent *, bool); void finished (GdkEvent *, bool);
void aborted (bool); void aborted (bool);
void setup_pointer_sample_offset (); void setup_pointer_offset ();
private: private:
Operation _operation; Operation _operation;
bool _add; bool _add;
TrackSelection _track_selection_at_start; TrackSelection _track_selection_at_start;
bool _time_selection_at_start; bool _time_selection_at_start;
samplepos_t start_at_start; Temporal::timepos_t start_at_start;
samplepos_t end_at_start; Temporal::timepos_t end_at_start;
}; };
/** Range marker drag */ /** Range marker drag */
@ -1295,9 +1331,8 @@ public:
void finished (GdkEvent *, bool); void finished (GdkEvent *, bool);
void aborted (bool); void aborted (bool);
/** @return minimum number of pixels (x, y) that should be considered a movement */ std::pair<Temporal::timecnt_t,int> move_threshold () const {
std::pair<int, int> move_threshold () const { return std::make_pair (Temporal::timecnt_t (4, Temporal::AudioTime), 4);
return std::make_pair (4, 4);
} }
private: private:
@ -1325,7 +1360,7 @@ public:
private: private:
void setup (std::list<boost::shared_ptr<AutomationLine> > const &); void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
double y_fraction (double global_y_position) const; double y_fraction (double global_y_position) const;
double value (boost::shared_ptr<ARDOUR::AutomationList> list, double x) const; double value (boost::shared_ptr<ARDOUR::AutomationList> list, Temporal::timepos_t const & x) const;
std::list<ARDOUR::TimelineRange> _ranges; std::list<ARDOUR::TimelineRange> _ranges;
@ -1333,7 +1368,7 @@ private:
struct Line { struct Line {
boost::shared_ptr<AutomationLine> line; ///< the line boost::shared_ptr<AutomationLine> line; ///< the line
std::list<ControlPoint*> points; ///< points to drag on the line std::list<ControlPoint*> points; ///< points to drag on the line
std::pair<ARDOUR::samplepos_t, ARDOUR::samplepos_t> range; ///< the range of all points on the line, in session samples std::pair<Temporal::timepos_t, Temporal::timepos_t> range; ///< the range of all points on the line, in session time
XMLNode* state; ///< the XML state node before the drag XMLNode* state; ///< the XML state node before the drag
}; };
@ -1360,8 +1395,8 @@ public:
return false; return false;
} }
virtual std::pair<int, int> move_threshold () const { std::pair<Temporal::timecnt_t,int> move_threshold () const {
return std::make_pair (1, 4); return std::make_pair (Temporal::timecnt_t (4, Temporal::AudioTime), 4);
} }
private: private:

View File

@ -2427,7 +2427,7 @@ Editor::cancel_time_selection ()
} }
void void
Editor::point_trim (GdkEvent* event, samplepos_t new_bound) Editor::point_trim (GdkEvent* event, timepos_t const & new_bound)
{ {
RegionView* rv = clicked_regionview; RegionView* rv = clicked_regionview;
@ -2530,7 +2530,7 @@ Editor::mouse_rename_region (ArdourCanvas::Item* /*item*/, GdkEvent* /*event*/)
void void
Editor::mouse_brush_insert_region (RegionView* rv, samplepos_t pos) Editor::mouse_brush_insert_region (RegionView* rv, timepos_t const & pos)
{ {
/* no brushing without a useful quantize setting */ /* no brushing without a useful quantize setting */
if (_grid_type == GridTypeNone) if (_grid_type == GridTypeNone)
@ -2538,7 +2538,7 @@ Editor::mouse_brush_insert_region (RegionView* rv, samplepos_t pos)
/* don't brush a copy over the original */ /* don't brush a copy over the original */
if (pos == rv->region()->position()) { if (pos == rv->region()->nt_position()) {
return; return;
} }

View File

@ -208,6 +208,8 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
double max_tempo = 0.0; double max_tempo = 0.0;
double min_tempo = DBL_MAX; double min_tempo = DBL_MAX;
#warning NUTEMPO needs new tempo map API
#if 0
for (Marks::iterator x = metric_marks.begin(); x != metric_marks.end(); ++x) { for (Marks::iterator x = metric_marks.begin(); x != metric_marks.end(); ++x) {
TempoMarker* tempo_marker; TempoMarker* tempo_marker;
MeterMarker* meter_marker; MeterMarker* meter_marker;
@ -282,6 +284,7 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
update_tempo_based_rulers (); update_tempo_based_rulers ();
maybe_draw_grid_lines (); maybe_draw_grid_lines ();
#endif
} }
void void
@ -296,7 +299,7 @@ Editor::redisplay_grid (bool immediate_redraw)
update_tempo_based_rulers (); update_tempo_based_rulers ();
update_grid(); update_grid();
} else { } else {
Glib::signal_idle().connect (sigc::bind_return (sigc::bind (sigc::mem_fun (*this, &Editor::redisplay_grid), true), false)); Glib::signal_idle().connect (sigc::bind_return (sigc::bind (sigc::mem_fun (*this, &Editor::redisplay_grid), true), false));
} }

View File

@ -27,7 +27,7 @@
class MarkerSelection : public std::list<ArdourMarker*> class MarkerSelection : public std::list<ArdourMarker*>
{ {
public: public:
void range (ARDOUR::samplepos_t& start, ARDOUR::samplepos_t& end); void range (Temporal::timepos_t& start, Temporal::timepos_t& end);
}; };
#endif /* __ardour_gtk_marker_selection_h__ */ #endif /* __ardour_gtk_marker_selection_h__ */

View File

@ -761,13 +761,13 @@ MidiListEditor::redisplay_model ()
if (_session) { if (_session) {
BeatsSamplesConverter conv (_session->tempo_map(), region->position());
boost::shared_ptr<MidiModel> m (region->midi_source(0)->model()); boost::shared_ptr<MidiModel> m (region->midi_source(0)->model());
TreeModel::Row row; TreeModel::Row row;
stringstream ss; stringstream ss;
MidiModel::Notes::const_iterator i = m->note_lower_bound(conv.from (region->start())); MidiModel::Notes::const_iterator i = m->note_lower_bound (region->nt_start().beats());
Temporal::Beats end_time = conv.from (region->start()) + conv.from (region->length()); Temporal::Beats end_time = (region->nt_start() + region->nt_length()).beats();
for (; i != m->notes().end() && (*i)->time() < end_time; ++i) { for (; i != m->notes().end() && (*i)->time() < end_time; ++i) {
row = *(model->append()); row = *(model->append());
row[columns.channel] = (*i)->channel() + 1; row[columns.channel] = (*i)->channel() + 1;
@ -775,7 +775,9 @@ MidiListEditor::redisplay_model ()
row[columns.note] = (*i)->note(); row[columns.note] = (*i)->note();
row[columns.velocity] = (*i)->velocity(); row[columns.velocity] = (*i)->velocity();
Temporal::BBT_Time bbt (_session->tempo_map().bbt_at_sample (region->position() - region->start() + conv.to ((*i)->time()))); #warning NUTEMPO needs ::bbt() method for timeline types
// Temporal::BBT_Time bbt (((region->position() + (*i)->time()).earlier (start)).bbt());
Temporal::BBT_Time bbt;
ss.str (""); ss.str ("");
ss << bbt; ss << bbt;

View File

@ -2368,14 +2368,14 @@ MidiRegionView::note_deselected(NoteBase* ev)
} }
void void
MidiRegionView::update_drag_selection(samplepos_t start, samplepos_t end, double gy0, double gy1, bool extend) MidiRegionView::update_drag_selection(timepos_t const & start, timepos_t const & end, double gy0, double gy1, bool extend)
{ {
PublicEditor& editor = trackview.editor(); PublicEditor& editor = trackview.editor();
// Convert to local coordinates // Convert to local coordinates
const double y = midi_view()->y_position(); const double y = midi_view()->y_position();
const double x0 = editor.time_to_pixel (max (timepos_t(), _region->region_relative_position (timepos_t (start)))); const double x0 = editor.time_to_pixel (max (timepos_t(), _region->region_relative_position (start)));
const double x1 = editor.time_to_pixel (max (timepos_t(), _region->region_relative_position (timepos_t (end)))); const double x1 = editor.time_to_pixel (max (timepos_t(), _region->region_relative_position (end)));
const double y0 = max(0.0, gy0 - y); const double y0 = max(0.0, gy0 - y);
const double y1 = max(0.0, gy1 - y); const double y1 = max(0.0, gy1 - y);
@ -2504,11 +2504,10 @@ MidiRegionView::earliest_in_selection ()
} }
void void
MidiRegionView::move_selection(Temporal::Beats const & dx_qn, double dy, double cumulative_dy) MidiRegionView::move_selection(timecnt_t const & dx_qn, double dy, double cumulative_dy)
{ {
typedef vector<boost::shared_ptr<NoteType> > PossibleChord; typedef vector<boost::shared_ptr<NoteType> > PossibleChord;
Editor* editor = dynamic_cast<Editor*> (&trackview.editor()); Editor* editor = dynamic_cast<Editor*> (&trackview.editor());
TempoMap& tmap (editor->session()->tempo_map());
PossibleChord to_play; PossibleChord to_play;
Temporal::Beats earliest = earliest_in_selection(); Temporal::Beats earliest = earliest_in_selection();
@ -2521,13 +2520,13 @@ MidiRegionView::move_selection(Temporal::Beats const & dx_qn, double dy, double
double dx = 0.0; double dx = 0.0;
if (midi_view()->note_mode() == Sustained) { if (midi_view()->note_mode() == Sustained) {
dx = editor->sample_to_pixel_unrounded (tmap.sample_at_quarter_note (note_time_qn + dx_qn)) dx = editor->time_to_pixel_unrounded ((note_time_qn + dx_qn))
- n->item()->item_to_canvas (ArdourCanvas::Duple (n->x0(), 0)).x; - n->item()->item_to_canvas (ArdourCanvas::Duple (n->x0(), 0)).x;
} else { } else {
/* Hit::x0() is offset by _position.x, unlike Note::x0() */ /* Hit::x0() is offset by _position.x, unlike Note::x0() */
Hit* hit = dynamic_cast<Hit*>(n); Hit* hit = dynamic_cast<Hit*>(n);
if (hit) { if (hit) {
dx = editor->sample_to_pixel_unrounded (tmap.sample_at_quarter_note (note_time_qn + dx_qn)) dx = editor->time_to_pixel_unrounded ((note_time_qn + dx_qn))
- n->item()->item_to_canvas (ArdourCanvas::Duple (((hit->x0() + hit->x1()) / 2.0) - hit->position().x, 0)).x; - n->item()->item_to_canvas (ArdourCanvas::Duple (((hit->x0() + hit->x1()) / 2.0) - hit->position().x, 0)).x;
} }
} }
@ -2537,7 +2536,7 @@ MidiRegionView::move_selection(Temporal::Beats const & dx_qn, double dy, double
/* update length */ /* update length */
if (midi_view()->note_mode() == Sustained) { if (midi_view()->note_mode() == Sustained) {
Note* sus = dynamic_cast<Note*> (*i); Note* sus = dynamic_cast<Note*> (*i);
double const len_dx = editor->sample_to_pixel_unrounded (tmap.sample_at_quarter_note (note_time_qn + dx_qn + n->note()->length())); double const len_dx = editor->time_to_pixel_unrounded ((note_time_qn + dx_qn + n->note()->length()));
sus->set_x1 (n->item()->canvas_to_item (ArdourCanvas::Duple (len_dx, 0)).x); sus->set_x1 (n->item()->canvas_to_item (ArdourCanvas::Duple (len_dx, 0)).x);
} }
@ -2601,7 +2600,7 @@ MidiRegionView::copy_selection (NoteBase* primary)
} }
void void
MidiRegionView::move_copies (Temporal::Beats const & dx_qn, double dy, double cumulative_dy) MidiRegionView::move_copies (timecnt_t const & dx_qn, double dy, double cumulative_dy)
{ {
typedef vector<boost::shared_ptr<NoteType> > PossibleChord; typedef vector<boost::shared_ptr<NoteType> > PossibleChord;
Editor* editor = dynamic_cast<Editor*> (&trackview.editor()); Editor* editor = dynamic_cast<Editor*> (&trackview.editor());
@ -2615,8 +2614,8 @@ MidiRegionView::move_copies (Temporal::Beats const & dx_qn, double dy, double c
to_play.push_back (n->note()); to_play.push_back (n->note());
} }
Temporal::Beats const note_time_qn = _region->source_beats_to_absolute_beats (n->note()->time()); timepos_t const note_time_qn = _region->source_beats_to_absolute_beats (n->note()->time());
double dx = 0.0; timecnt_t dx (dx_qn.time_domain());
if (midi_view()->note_mode() == Sustained) { if (midi_view()->note_mode() == Sustained) {
dx = editor->sample_to_pixel_unrounded (tmap.sample_at_quarter_note (note_time_qn + dx_qn)) dx = editor->sample_to_pixel_unrounded (tmap.sample_at_quarter_note (note_time_qn + dx_qn))
@ -2663,7 +2662,7 @@ MidiRegionView::move_copies (Temporal::Beats const & dx_qn, double dy, double c
} }
void void
MidiRegionView::note_dropped(NoteBase *, Temporal::Beats const & d_qn, int8_t dnote, bool copy) MidiRegionView::note_dropped(NoteBase *, timecnt_t const & d_qn, int8_t dnote, bool copy)
{ {
uint8_t lowest_note_in_selection = 127; uint8_t lowest_note_in_selection = 127;
uint8_t highest_note_in_selection = 0; uint8_t highest_note_in_selection = 0;

View File

@ -210,10 +210,10 @@ public:
void extend_selection (); void extend_selection ();
Temporal::Beats earliest_in_selection (); Temporal::Beats earliest_in_selection ();
void move_selection(Temporal::Beats const & dx, double dy, double cumulative_dy); void move_selection(Temporal::timecnt_t const & dx, double dy, double cumulative_dy);
void note_dropped (NoteBase* ev, Temporal::Beats const & d_qn, int8_t d_note, bool copy); void note_dropped (NoteBase* ev, Temporal::timecnt_t const & d_qn, int8_t d_note, bool copy);
NoteBase* copy_selection (NoteBase* primary); NoteBase* copy_selection (NoteBase* primary);
void move_copies(Temporal::Beats const & dx_qn, double dy, double cumulative_dy); void move_copies(Temporal::timecnt_t const & dx_qn, double dy, double cumulative_dy);
void select_notes (std::list<Evoral::event_id_t>, bool allow_audition); void select_notes (std::list<Evoral::event_id_t>, bool allow_audition);
void select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend); void select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend);
@ -429,7 +429,7 @@ public:
void trim_note(NoteBase* ev, ARDOUR::MidiModel::TimeType start_delta, void trim_note(NoteBase* ev, ARDOUR::MidiModel::TimeType start_delta,
ARDOUR::MidiModel::TimeType end_delta); ARDOUR::MidiModel::TimeType end_delta);
void update_drag_selection (samplepos_t start, samplepos_t end, double y0, double y1, bool extend); void update_drag_selection (Temporal::timepos_t const & start, Temporal::timepos_t const & end, double y0, double y1, bool extend);
void update_vertical_drag_selection (double last_y, double y, bool extend); void update_vertical_drag_selection (double last_y, double y, bool extend);
void add_to_selection (NoteBase*); void add_to_selection (NoteBase*);

View File

@ -474,10 +474,10 @@ MidiStreamView::setup_rec_box ()
// handle multi // handle multi
samplepos_t start = 0; timepos_t start;
if (rec_regions.size() > 0) { if (rec_regions.size() > 0) {
start = rec_regions.back().first->start() start = rec_regions.back().first->nt_start()
+ _trackview.track()->get_captured_samples (rec_regions.size() - 1); + timepos_t (_trackview.track()->get_captured_samples (rec_regions.size() - 1));
} }
if (!rec_regions.empty()) { if (!rec_regions.empty()) {
@ -488,27 +488,26 @@ MidiStreamView::setup_rec_box ()
PropertyList plist; PropertyList plist;
plist.add (ARDOUR::Properties::start, start); plist.add (ARDOUR::Properties::start, start);
plist.add (ARDOUR::Properties::length, 1); plist.add (ARDOUR::Properties::length, timepos_t (Temporal::Beats::ticks (1)));
/* Just above we're setting this nascent region's length to 1. I think this /* Just above we're setting this nascent region's length to 1 tick. I think this is so
is so that the RegionView gets created with a non-zero width, as apparently that the RegionView gets created with a non-zero width, as apparently creating a
creating a RegionView with a zero width causes it never to be displayed RegionView with a zero width causes it never to be displayed (there is a warning in
(there is a warning in TimeAxisViewItem::init about this). However, we TimeAxisViewItem::init about this). We don't want to use 1 sample since that results
must also set length_beats to something non-zero, otherwise the sample length in zero length musical time duration.
of 1 causes length_beats to be set to some small quantity << 1. Then
when the position is set up below, this length_beats is used to recompute
length using BeatsSamplesConverter::to, which is slightly innacurate for small
beats values because it converts floating point beats to bars, beats and
integer ticks. The upshot of which being that length gets set back to 0,
meaning no region view is ever seen, meaning no MIDI notes during record (#3820).
*/ */
plist.add (ARDOUR::Properties::length_beats, 1);
plist.add (ARDOUR::Properties::name, string()); plist.add (ARDOUR::Properties::name, string());
plist.add (ARDOUR::Properties::layer, 0); plist.add (ARDOUR::Properties::layer, 0);
boost::shared_ptr<MidiRegion> region (boost::dynamic_pointer_cast<MidiRegion> boost::shared_ptr<MidiRegion> region (boost::dynamic_pointer_cast<MidiRegion>
(RegionFactory::create (sources, plist, false))); (RegionFactory::create (sources, plist, false)));
if (region) { if (region) {
region->set_position (_trackview.track()->current_capture_start ());
/* MIDI regions should likely not be positioned using audio time, but this is
* just a rec-region, so we don't really care
*/
region->set_start (timecnt_t (_trackview.track()->current_capture_start()
- _trackview.track()->get_capture_start_sample (0)));
region->set_position (_trackview.track()->current_capture_start ().samples());
RegionView* rv = add_region_view_internal (region, false, true); RegionView* rv = add_region_view_internal (region, false, true);
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv); MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv);
@ -675,12 +674,12 @@ MidiStreamView::resume_updates ()
struct RegionPositionSorter { struct RegionPositionSorter {
bool operator() (RegionView* a, RegionView* b) { bool operator() (RegionView* a, RegionView* b) {
return a->region()->position() < b->region()->position(); return a->region()->nt_position() < b->region()->nt_position();
} }
}; };
bool bool
MidiStreamView::paste (ARDOUR::samplepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num) MidiStreamView::paste (timepos_t const & pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num)
{ {
/* Paste into the first region which starts on or before pos. Only called when /* Paste into the first region which starts on or before pos. Only called when
using an internal editing tool. */ using an internal editing tool. */
@ -694,7 +693,7 @@ MidiStreamView::paste (ARDOUR::samplepos_t pos, const Selection& selection, Past
list<RegionView*>::const_iterator prev = region_views.begin (); list<RegionView*>::const_iterator prev = region_views.begin ();
for (list<RegionView*>::const_iterator i = region_views.begin(); i != region_views.end(); ++i) { for (list<RegionView*>::const_iterator i = region_views.begin(); i != region_views.end(); ++i) {
if ((*i)->region()->position() > pos) { if ((*i)->region()->nt_position() > pos) {
break; break;
} }
prev = i; prev = i;

View File

@ -87,7 +87,7 @@ public:
void set_height (uint32_t, TrackHeightMode m = OnlySelf); void set_height (uint32_t, TrackHeightMode m = OnlySelf);
boost::shared_ptr<ARDOUR::MidiRegion> add_region (ARDOUR::samplepos_t, ARDOUR::samplecnt_t, bool); boost::shared_ptr<ARDOUR::MidiRegion> add_region (Temporal::timepos_t const &, Temporal::timecnt_t const &, bool);
void show_all_automation (bool apply_to_selection = false); void show_all_automation (bool apply_to_selection = false);
void show_existing_automation (bool apply_to_selection = false); void show_existing_automation (bool apply_to_selection = false);

View File

@ -475,10 +475,10 @@ MiniTimeline::draw_edge (cairo_t* cr, int x0, int x1, bool left, const std::stri
struct LocationMarker { struct LocationMarker {
LocationMarker (const std::string& l, samplepos_t w) LocationMarker (const std::string& l, Temporal::timepos_t const & w)
: label (l), when (w) {} : label (l), when (w) {}
std::string label; std::string label;
samplepos_t when; Temporal::timepos_t when;
}; };
struct LocationMarkerSort { struct LocationMarkerSort {
@ -589,11 +589,11 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
int id = 0; int id = 0;
for (std::vector<LocationMarker>::const_iterator l = lm.begin(); l != lm.end(); ++id) { for (std::vector<LocationMarker>::const_iterator l = lm.begin(); l != lm.end(); ++id) {
samplepos_t when = (*l).when; const samplepos_t when = (*l).when.samples();
if (when < lmin) { if (when < lmin) {
outside_left = l; outside_left = l;
if (++l != lm.end()) { if (++l != lm.end()) {
left_limit = floor (width * .5 + ((*l).when - p) * _px_per_sample) - 1 - mw; left_limit = floor (width * .5 + (when - p) * _px_per_sample) - 1 - mw;
} else { } else {
left_limit = width * .5 - mw; left_limit = width * .5 - mw;
} }
@ -607,7 +607,7 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
int x1 = width; int x1 = width;
const std::string& label = (*l).label; const std::string& label = (*l).label;
if (++l != lm.end()) { if (++l != lm.end()) {
x1 = floor (width * .5 + ((*l).when - p) * _px_per_sample) - 1 - mw; x1 = floor (width * .5 + (when - p) * _px_per_sample) - 1 - mw;
} }
bool prelight = false; bool prelight = false;
x1 = draw_mark (cr, x0, x1, label, prelight); x1 = draw_mark (cr, x0, x1, label, prelight);
@ -622,7 +622,7 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
bool prelight = false; bool prelight = false;
x1 = draw_edge (cr, x0, x1, true, (*outside_left).label, prelight); x1 = draw_edge (cr, x0, x1, true, (*outside_left).label, prelight);
if (x0 != x1) { if (x0 != x1) {
_jumplist.push_back (JumpRange (x0, x1, (*outside_left).when, prelight)); _jumplist.push_back (JumpRange (x0, x1, (*outside_left).when.samples(), prelight));
right_limit = std::max (x1, right_limit); right_limit = std::max (x1, right_limit);
} }
} }
@ -635,7 +635,7 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
bool prelight = false; bool prelight = false;
x0 = draw_edge (cr, x0, x1, false, (*outside_right).label, prelight); x0 = draw_edge (cr, x0, x1, false, (*outside_right).label, prelight);
if (x0 != x1) { if (x0 != x1) {
_jumplist.push_back (JumpRange (x0, x1, (*outside_right).when, prelight)); _jumplist.push_back (JumpRange (x0, x1, (*outside_right).when.samples(), prelight));
} }
} }
} }

View File

@ -498,7 +498,7 @@ MixerStrip::trim_start_touch ()
{ {
assert (_route && _session); assert (_route && _session);
if (route()->trim() && route()->trim()->active() && route()->n_inputs().n_audio() > 0) { if (route()->trim() && route()->trim()->active() && route()->n_inputs().n_audio() > 0) {
route()->trim()->gain_control ()->start_touch (_session->transport_sample()); route()->trim()->gain_control ()->start_touch (timepos_t (_session->transport_sample()));
} }
} }
@ -507,7 +507,7 @@ MixerStrip::trim_end_touch ()
{ {
assert (_route && _session); assert (_route && _session);
if (route()->trim() && route()->trim()->active() && route()->n_inputs().n_audio() > 0) { if (route()->trim() && route()->trim()->active() && route()->n_inputs().n_audio() > 0) {
route()->trim()->gain_control ()->stop_touch (_session->transport_sample()); route()->trim()->gain_control ()->stop_touch (timepos_t (_session->transport_sample()));
} }
} }

View File

@ -505,7 +505,7 @@ public:
Temporal::RoundMode direction = Temporal::RoundNearest, Temporal::RoundMode direction = Temporal::RoundNearest,
ARDOUR::SnapPref gpref = ARDOUR::SnapToAny_Visual) = 0; ARDOUR::SnapPref gpref = ARDOUR::SnapToAny_Visual) = 0;
virtual void set_snapped_cursor_position (samplepos_t pos) = 0; virtual void set_snapped_cursor_position (Temporal::timepos_t const & pos) = 0;
virtual void get_regions_at (RegionSelection &, Temporal::timepos_t const & where, TrackViewList const &) const = 0; virtual void get_regions_at (RegionSelection &, Temporal::timepos_t const & where, TrackViewList const &) const = 0;
virtual void get_regions_after (RegionSelection&, Temporal::timepos_t const & where, const TrackViewList& ts) const = 0; virtual void get_regions_after (RegionSelection&, Temporal::timepos_t const & where, const TrackViewList& ts) const = 0;

View File

@ -391,11 +391,11 @@ RegionEditor::bounds_changed (const PropertyChange& what_changed)
sync_offset_relative_clock.set_duration (off, true); sync_offset_relative_clock.set_duration (off, true);
} }
sync_offset_absolute_clock (_region->nt_position () + off, true); sync_offset_absolute_clock.set (_region->nt_position () + off, true);
} }
if (what_changed.contains (ARDOUR::Properties::start)) { if (what_changed.contains (ARDOUR::Properties::start)) {
start_clock.set (_region->nt_start(), true); start_clock.set (timepos_t (_region->nt_start()), true);
} }
} }
@ -441,7 +441,7 @@ RegionEditor::sync_offset_relative_clock_changed ()
PublicEditor::instance().begin_reversible_command (_("change region sync point")); PublicEditor::instance().begin_reversible_command (_("change region sync point"));
_region->clear_changes (); _region->clear_changes ();
_region->set_sync_position (sync_offset_relative_clock.current_time() + _region->position ()); _region->set_sync_position (sync_offset_relative_clock.current_time() + _region->nt_position ());
_session->add_command (new StatefulDiffCommand (_region)); _session->add_command (new StatefulDiffCommand (_region));
PublicEditor::instance().commit_reversible_command (); PublicEditor::instance().commit_reversible_command ();

View File

@ -44,14 +44,12 @@ using namespace ARDOUR;
using namespace PBD; using namespace PBD;
AudioRegionGainLine::AudioRegionGainLine (const string & name, AudioRegionView& r, ArdourCanvas::Container& parent, boost::shared_ptr<AutomationList> l) AudioRegionGainLine::AudioRegionGainLine (const string & name, AudioRegionView& r, ArdourCanvas::Container& parent, boost::shared_ptr<AutomationList> l)
: AutomationLine (name, r.get_time_axis_view(), parent, l, l->parameter(), Temporal::DistanceMeasure (r.get_time_axis_view().session()->tempo_map(), r.region()->position())) : AutomationLine (name, r.get_time_axis_view(), parent, l, l->parameter(), Temporal::DistanceMeasure (r.region()->nt_position()))
, rv (r) , rv (r)
{ {
// If this isn't true something is horribly wrong, and we'll get catastrophic gain values // If this isn't true something is horribly wrong, and we'll get catastrophic gain values
assert(l->parameter().type() == EnvelopeAutomation); assert(l->parameter().type() == EnvelopeAutomation);
_time_converter->set_origin_b (rv.region()->position());
r.region()->PropertyChanged.connect (_region_changed_connection, invalidator (*this), boost::bind (&AudioRegionGainLine::region_changed, this, _1), gui_context()); r.region()->PropertyChanged.connect (_region_changed_connection, invalidator (*this), boost::bind (&AudioRegionGainLine::region_changed, this, _1), gui_context());
group->raise_to_top (); group->raise_to_top ();
@ -112,14 +110,10 @@ AudioRegionGainLine::region_changed (const PropertyChange& what_changed)
interesting_stuff.add (ARDOUR::Properties::start); interesting_stuff.add (ARDOUR::Properties::start);
interesting_stuff.add (ARDOUR::Properties::position); interesting_stuff.add (ARDOUR::Properties::position);
if (what_changed.contains (interesting_stuff)) { if (what_changed.containts (ARDOUR::Properties::position)) {
_time_converter->set_origin_b (rv.region()->position()); set_distance_measure_origin (rv.region()->nt_position());
} }
interesting_stuff.clear ();
interesting_stuff.add (ARDOUR::Properties::start);
interesting_stuff.add (ARDOUR::Properties::length);
if (what_changed.contains (interesting_stuff)) { if (what_changed.contains (interesting_stuff)) {
reset (); reset ();
} }

View File

@ -1066,7 +1066,7 @@ RegionView::update_coverage_frame (LayerDisplay d)
} }
bool bool
RegionView::trim_front (samplepos_t new_bound, bool no_overlap, const int32_t sub_num) RegionView::trim_front (timepos_t const & new_bound, bool no_overlap, const int32_t sub_num)
{ {
if (_region->locked()) { if (_region->locked()) {
return false; return false;
@ -1103,7 +1103,7 @@ RegionView::trim_front (samplepos_t new_bound, bool no_overlap, const int32_t su
} }
bool bool
RegionView::trim_end (samplepos_t new_bound, bool no_overlap, const int32_t sub_num) RegionView::trim_end (timepos_t const & new_bound, bool no_overlap, const int32_t sub_num)
{ {
if (_region->locked()) { if (_region->locked()) {
return false; return false;
@ -1151,7 +1151,7 @@ RegionView::thaw_after_trim ()
void void
RegionView::move_contents (sampleoffset_t distance) RegionView::move_contents (timecnt_t const & distance)
{ {
if (_region->locked()) { if (_region->locked()) {
return; return;

View File

@ -110,13 +110,13 @@ public:
/** Called when a front trim is about to begin */ /** Called when a front trim is about to begin */
virtual void trim_front_starting () {} virtual void trim_front_starting () {}
bool trim_front (samplepos_t, bool, const int32_t sub_num); bool trim_front (Temporal::timepos_t const &, bool);
/** Called when a start trim has finished */ /** Called when a start trim has finished */
virtual void trim_front_ending () {} virtual void trim_front_ending () {}
bool trim_end (samplepos_t, bool, const int32_t sub_num); bool trim_end (Temporal::timepos_t const &, bool);
void move_contents (ARDOUR::sampleoffset_t); void move_contents (Temporal::timecnt_t const &);
virtual void thaw_after_trim (); virtual void thaw_after_trim ();
void set_silent_frames (const ARDOUR::AudioIntervalResult&, double threshold); void set_silent_frames (const ARDOUR::AudioIntervalResult&, double threshold);

View File

@ -883,7 +883,7 @@ RouteTimeAxisView::layer_display_menu_change (Gtk::MenuItem* item)
} }
void void
RouteTimeAxisView::show_timestretch (samplepos_t start, samplepos_t end, int layers, int layer) RouteTimeAxisView::show_timestretch (timepos_t const & start, timepos_t const & end, int layers, int layer)
{ {
TimeAxisView::show_timestretch (start, end, layers, layer); TimeAxisView::show_timestretch (start, end, layers, layer);
@ -920,8 +920,10 @@ RouteTimeAxisView::show_timestretch (samplepos_t start, samplepos_t end, int lay
timestretch_rect->show (); timestretch_rect->show ();
timestretch_rect->raise_to_top (); timestretch_rect->raise_to_top ();
double const x1 = start / _editor.get_current_zoom(); #warning NUTEMPO is it ok to just fudge this being in samples?
double const x2 = (end - 1) / _editor.get_current_zoom();
double const x1 = start.samples() / _editor.get_current_zoom();
double const x2 = (end.samples() - 1) / _editor.get_current_zoom();
timestretch_rect->set (ArdourCanvas::Rect (x1, current_height() * (layers - layer - 1) / layers, timestretch_rect->set (ArdourCanvas::Rect (x1, current_height() * (layers - layer - 1) / layers,
x2, current_height() * (layers - layer) / layers)); x2, current_height() * (layers - layer) / layers));

View File

@ -95,7 +95,7 @@ public:
void set_samples_per_pixel (double); void set_samples_per_pixel (double);
void set_height (uint32_t h, TrackHeightMode m = OnlySelf); void set_height (uint32_t h, TrackHeightMode m = OnlySelf);
void show_timestretch (samplepos_t start, samplepos_t end, int layers, int layer); void show_timestretch (Temporal::timepos_t const & start, Temporal::timepos_t const & end, int layers, int layer);
void hide_timestretch (); void hide_timestretch ();
void selection_click (GdkEventButton*); void selection_click (GdkEventButton*);
void set_selected_points (PointSelection&); void set_selected_points (PointSelection&);

View File

@ -433,7 +433,7 @@ Selection::add (RegionView* r)
} }
long long
Selection::add (samplepos_t start, samplepos_t end) Selection::add (timepos_t const & start, timepos_t const & end)
{ {
clear_objects(); // enforce object/range exclusivity clear_objects(); // enforce object/range exclusivity
@ -451,7 +451,7 @@ Selection::add (samplepos_t start, samplepos_t end)
} }
void void
Selection::move_time (samplecnt_t distance) Selection::move_time (timecnt_t const & distance)
{ {
if (distance == 0) { if (distance == 0) {
return; return;
@ -466,14 +466,14 @@ Selection::move_time (samplecnt_t distance)
} }
void void
Selection::replace (uint32_t sid, samplepos_t start, samplepos_t end) Selection::replace (uint32_t sid, timepos_t const & start, timepos_t const & end)
{ {
clear_objects(); // enforce object/range exclusivity clear_objects(); // enforce object/range exclusivity
for (list<TimelineRange>::iterator i = time.begin(); i != time.end(); ++i) { for (list<TimelineRange>::iterator i = time.begin(); i != time.end(); ++i) {
if ((*i).id == sid) { if ((*i).id == sid) {
time.erase (i); time.erase (i);
time.push_back (TimelineRange(start,end, sid)); time.push_back (TimelineRange (start,end, sid));
/* don't consolidate here */ /* don't consolidate here */
@ -1040,10 +1040,16 @@ Selection::add (const list<ArdourMarker*>& m)
} }
void void
MarkerSelection::range (samplepos_t& s, samplepos_t& e) MarkerSelection::range (timepos_t& s, timepos_t& e)
{ {
s = max_samplepos; if (empty()) {
e = 0; s = timepos_t::zero (Temporal::AudioTime);
e = timepos_t::zero (Temporal::AudioTime);
return;
}
s = timepos_t::max (front()->position().time_domain());
e = timepos_t::zero (front()->position().time_domain());
for (MarkerSelection::iterator i = begin(); i != end(); ++i) { for (MarkerSelection::iterator i = begin(); i != end(); ++i) {

View File

@ -165,7 +165,7 @@ public:
void add (RegionView*); void add (RegionView*);
void add (MidiCutBuffer*); void add (MidiCutBuffer*);
void add (std::vector<RegionView*>&); void add (std::vector<RegionView*>&);
long add (samplepos_t, samplepos_t); long add (Temporal::timepos_t const &, Temporal::timepos_t const &);
void add (boost::shared_ptr<Evoral::ControlList>); void add (boost::shared_ptr<Evoral::ControlList>);
void add (boost::shared_ptr<ARDOUR::Playlist>); void add (boost::shared_ptr<ARDOUR::Playlist>);
void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&); void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&);
@ -192,9 +192,9 @@ public:
void remove_regions (TimeAxisView *); void remove_regions (TimeAxisView *);
void move_time (samplecnt_t); void move_time (Temporal::timecnt_t const &);
void replace (uint32_t time_index, samplepos_t start, samplepos_t end); void replace (uint32_t time_index, Temporal::timepos_t const & start, Temporal::timepos_t const & end);
/* /*
* A note about items in an editing Selection: * A note about items in an editing Selection:

View File

@ -828,7 +828,7 @@ TimeAxisView::set_samples_per_pixel (double fpp)
} }
void void
TimeAxisView::show_timestretch (samplepos_t start, samplepos_t end, int layers, int layer) TimeAxisView::show_timestretch (timepos_t const & start, timepos_t const & end, int layers, int layer)
{ {
for (Children::iterator i = children.begin(); i != children.end(); ++i) { for (Children::iterator i = children.begin(); i != children.end(); ++i) {
(*i)->show_timestretch (start, end, layers, layer); (*i)->show_timestretch (start, end, layers, layer);

View File

@ -177,7 +177,7 @@ public:
virtual void show_selection (TimeSelection&); virtual void show_selection (TimeSelection&);
virtual void hide_selection (); virtual void hide_selection ();
virtual void reshow_selection (TimeSelection&); virtual void reshow_selection (TimeSelection&);
virtual void show_timestretch (samplepos_t start, samplepos_t end, int layers, int layer); virtual void show_timestretch (Temporal::timepos_t const & start, Temporal::timepos_t const & end, int layers, int layer);
virtual void hide_timestretch (); virtual void hide_timestretch ();
/* editing operations */ /* editing operations */