Ardour  9.0-pre0-822-g12e3bc5c20
midi_view.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2015 David Robillard <d@drobilla.net>
3  * Copyright (C) 2008-2012 Hans Baier <hansfbaier@googlemail.com>
4  * Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
6  * Copyright (C) 2015-2016 Tim Mayberry <mojofunk@gmail.com>
7  * Copyright (C) 2015-2017 Nick Mainsbridge <mainsbridge@gmail.com>
8  * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 
25 #pragma once
26 
27 #include <string>
28 #include <vector>
29 #include <stdint.h>
30 
31 #include <unordered_map>
32 
33 #include <sigc++/signal.h>
34 
35 #include "pbd/signals.h"
36 
37 #include "ardour/midi_model.h"
38 #include "ardour/types.h"
39 
40 #include "canvas/rectangle.h"
41 
42 #include "editing.h"
43 #include "region_view.h"
44 #include "midi_view_background.h"
45 #include "time_axis_view_item.h"
46 #include "editor_automation_line.h"
47 #include "enums.h"
48 #include "line_merger.h"
49 
50 namespace ARDOUR {
51  class MidiRegion;
52  class MidiModel;
53  class MidiTrack;
54  class Filter;
55 };
56 
57 namespace MIDI {
58  namespace Name {
59  struct PatchPrimaryKey;
60  };
61 };
62 
63 class SysEx;
64 class Note;
65 class Hit;
66 class MidiTimeAxisView;
67 class NoteBase;
68 class GhostRegion;
71 class MidiCutBuffer;
72 class MidiListEditor;
73 class EditNoteDialog;
74 class PatchChange;
75 class ItemCounts;
76 class CursorContext;
78 class EditingContext;
79 class PasteContext;
80 class Drag;
81 
83 {
84  public:
86 
87  void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> context) const;
88  bool covers (ArdourCanvas::Duple const& point) const;
89  void compute_bounding_box () const;
90 };
91 
93 {
94  public:
96 
97  void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> context) const;
98  bool covers (ArdourCanvas::Duple const& point) const;
99  void compute_bounding_box () const;
100 };
101 
102 class MidiView : public virtual sigc::trackable, public LineMerger
103 {
104  public:
107 
108  MidiView (std::shared_ptr<ARDOUR::MidiTrack> mt,
109  ArdourCanvas::Item& parent,
110  EditingContext& ec,
111  MidiViewBackground& bg,
112  uint32_t basic_color);
113  MidiView (MidiView const & other);
114 
115  virtual ~MidiView ();
116 
117  void init (bool wfd);
118 
119  virtual void set_samples_per_pixel (double) {};
120 
121  virtual bool display_is_enabled() const { return true; }
122 
123  virtual ArdourCanvas::Item* drag_group() const = 0;
124 
125  void step_add_note (uint8_t channel, uint8_t number, uint8_t velocity,
128  virtual void set_height (double);
129  void apply_note_range(uint8_t lowest, uint8_t highest, bool force=false);
130 
131  // inline ARDOUR::ColorMode color_mode() const { return _background->color_mode(); }
132 
133  virtual uint32_t get_fill_color() const;
134  void color_handler ();
135 
140 
141  virtual GhostRegion* add_ghost (TimeAxisView&) { return nullptr; }
142  virtual std::string get_modifier_name() const;
143 
144  virtual void set_region (std::shared_ptr<ARDOUR::MidiRegion>);
145  virtual void set_track (std::shared_ptr<ARDOUR::MidiTrack>);
146  virtual void set_model (std::shared_ptr<ARDOUR::MidiModel>);
147 
148  void set_show_source (bool yn);
149 
150  NoteBase* add_note(const std::shared_ptr<NoteType> note, bool visible);
151 
154  void paste_internal (Temporal::timepos_t const & pos, unsigned paste_count, float times, const MidiCutBuffer&);
155 
158 
165  void get_patch_key_at (Temporal::Beats time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key) const;
166 
170 
175  void change_patch_change (PatchChange& old_patch, const MIDI::Name::PatchPrimaryKey& new_patch);
177 
182 
184 
191  void step_patch (PatchChange& patch, bool bank, int delta);
192 
196 
200 
201  void begin_write ();
202  void end_write ();
205 
206  virtual void begin_drag_edit (std::string const & why);
207  void end_drag_edit ();
208 
209  void display_model(std::shared_ptr<ARDOUR::MidiModel> model);
210  std::shared_ptr<ARDOUR::MidiModel> model() const { return _model; }
211 
212  /* note_diff commands should start here; this initiates an undo record */
213  void start_note_diff_command (std::string name = "midi edit");
214 
217  void note_diff_add_note (const std::shared_ptr<NoteType> note, bool selected, bool show_velocity = false);
219 
220  /* note_diff commands should be completed with one of these calls; they may (or may not) commit the undo record */
221  void apply_note_diff (bool as_subcommand = false, bool was_copy = false);
223 
225  void note_left(NoteBase* ev);
228  void sysex_entered (SysEx* p);
229  void sysex_left (SysEx* p);
230  void note_mouse_position (float xfraction, float yfraction, bool can_set_cursor=true);
232  void note_selected(NoteBase* ev, bool add, bool extend=false);
235  void delete_note (std::shared_ptr<NoteType>);
236  size_t selection_size() { return _selection.size(); }
242 
244  void move_selection(Temporal::timecnt_t const & dx, double dy, double cumulative_dy);
245  void note_dropped (NoteBase* ev, Temporal::timecnt_t const & d_qn, int8_t d_note, bool copy);
247  void move_copies(Temporal::timecnt_t const & dx_qn, double dy, double cumulative_dy);
248 
249  void select_notes (std::list<Evoral::event_id_t>, bool allow_audition);
250  void select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend);
251  void toggle_matching_notes (uint8_t notenum, uint16_t channel_mask);
252 
259  virtual bool note_in_region_range(const std::shared_ptr<NoteType> note, bool& visible) const;
260  /* Test if a note is within this region's time range. Return true if so */
261  virtual bool note_in_region_time_range(const std::shared_ptr<NoteType> note) const;
262 
265 
268 
273  void begin_resizing(bool at_front);
274 
275  void update_resizing (NoteBase* primary, bool at_front, double delta_x, bool relative, double snap_delta, bool with_snap);
276  void finish_resizing (NoteBase* primary, bool at_front, double delat_x, bool relative, double snap_delta, bool with_snap);
277  void abort_resizing ();
278 
282  void change_channel(uint8_t channel);
283 
284  struct NoteResizeData {
287  };
288 
289  /* Convert a position to a distance (origin+position) relative to the
290  * start of this MidiView.
291  *
292  * What this is relative to will depend on whether or not _show_source
293  * is true.
294  */
295 
297 
299 
301 
307  double snap_to_pixel(double x, bool ensure_snap = false);
308 
315  Temporal::timecnt_t snap_pixel_to_time (double x, bool ensure_snap = false);
316 
319  void change_note_lengths (bool, bool, Temporal::Beats beats, bool start, bool end);
320  void change_velocities (bool up, bool fine, bool allow_smush, bool all_together);
321  void set_velocity (NoteBase* primary, int velocity);
322  bool set_velocity_for_notes (std::vector<NoteBase*>& notes, int velocity);
323  bool set_velocities_for_notes (std::vector<NoteBase*>& notes, std::vector<int>& velocities);
324  void transpose (bool up, bool fine, bool allow_smush);
325  void nudge_notes (bool forward, bool fine);
326  void channel_edit ();
327  void velocity_edit ();
328 
330 
331  void set_note_range (uint8_t low, uint8_t high);
332  void maybe_set_note_range (uint8_t low, uint8_t high);
334 
335  typedef std::set<NoteBase*> Selection;
336  Selection const & selection () const {
337  return _selection;
338  }
339 
340  void selection_as_notelist (Notes& selected, bool allow_all_if_none_selected = false);
341 
344 
347 
355  void create_note_at (Temporal::timepos_t const & t, double y, Temporal::Beats length, uint32_t state, bool shift_snap);
356 
361 
364 
365  void show_verbose_cursor_for_new_note_value(std::shared_ptr<NoteType> current_note, uint8_t new_note) const;
366 
367  std::shared_ptr<ARDOUR::MidiTrack> midi_track() const { return _midi_track; }
368  std::shared_ptr<ARDOUR::MidiRegion> midi_region() const { return _midi_region; }
371 
373 
374  virtual void select_self (bool add) {}
375  virtual void unselect_self () {}
376  void select_self () { select_self (false); }
377  virtual void select_self_uniquely () {}
378 
379  void show_start (bool yn);
380  void show_end (bool yn);
381 
382  virtual bool midi_canvas_group_event(GdkEvent* ev);
383 
384  protected:
385  void init (std::shared_ptr<ARDOUR::MidiTrack>);
386  virtual void region_resized (const PBD::PropertyChange&);
387 
388  void set_flags (XMLNode *);
389  void store_flags ();
390 
392 
393  void redisplay (bool view_only);
394 
395  protected:
396  friend class EditingContext;
397  friend class Editor; // grr, C++ does not allow inheritance of friendship
398 
401 
402  void move_note_starts_earlier_fine () { change_note_lengths (true, false, Temporal::Beats(), true, false); }
403  void move_note_starts_earlier () { change_note_lengths (false, false, Temporal::Beats(), true, false); }
404  void move_note_ends_later_fine () { change_note_lengths (true, false, Temporal::Beats(), false, true); }
405  void move_note_ends_later () { change_note_lengths (false, false, Temporal::Beats(), false, true); }
406  void move_note_starts_later_fine () { change_note_lengths (true, true, Temporal::Beats(), true, false); }
407  void move_note_starts_later () { change_note_lengths (false, true, Temporal::Beats(), true, false); }
408  void move_note_ends_earlier_fine () { change_note_lengths (true, true, Temporal::Beats(), false, true); }
409  void move_note_ends_earlier () { change_note_lengths (false, true, Temporal::Beats(), false, true); }
410 
411  void select_next_note () { goto_next_note (false); }
415 
416  void increase_note_velocity () { change_velocities (true, false, false, false); }
417  void increase_note_velocity_fine () { change_velocities (true, true, false, false); }
418  void increase_note_velocity_smush () { change_velocities (true, false, true, false); }
419  void increase_note_velocity_together () { change_velocities (true, false, false, true); }
420  void increase_note_velocity_fine_smush () { change_velocities (true, true, true, false); }
421  void increase_note_velocity_fine_together () { change_velocities (true, true, false, true); }
422  void increase_note_velocity_smush_together () { change_velocities (true, false, true, true); }
423  void increase_note_velocity_fine_smush_together () { change_velocities (true, true, true, true); }
424 
425  void decrease_note_velocity () { change_velocities (false, false, false, false); }
426  void decrease_note_velocity_fine () { change_velocities (false, true, false, false); }
427  void decrease_note_velocity_smush () { change_velocities (false, false, true, false); }
428  void decrease_note_velocity_together () { change_velocities (false, false, false, true); }
429  void decrease_note_velocity_fine_smush () { change_velocities (false, true, true, false); }
430  void decrease_note_velocity_fine_together () { change_velocities (false, true, false, true); }
431  void decrease_note_velocity_smush_together () { change_velocities (false, false, true, true); }
432  void decrease_note_velocity_fine_smush_together () { change_velocities (false, true, true, true); }
433 
434  void transpose_up_octave () { transpose (true, false, false); }
435  void transpose_up_octave_smush () { transpose (true, false, true); }
436  void transpose_up_tone () { transpose (true, true, false); }
437  void transpose_up_tone_smush () { transpose (true, true, true); }
438 
439  void transpose_down_octave () { transpose (false, false, false); }
440  void transpose_down_octave_smush () { transpose (false, false, true); }
441  void transpose_down_tone () { transpose (false, true, false); }
442  void transpose_down_tone_smush () { transpose (false, true, true); }
443 
444  void nudge_notes_later () { nudge_notes (true, false); }
445  void nudge_notes_later_fine () { nudge_notes (true, true); }
446  void nudge_notes_earlier () { nudge_notes (false, false); }
447  void nudge_notes_earlier_fine () { nudge_notes (false, true); }
448 
450 
451  protected:
454  friend class NoteDrag;
455  friend class NoteCreateDrag;
456  friend class HitCreateDrag;
457  friend class MidiGhostRegion;
458 
459  friend class EditNoteDialog;
460 
464  void play_midi_note (std::shared_ptr<NoteType> note);
465  void start_playing_midi_note (std::shared_ptr<NoteType> note);
466  void start_playing_midi_chord (std::vector<std::shared_ptr<NoteType> > notes);
467 
471 
472  void clear_events ();
473  virtual void clear_ghost_events() {}
474  virtual void ghosts_model_changed() {}
475  virtual void ghosts_view_changed() {}
476  virtual void ghost_remove_note (NoteBase*) {}
477  virtual void ghost_add_note (NoteBase*) {}
478  virtual void ghost_sync_selection (NoteBase*) {}
479 
480  bool note_canvas_event(GdkEvent* ev);
481 
487 
490 
491  void change_note_channel (NoteBase *, int8_t, bool relative=false);
492  void change_note_velocity(NoteBase* ev, int8_t vel, bool relative=false);
493  uint8_t change_note_note(NoteBase* ev, int8_t note, bool relative=false);
494  void change_note_time(NoteBase* ev, ARDOUR::MidiModel::TimeType, bool relative=false);
497  ARDOUR::MidiModel::TimeType end_delta);
498 
499  void update_drag_selection (Temporal::timepos_t const & start, Temporal::timepos_t const & end, double y0, double y1, bool extend);
500  void update_vertical_drag_selection (double last_y, double y, bool extend);
501 
504 
505  std::string get_note_name (std::shared_ptr<NoteType> note, uint8_t note_value) const;
506 
507  void show_verbose_cursor (std::string const &, double, double) const;
508  void show_verbose_cursor (std::shared_ptr<NoteType>) const;
509 
512 
513  typedef std::unordered_map<std::shared_ptr<NoteType>, NoteBase*> Events;
514  typedef std::unordered_map<ARDOUR::MidiModel::PatchChangePtr, std::shared_ptr<PatchChange> > PatchChanges;
515  typedef std::unordered_map<ARDOUR::MidiModel::constSysExPtr, std::shared_ptr<SysEx> > SysExes;
516  typedef std::vector<NoteBase*> CopyDragEvents;
517 
518  std::shared_ptr<ARDOUR::MidiTrack> _midi_track;
521  std::shared_ptr<ARDOUR::MidiModel> _model;
522  std::shared_ptr<ARDOUR::MidiRegion> _midi_region;
543 
546 
548 
551  std::set< std::shared_ptr<NoteType> > _marked_for_selection;
552 
554  std::set<Evoral::event_id_t> _pending_note_selection;
555 
558  std::set< std::shared_ptr<NoteType> > _marked_for_velocity;
559 
560  std::vector<NoteResizeData *> _resize_data;
561 
564  NoteBase* find_canvas_note (std::shared_ptr<NoteType>);
566  Events::iterator _optimization_iterator;
567 
570 
571  friend class VelocityDisplay;
572  void sync_velocity_drag (double factor);
573 
575  virtual void update_sustained (Note *);
576  virtual void update_hit (Hit *);
577 
578  void create_ghost_note (double, double, uint32_t state);
579  void update_ghost_note (double, double, uint32_t state);
580 
583 
584  void snap_changed ();
585 
586  virtual bool motion (GdkEventMotion*);
587  virtual bool scroll (GdkEventScroll*);
588  virtual bool key_press (GdkEventKey*);
589  virtual bool key_release (GdkEventKey*);
590  virtual bool button_press (GdkEventButton*);
591  virtual bool button_release (GdkEventButton*);
592  virtual bool enter_notify (GdkEventCrossing*);
593  virtual bool leave_notify (GdkEventCrossing*);
594 
595  void drop_down_keys ();
596  void maybe_select_by_position (GdkEventButton* ev, double x, double y);
597  void get_events (Events& e, Evoral::Sequence<Temporal::Beats>::NoteOperator op, uint8_t val, int chan_mask = 0);
598 
599  void display_patch_changes_on_channel (uint8_t, bool);
600 
601  void data_recorded (std::weak_ptr<ARDOUR::MidiSource>);
602 
605 
607 
609  virtual void mouse_mode_changed ();
610  virtual void enter_internal (uint32_t state);
611  virtual void leave_internal ();
613 
615 
618  bool _entered;
621 
623 
626 
628  uint16_t get_selected_channels () const;
629 
630  virtual double height() const;
631 
632  virtual double contents_height() const { return height() - 2; }
633  inline double note_height() const { return contents_height() / _midi_context.contents_note_range(); }
634 
635  double note_to_y (uint8_t note) const { return _midi_context.note_to_y (note); }
636  uint8_t y_to_note (double y) const { return _midi_context.y_to_note (y); }
637 
639  void update_sysexes ();
640  void view_changed ();
641  void model_changed ();
643 
645 
646  struct SplitInfo {
649  int note;
650  int channel;
651  int velocity;
653 
654  SplitInfo (Temporal::Beats const & t, Temporal::Beats const & l, int n, int c, int v, int ov)
655  : time (t)
656  , base_len (l)
657  , note (n)
658  , channel (c)
659  , velocity (v)
660  , off_velocity (ov) {}
661  };
662  std::vector<SplitInfo> split_info;
663 
664  uint32_t split_tuple;
666  bool _extensible; /* if true, we can add data beyond the current region/source end */
667 
668  bool extensible() const { return _extensible; }
669  void set_extensible (bool yn) { _extensible = yn; }
670 
673 
677  void join_notes ();
678  void join_notes_on_channel (int channel);
679 
681  void region_update_sustained (Note *, double&, double&, double&, double&);
682  void clip_capture_update_sustained (Note *, double&, double&, double&, double&);
683 
685  void size_end_rect ();
686  bool start_boundary_event (GdkEvent*);
687  bool end_boundary_event (GdkEvent*);
688 
689  virtual void add_control_points_to_selection (Temporal::timepos_t const &, Temporal::timepos_t const &, double y0, double y1) {}
690 };
691 
692 
Definition: editor.h:159
bool covers(ArdourCanvas::Duple const &point) const
EndBoundaryRect(ArdourCanvas::Item *p)
Definition: midi_view.h:95
void compute_bounding_box() const
void render(ArdourCanvas::Rect const &area, Cairo::RefPtr< Cairo::Context > context) const
std::shared_ptr< PatchChange< Temporal::Beats > > PatchChangePtr
Definition: Sequence.h:205
std::multiset< NotePtr, EarlierNoteComparator > Notes
Definition: Sequence.h:157
std::shared_ptr< Event< Temporal::Beats > > SysExPtr
Definition: Sequence.h:192
Definition: Filter.h:21
Definition: hit.h:30
uint8_t y_to_note(double y) const
double note_to_y(uint8_t note) const
uint8_t contents_note_range() const
void size_start_rect()
void select_next_note()
Definition: midi_view.h:411
bool extensible() const
Definition: midi_view.h:668
void edit_patch_change(PatchChange *)
void duplicate_selection()
void update_drag_selection(Temporal::timepos_t const &start, Temporal::timepos_t const &end, double y0, double y1, bool extend)
std::string get_note_name(std::shared_ptr< NoteType > note, uint8_t note_value) const
void decrease_note_velocity()
Definition: midi_view.h:425
std::shared_ptr< ARDOUR::MidiRegion > midi_region() const
Definition: midi_view.h:368
std::set< std::shared_ptr< NoteType > > _marked_for_selection
Definition: midi_view.h:551
bool set_velocity_for_notes(std::vector< NoteBase * > &notes, int velocity)
void display_patch_changes()
StartBoundaryRect * _start_boundary_rect
Definition: midi_view.h:538
void trim_front_starting()
void extend_active_notes()
void update_resizing(NoteBase *primary, bool at_front, double delta_x, bool relative, double snap_delta, bool with_snap)
Temporal::Beats get_draw_length_beats(Temporal::timepos_t const &pos) const
std::shared_ptr< ARDOUR::MidiModel > _model
Definition: midi_view.h:521
void nudge_notes_earlier()
Definition: midi_view.h:446
void delete_note(std::shared_ptr< NoteType >)
NoteBase * _entered_note
Definition: midi_view.h:619
virtual void ghost_sync_selection(NoteBase *)
Definition: midi_view.h:478
PBD::ScopedConnection track_going_away_connection
Definition: midi_view.h:483
ArdourCanvas::Container * _note_group
Definition: midi_view.h:529
void note_diff_add_change(NoteBase *ev, ARDOUR::MidiModel::NoteDiffCommand::Property, uint8_t val)
Temporal::timecnt_t relative_position(Temporal::timepos_t const &p) const
void extend_note_selection()
virtual bool button_press(GdkEventButton *)
NoteBase * add_note(const std::shared_ptr< NoteType > note, bool visible)
void transpose_down_tone_smush()
Definition: midi_view.h:442
void decrease_note_velocity_smush()
Definition: midi_view.h:427
Temporal::Beats earliest_in_selection()
void change_note_length(NoteBase *, ARDOUR::MidiModel::TimeType)
void nudge_notes_later()
Definition: midi_view.h:444
std::vector< NoteResizeData * > _resize_data
Definition: midi_view.h:560
void model_changed()
void get_events(Events &e, Evoral::Sequence< Temporal::Beats >::NoteOperator op, uint8_t val, int chan_mask=0)
virtual bool note_in_region_range(const std::shared_ptr< NoteType > note, bool &visible) const
void remove_from_selection(NoteBase *)
virtual void select_self(bool add)
Definition: midi_view.h:374
void select_all_notes()
double _last_ghost_x
Definition: midi_view.h:532
void store_flags()
Temporal::Beats _step_edit_cursor_position
Definition: midi_view.h:536
void transpose_down_octave_smush()
Definition: midi_view.h:440
NoteBase * channel_selector_scoped_note()
Definition: midi_view.h:343
void end_note_splitting()
void start_playing_midi_chord(std::vector< std::shared_ptr< NoteType > > notes)
void set_show_source(bool yn)
void invert_selection()
void display_sysexes()
std::shared_ptr< SysEx > find_canvas_sys_ex(ARDOUR::MidiModel::SysExPtr s)
void show_verbose_cursor(std::string const &, double, double) const
void step_patch(PatchChange &patch, bool bank, int delta)
void maybe_set_note_range(uint8_t low, uint8_t high)
virtual bool key_release(GdkEventKey *)
MidiView(MidiView const &other)
void trim_front_ending()
void move_note_ends_later()
Definition: midi_view.h:405
void increase_note_velocity_smush()
Definition: midi_view.h:418
void nudge_notes_later_fine()
Definition: midi_view.h:445
MidiListEditor * _list_editor
Definition: midi_view.h:581
void apply_note_range(uint8_t lowest, uint8_t highest, bool force=false)
virtual ~MidiView()
void increase_note_velocity_fine_together()
Definition: midi_view.h:421
void increase_note_velocity_fine()
Definition: midi_view.h:417
Drag * selection_drag
Definition: midi_view.h:541
bool paste(Temporal::timepos_t const &pos, const ::Selection &selection, PasteContext &ctx)
void decrease_note_velocity_fine_smush_together()
Definition: midi_view.h:432
void extend_selection()
void change_note_lengths(bool, bool, Temporal::Beats beats, bool start, bool end)
uint32_t split_tuple
Definition: midi_view.h:664
void goto_previous_note(bool add_to_selection)
bool _select_all_notes_after_add
Definition: midi_view.h:620
void extend_active_notes(Temporal::timecnt_t const &)
virtual void update_hit(Hit *)
void decrease_note_velocity_smush_together()
Definition: midi_view.h:431
virtual bool motion(GdkEventMotion *)
double _last_ghost_y
Definition: midi_view.h:533
void note_selected(NoteBase *ev, bool add, bool extend=false)
void change_note_velocity(NoteBase *ev, int8_t vel, bool relative=false)
void change_patch_change(ARDOUR::MidiModel::PatchChangePtr, Evoral::PatchChange< Temporal::Beats > const &)
void add_select_previous_note()
Definition: midi_view.h:414
Temporal::timecnt_t snap_pixel_to_time(double x, bool ensure_snap=false)
void unique_select(NoteBase *ev)
void join_notes()
void move_note_ends_later_fine()
Definition: midi_view.h:404
void change_patch_change(PatchChange &old_patch, const MIDI::Name::PatchPrimaryKey &new_patch)
void abort_resizing()
bool _extensible
Definition: midi_view.h:666
void decrease_note_velocity_fine_together()
Definition: midi_view.h:430
void sync_velocity_drag(double factor)
uint8_t y_to_note(double y) const
Definition: midi_view.h:636
void sysex_entered(SysEx *p)
void update_patch_changes()
void move_copies(Temporal::timecnt_t const &dx_qn, double dy, double cumulative_dy)
double _last_event_x
Definition: midi_view.h:616
void move_note_starts_earlier_fine()
Definition: midi_view.h:402
Selection _selection
Definition: midi_view.h:545
MidiViewBackground & midi_context() const
Definition: midi_view.h:370
void update_ghost_note(double, double, uint32_t state)
void split_notes_grid()
void show_verbose_cursor(std::shared_ptr< NoteType >) const
void note_left(NoteBase *ev)
void step_sustain(Temporal::Beats beats)
std::shared_ptr< ARDOUR::MidiTrack > _midi_track
Definition: midi_view.h:518
uint8_t get_velocity_for_add(ARDOUR::MidiModel::TimeType time) const
void clear_selection()
void decrease_note_velocity_together()
Definition: midi_view.h:428
virtual bool enter_notify(GdkEventCrossing *)
void show_start(bool yn)
void transpose_down_tone()
Definition: midi_view.h:441
Events _events
Definition: midi_view.h:523
EditingContext & _editing_context
Definition: midi_view.h:519
bool end_boundary_event(GdkEvent *)
void add_split_notes()
void sync_ghost_selection(NoteBase *)
NoteBase * copy_selection(NoteBase *primary)
void start_note_splitting()
void paste_internal(Temporal::timepos_t const &pos, unsigned paste_count, float times, const MidiCutBuffer &)
virtual bool scroll(GdkEventScroll *)
std::unordered_map< std::shared_ptr< NoteType >, NoteBase * > Events
Definition: midi_view.h:513
void change_channel(uint8_t channel)
MidiView(std::shared_ptr< ARDOUR::MidiTrack > mt, ArdourCanvas::Item &parent, EditingContext &ec, MidiViewBackground &bg, uint32_t basic_color)
ARDOUR::ChannelMode get_channel_mode() const
void invert_note_selection()
void drop_down_keys()
void note_diff_add_note(const std::shared_ptr< NoteType > note, bool selected, bool show_velocity=false)
void sysex_left(SysEx *p)
void redisplay(bool view_only)
void note_diff_remove_note(NoteBase *ev)
void move_step_edit_cursor(Temporal::Beats pos)
void add_select_next_note()
Definition: midi_view.h:413
void abort_note_diff()
virtual void ghosts_model_changed()
Definition: midi_view.h:474
void begin_resizing(bool at_front)
bool _entered
Definition: midi_view.h:618
void maybe_select_by_position(GdkEventButton *ev, double x, double y)
virtual void set_track(std::shared_ptr< ARDOUR::MidiTrack >)
virtual void ghost_remove_note(NoteBase *)
Definition: midi_view.h:476
Evoral::Sequence< Temporal::Beats >::Notes Notes
Definition: midi_view.h:106
Temporal::timepos_t start() const
void remove_ghost_note()
virtual void set_visibility_note_range(MidiViewBackground::VisibleNoteRange, bool)
std::set< Evoral::event_id_t > _pending_note_selection
Definition: midi_view.h:554
void add_canvas_patch_change(ARDOUR::MidiModel::PatchChangePtr patch)
void update_sysexes()
void start_note_diff_command(std::string name="midi edit")
void clip_capture_update_sustained(Note *, double &, double &, double &, double &)
double get_end_position_pixels()
void velocity_edit()
virtual bool leave_notify(GdkEventCrossing *)
NoteBase * find_canvas_note(Evoral::event_id_t id)
virtual void leave_internal()
bool note_canvas_event(GdkEvent *ev)
virtual void reset_width_dependent_items(double pixel_width)
virtual void begin_drag_edit(std::string const &why)
void cut_copy_clear(Editing::CutCopyOp)
bool start_boundary_event(GdkEvent *)
void data_recorded(std::weak_ptr< ARDOUR::MidiSource >)
void snap_changed()
std::shared_ptr< ARDOUR::MidiTrack > midi_track() const
Definition: midi_view.h:367
void note_deselected(NoteBase *ev)
EndBoundaryRect * _end_boundary_rect
Definition: midi_view.h:539
virtual void mouse_mode_changed()
void move_note_starts_later_fine()
Definition: midi_view.h:406
void set_note_range(uint8_t low, uint8_t high)
virtual void region_resized(const PBD::PropertyChange &)
MidiCutBuffer * selection_as_cut_buffer() const
void show_list_editor()
void change_velocities(bool up, bool fine, bool allow_smush, bool all_together)
void patch_left(PatchChange *)
void begin_write()
virtual GhostRegion * add_ghost(TimeAxisView &)
Definition: midi_view.h:141
void goto_next_note(bool add_to_selection)
double get_position_pixels()
bool set_velocities_for_notes(std::vector< NoteBase * > &notes, std::vector< int > &velocities)
MidiViewBackground & _midi_context
Definition: midi_view.h:520
void hide_verbose_cursor()
void select_range(Temporal::timepos_t const &start, Temporal::timepos_t const &end)
bool note_splitting
Definition: midi_view.h:665
void create_note_at(Temporal::timepos_t const &t, double y, Temporal::Beats length, uint32_t state, bool shift_snap)
void size_end_rect()
size_t selection_size()
Definition: midi_view.h:236
virtual bool button_release(GdkEventButton *)
void increase_note_velocity_fine_smush()
Definition: midi_view.h:420
void update_vertical_drag_selection(double last_y, double y, bool extend)
ArdourCanvas::Rectangle * _step_edit_cursor
Definition: midi_view.h:534
virtual ArdourCanvas::Item * drag_group() const =0
Events::iterator _optimization_iterator
Definition: midi_view.h:566
Gtkmm2ext::Color _patch_change_outline
Definition: midi_view.h:624
virtual void clear_ghost_events()
Definition: midi_view.h:473
void select_previous_note()
Definition: midi_view.h:412
SysExes _sys_exes
Definition: midi_view.h:526
void delete_patch_change(PatchChange *)
void quantize_selected_notes()
void create_ghost_note(double, double, uint32_t state)
Temporal::timecnt_t active_note_end
Definition: midi_view.h:528
double note_height() const
Definition: midi_view.h:633
void nudge_notes(bool forward, bool fine)
void move_note_starts_later()
Definition: midi_view.h:407
MIDI::Name::PatchPrimaryKey patch_change_to_patch_key(ARDOUR::MidiModel::PatchChangePtr)
PatchChanges _patch_changes
Definition: midi_view.h:525
std::shared_ptr< ARDOUR::MidiModel > model() const
Definition: midi_view.h:210
void increase_note_velocity_smush_together()
Definition: midi_view.h:422
virtual void ghost_add_note(NoteBase *)
Definition: midi_view.h:477
void show_end(bool yn)
void note_mouse_position(float xfraction, float yfraction, bool can_set_cursor=true)
virtual bool note_in_region_time_range(const std::shared_ptr< NoteType > note) const
virtual std::string get_modifier_name() const
double snap_to_pixel(double x, bool ensure_snap=false)
virtual double height() const
void delete_sysex(SysEx *)
void move_note_ends_earlier()
Definition: midi_view.h:409
void clear_note_selection()
std::shared_ptr< PatchChange > find_canvas_patch_change(ARDOUR::MidiModel::PatchChangePtr p)
void decrease_note_velocity_fine()
Definition: midi_view.h:426
void move_note_ends_earlier_fine()
Definition: midi_view.h:408
void set_step_edit_cursor_width(Temporal::Beats beats)
void view_changed()
void start_playing_midi_note(std::shared_ptr< NoteType > note)
void instrument_settings_changed()
double note_to_y(uint8_t note) const
Definition: midi_view.h:635
std::vector< SplitInfo > split_info
Definition: midi_view.h:662
void clip_data_recorded(samplecnt_t)
void select_self()
Definition: midi_view.h:376
Note ** _active_notes
Definition: midi_view.h:527
void set_extensible(bool yn)
Definition: midi_view.h:669
double _last_event_y
Definition: midi_view.h:617
void set_flags(XMLNode *)
void play_midi_note(std::shared_ptr< NoteType > note)
virtual void set_height(double)
void hide_step_edit_cursor()
virtual bool midi_canvas_group_event(GdkEvent *ev)
void transpose_down_octave()
Definition: midi_view.h:439
void note_diff_add_change(NoteBase *ev, ARDOUR::MidiModel::NoteDiffCommand::Property, Temporal::Beats val)
Temporal::Beats _step_edit_cursor_width
Definition: midi_view.h:535
void region_update_sustained(Note *, double &, double &, double &, double &)
ARDOUR::MidiModel::NoteDiffCommand * _note_diff_command
Definition: midi_view.h:530
PBD::ScopedConnectionList connections_requiring_model
Definition: midi_view.h:482
void transpose_up_octave_smush()
Definition: midi_view.h:435
void move_selection(Temporal::timecnt_t const &dx, double dy, double cumulative_dy)
void select_matching_notes(uint8_t notenum, uint16_t channel_mask, bool add, bool extend)
void split_notes_more()
Temporal::Beats get_grid_beats(Temporal::timepos_t const &pos) const
bool _mouse_changed_selection
Definition: midi_view.h:622
void toggle_matching_notes(uint8_t notenum, uint16_t channel_mask)
void apply_note_diff(bool as_subcommand=false, bool was_copy=false)
void move_note_starts_earlier()
Definition: midi_view.h:403
void increase_note_velocity_together()
Definition: midi_view.h:419
void end_write()
samplecnt_t _last_display_zoom
Definition: midi_view.h:614
void delete_selection()
std::unordered_map< ARDOUR::MidiModel::constSysExPtr, std::shared_ptr< SysEx > > SysExes
Definition: midi_view.h:515
Selection const & selection() const
Definition: midi_view.h:336
virtual bool key_press(GdkEventKey *)
void show_verbose_cursor_for_new_note_value(std::shared_ptr< NoteType > current_note, uint8_t new_note) const
void split_notes_less()
void move_patch_change(PatchChange &, Temporal::Beats)
Temporal::timepos_t source_beats_to_timeline(Temporal::Beats const &) const
void change_note_time(NoteBase *ev, ARDOUR::MidiModel::TimeType, bool relative=false)
void set_velocity(NoteBase *primary, int velocity)
void get_patch_key_at(Temporal::Beats time, uint8_t channel, MIDI::Name::PatchPrimaryKey &key) const
void display_model(std::shared_ptr< ARDOUR::MidiModel > model)
void show_step_edit_cursor(Temporal::Beats pos)
Gtkmm2ext::Color _patch_change_fill
Definition: midi_view.h:625
void add_patch_change(Temporal::timecnt_t const &, Evoral::PatchChange< Temporal::Beats > const &)
std::unordered_map< ARDOUR::MidiModel::PatchChangePtr, std::shared_ptr< PatchChange > > PatchChanges
Definition: midi_view.h:514
Evoral::Note< Temporal::Beats > NoteType
Definition: midi_view.h:105
uint16_t get_selected_channels() const
void change_note_channel(NoteBase *, int8_t, bool relative=false)
EditingContext & editing_context() const
Definition: midi_view.h:369
void update_note(NoteBase *)
void add_to_selection(NoteBase *)
void select_notes(std::list< Evoral::event_id_t >, bool allow_audition)
void init(bool wfd)
virtual void set_samples_per_pixel(double)
Definition: midi_view.h:119
NoteBase * _channel_selection_scoped_note
Definition: midi_view.h:537
void trim_note(NoteBase *ev, ARDOUR::MidiModel::TimeType start_delta, ARDOUR::MidiModel::TimeType end_delta)
virtual bool display_is_enabled() const
Definition: midi_view.h:121
virtual void ghosts_view_changed()
Definition: midi_view.h:475
void note_deleted(NoteBase *)
std::set< std::shared_ptr< NoteType > > _marked_for_velocity
Definition: midi_view.h:558
Drag * draw_drag
Definition: midi_view.h:542
void init(std::shared_ptr< ARDOUR::MidiTrack >)
virtual void unselect_self()
Definition: midi_view.h:375
void finish_resizing(NoteBase *primary, bool at_front, double delat_x, bool relative, double snap_delta, bool with_snap)
virtual double contents_height() const
Definition: midi_view.h:632
virtual void update_sustained(Note *)
void channel_edit()
void region_going_away()
void increase_note_velocity_fine_smush_together()
Definition: midi_view.h:423
virtual uint32_t get_fill_color() const
void color_handler()
void transpose(bool up, bool fine, bool allow_smush)
virtual void set_region(std::shared_ptr< ARDOUR::MidiRegion >)
NoteBase * _ghost_note
Definition: midi_view.h:531
virtual void select_self_uniquely()
Definition: midi_view.h:377
void note_mode_changed()
virtual void add_control_points_to_selection(Temporal::timepos_t const &, Temporal::timepos_t const &, double y0, double y1)
Definition: midi_view.h:689
void note_entered(NoteBase *ev)
NoteBase * find_canvas_note(std::shared_ptr< NoteType >)
void clear_selection_internal()
void decrease_note_velocity_fine_smush()
Definition: midi_view.h:429
void set_channel_selector_scoped_note(NoteBase *note)
Definition: midi_view.h:342
bool _show_source
Definition: midi_view.h:540
void nudge_notes_earlier_fine()
Definition: midi_view.h:447
uint8_t get_channel_for_add(ARDOUR::MidiModel::TimeType time) const
void transpose_up_tone()
Definition: midi_view.h:436
void display_patch_changes_on_channel(uint8_t, bool)
void end_drag_edit()
void join_notes_on_channel(int channel)
void transpose_up_octave()
Definition: midi_view.h:434
virtual void set_model(std::shared_ptr< ARDOUR::MidiModel >)
PBD::ScopedConnectionList region_connections
Definition: midi_view.h:484
std::vector< NoteBase * > CopyDragEvents
Definition: midi_view.h:516
virtual void enter_internal(uint32_t state)
CopyDragEvents _copy_drag_events
Definition: midi_view.h:524
void midi_channel_mode_changed()
void remove_canvas_patch_change(PatchChange *pc)
void clear_events()
void note_dropped(NoteBase *ev, Temporal::timecnt_t const &d_qn, int8_t d_note, bool copy)
void step_add_note(uint8_t channel, uint8_t number, uint8_t velocity, Temporal::Beats pos, Temporal::Beats len)
void transpose_up_tone_smush()
Definition: midi_view.h:437
uint8_t change_note_note(NoteBase *ev, int8_t note, bool relative=false)
void patch_entered(PatchChange *)
void selection_as_notelist(Notes &selected, bool allow_all_if_none_selected=false)
bool _no_sound_notes
Definition: midi_view.h:582
void increase_note_velocity()
Definition: midi_view.h:416
void track_going_away()
std::set< NoteBase * > Selection
Definition: midi_view.h:335
std::shared_ptr< ARDOUR::MidiRegion > _midi_region
Definition: midi_view.h:522
bool covers(ArdourCanvas::Duple const &point) const
StartBoundaryRect(ArdourCanvas::Item *p)
Definition: midi_view.h:85
void render(ArdourCanvas::Rect const &area, Cairo::RefPtr< Cairo::Context > context) const
void compute_bounding_box() const
Definition: sys_ex.h:30
Definition: xml++.h:114
PBD::PropertyDescriptor< std::string > name
PBD::PropertyDescriptor< bool > selected
PBD::PropertyDescriptor< timecnt_t > length
Temporal::samplecnt_t samplecnt_t
CutCopyOp
Definition: editing.h:228
int32_t event_id_t
uint32_t Color
Definition: colors.h:33
int pixel_width(const std::string &str, const Pango::FontDescription &font)
DebugBits Selection
ArdourCanvas::Rectangle * resize_rect
Definition: midi_view.h:286
Temporal::Beats time
Definition: midi_view.h:647
Temporal::Beats base_len
Definition: midi_view.h:648
SplitInfo(Temporal::Beats const &t, Temporal::Beats const &l, int n, int c, int v, int ov)
Definition: midi_view.h:654