Ardour  9.5-48-g5dddcbb6a8
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 "boundary.h"
43 #include "editing.h"
44 #include "region_view.h"
45 #include "midi_selection.h"
46 #include "midi_view_background.h"
47 #include "time_axis_view_item.h"
48 #include "editor_automation_line.h"
49 #include "enums.h"
50 #include "line_merger.h"
51 
52 namespace ARDOUR {
53  class MidiRegion;
54  class MidiModel;
55  class MidiTrack;
56  class Filter;
57 };
58 
59 namespace MIDI {
60  namespace Name {
61  struct PatchPrimaryKey;
62  };
63 };
64 
65 class SysEx;
66 class Note;
67 class Hit;
68 class MidiTimeAxisView;
69 class NoteBase;
70 class GhostRegion;
73 class MidiCutBuffer;
74 class MidiListEditor;
75 class EditNoteDialog;
76 class PatchChange;
77 class ItemCounts;
78 class CursorContext;
80 class EditingContext;
81 class PasteContext;
82 class Drag;
83 
84 class MidiView : public virtual sigc::trackable, public LineMerger
85 {
86  public:
89 
90  MidiView (std::shared_ptr<ARDOUR::MidiTrack> mt,
91  ArdourCanvas::Item& parent,
92  EditingContext& ec,
93  MidiViewBackground& bg);
94  MidiView (MidiView const & other);
95 
96  virtual ~MidiView ();
97 
98  void init (bool wfd);
99 
100  void set_sensitive (bool);
101 
102  virtual void set_samples_per_pixel (double) {};
103 
104  virtual bool display_is_enabled() const { return true; }
105 
106  virtual ArdourCanvas::Item* drag_group() const = 0;
107 
108  void step_add_note (uint8_t channel, uint8_t number, uint8_t velocity,
111  virtual void set_height (double);
112  void apply_note_range(uint8_t lowest, uint8_t highest, bool force=false);
113 
114  // inline ARDOUR::ColorMode color_mode() const { return _background->color_mode(); }
115 
116  virtual void color_handler ();
117 
122 
123  virtual GhostRegion* add_ghost (TimeAxisView&) { return nullptr; }
124  virtual std::string get_modifier_name() const;
125 
126  virtual void set_region (std::shared_ptr<ARDOUR::MidiRegion>);
127  virtual void set_track (std::shared_ptr<ARDOUR::MidiTrack>);
128  virtual void set_model (std::shared_ptr<ARDOUR::MidiModel>);
129 
130  void set_show_source (bool yn);
131  bool show_source () const { return _show_source; }
132  bool on_timeline () const { return _on_timeline; }
133  void set_on_timeline (bool yn);
134 
135  NoteBase* add_note(const std::shared_ptr<NoteType> note, bool visible);
136 
139  void paste_internal (Temporal::timepos_t const & pos, unsigned paste_count, float times, const MidiCutBuffer&);
140 
143 
150  void get_patch_key_at (Temporal::Beats time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key) const;
151 
155 
160  void change_patch_change (PatchChange& old_patch, const MIDI::Name::PatchPrimaryKey& new_patch);
162 
167 
169 
176  void step_patch (PatchChange& patch, bool bank, int delta);
177 
181 
185 
186  void begin_write ();
187  void end_write ();
190 
191  virtual void begin_drag_edit (std::string const & why);
192  void end_drag_edit ();
193 
194  void display_model(std::shared_ptr<ARDOUR::MidiModel> model);
195  std::shared_ptr<ARDOUR::MidiModel> model() const { return _model; }
196 
197  /* note_diff commands should start here; this initiates an undo record */
198  void start_note_diff_command (std::string name = "midi edit", bool with_reversible_command = true);
200 
203  void note_diff_add_note (const std::shared_ptr<NoteType> note, bool selected, bool show_velocity = false);
205 
206  /* note_diff commands should be completed with one of these calls; they may (or may not) commit the undo record */
207  void apply_note_diff (bool as_subcommand = false, bool was_copy = false);
209 
210  NoteBase* entered_note() const { return _entered_note; }
211 
213  void note_left(NoteBase* ev);
216  void sysex_entered (SysEx* p);
217  void sysex_left (SysEx* p);
218  void note_mouse_position (float xfraction, float yfraction, bool can_set_cursor=true);
220  void note_selected(NoteBase* ev, bool add, bool extend=false);
223  void delete_note (std::shared_ptr<NoteType>);
224  size_t selection_size() { return _selection.size(); }
230 
231  void replace_chord (std::vector<int> const & intervals);
232  void invert_selected_chord (bool up);
233  void drop_selected_chord (std::vector<int> const & which_notes);
234  void add_semitone_interval (int semitones, bool as_subcommand = false);
235 
237  void move_selection(Temporal::timecnt_t const & dx, double dy, double cumulative_dy);
238  void note_dropped (NoteBase* ev, Temporal::timecnt_t const & d_qn, int8_t d_note, bool copy);
240  void move_copies(Temporal::timecnt_t const & dx_qn, double dy, double cumulative_dy);
241 
242  void select_notes (std::list<Evoral::event_id_t>, bool allow_audition);
243  void select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend);
244  void toggle_matching_notes (uint8_t notenum, uint16_t channel_mask);
245 
252  virtual bool note_in_region_range(const std::shared_ptr<NoteType> note, bool& visible) const;
253  /* Test if a note is within this region's time range. Return true if so */
254  virtual bool note_in_region_time_range(const std::shared_ptr<NoteType> note) const;
255 
258 
261 
266  void begin_resizing(bool at_front);
267 
268  void update_resizing (NoteBase* primary, bool at_front, double delta_x, bool relative, double snap_delta, bool with_snap);
269  void finish_resizing (NoteBase* primary, bool at_front, double delat_x, bool relative, double snap_delta, bool with_snap);
270  void abort_resizing ();
271 
272  struct NoteResizeData {
275  };
276 
277  /* Convert a position to a distance (origin+position) relative to the
278  * start of this MidiView.
279  *
280  * What this is relative to will depend on whether or not _show_source
281  * is true.
282  */
283 
285 
287 
289 
295  double snap_to_pixel(double x, bool ensure_snap = false);
296 
303  Temporal::timecnt_t snap_pixel_to_time (double x, bool ensure_snap = false);
304 
307  void change_note_lengths (bool, bool, Temporal::Beats beats, bool start, bool end);
308  void change_velocities (bool up, bool fine, bool allow_smush, bool all_together);
309  void set_velocity (NoteBase* primary, int velocity);
310  bool set_velocity_for_notes (std::vector<NoteBase*>& notes, int velocity);
311  bool set_velocities_for_notes (std::vector<NoteBase*>& notes, std::vector<int>& velocities);
312  void transpose (bool up, bool fine, bool allow_smush);
313  void nudge_notes (bool forward, bool fine);
314  void strum_notes (bool forward, bool fine);
315  void channel_edit ();
316  void velocity_edit ();
317 
319 
320  bool set_note_range (uint8_t low, uint8_t high);
321  bool maybe_set_note_range (uint8_t low, uint8_t high);
323 
325  Selection const & selection () const {
326  return _selection;
327  }
328  sigc::signal<void> SelectionChanged;
329 
330  void selection_as_notelist (Notes& selected, bool allow_all_if_none_selected = false);
331  void selection_as_notevector (std::vector<std::shared_ptr<NoteType> > & selected, bool allow_all_if_none_selected = false);
332 
335 
343  void create_note_at (Temporal::timepos_t const & t, double y, Temporal::Beats length, uint32_t state, bool shift_snap, bool control_reversible_command = true);
344 
349 
352 
353  void shift_midi (Temporal::timepos_t const &, bool model);
354 
355  void show_verbose_cursor_for_new_note_value(std::shared_ptr<NoteType> current_note, uint8_t new_note) const;
356 
357  std::shared_ptr<ARDOUR::MidiTrack> midi_track() const { return _midi_track; }
358  std::shared_ptr<ARDOUR::MidiRegion> midi_region() const { return _midi_region; }
361 
363 
364  virtual void select_self (bool add) {}
365  virtual void unselect_self () {}
366  void select_self () { select_self (false); }
367  virtual void select_self_uniquely () {}
368 
369  void show_start (bool yn);
370  void show_end (bool yn);
371 
373  virtual bool note_group_event(GdkEvent* ev);
374 
375  int visible_channel() const { return _visible_channel; }
376  void set_visible_channel (int, bool clear_selection = true);
377  int pick_visible_channel () const;
379 
380  protected:
381  void init (std::shared_ptr<ARDOUR::MidiTrack>);
382  virtual void region_resized (const PBD::PropertyChange&);
383 
384  void set_flags (XMLNode *);
385  void store_flags ();
386 
388 
389  void redisplay (bool view_only);
390  bool note_editable (NoteBase const *) const;
391  bool should_be_editable (NoteBase const *) const;
392 
393  protected:
394  friend class EditingContext;
395  friend class Editor; // grr, C++ does not allow inheritance of friendship
396 
399 
400  void move_note_starts_earlier_fine () { change_note_lengths (true, false, Temporal::Beats(), true, false); }
401  void move_note_starts_earlier () { change_note_lengths (false, false, Temporal::Beats(), true, false); }
402  void move_note_ends_later_fine () { change_note_lengths (true, false, Temporal::Beats(), false, true); }
403  void move_note_ends_later () { change_note_lengths (false, false, Temporal::Beats(), false, true); }
404  void move_note_starts_later_fine () { change_note_lengths (true, true, Temporal::Beats(), true, false); }
405  void move_note_starts_later () { change_note_lengths (false, true, Temporal::Beats(), true, false); }
406  void move_note_ends_earlier_fine () { change_note_lengths (true, true, Temporal::Beats(), false, true); }
407  void move_note_ends_earlier () { change_note_lengths (false, true, Temporal::Beats(), false, true); }
408 
409  void select_next_note () { goto_next_note (false); }
413 
414  void increase_note_velocity () { change_velocities (true, false, false, false); }
415  void increase_note_velocity_fine () { change_velocities (true, true, false, false); }
416  void increase_note_velocity_smush () { change_velocities (true, false, true, false); }
417  void increase_note_velocity_together () { change_velocities (true, false, false, true); }
418  void increase_note_velocity_fine_smush () { change_velocities (true, true, true, false); }
419  void increase_note_velocity_fine_together () { change_velocities (true, true, false, true); }
420  void increase_note_velocity_smush_together () { change_velocities (true, false, true, true); }
421  void increase_note_velocity_fine_smush_together () { change_velocities (true, true, true, true); }
422 
423  void decrease_note_velocity () { change_velocities (false, false, false, false); }
424  void decrease_note_velocity_fine () { change_velocities (false, true, false, false); }
425  void decrease_note_velocity_smush () { change_velocities (false, false, true, false); }
426  void decrease_note_velocity_together () { change_velocities (false, false, false, true); }
427  void decrease_note_velocity_fine_smush () { change_velocities (false, true, true, false); }
428  void decrease_note_velocity_fine_together () { change_velocities (false, true, false, true); }
429  void decrease_note_velocity_smush_together () { change_velocities (false, false, true, true); }
430  void decrease_note_velocity_fine_smush_together () { change_velocities (false, true, true, true); }
431 
434 
435  void transpose_up_octave () { transpose (true, false, false); }
436  void transpose_up_octave_smush () { transpose (true, false, true); }
437  void transpose_up_tone () { transpose (true, true, false); }
438  void transpose_up_tone_smush () { transpose (true, true, true); }
439 
440  void transpose_down_octave () { transpose (false, false, false); }
441  void transpose_down_octave_smush () { transpose (false, false, true); }
442  void transpose_down_tone () { transpose (false, true, false); }
443  void transpose_down_tone_smush () { transpose (false, true, true); }
444 
445  void nudge_notes_later () { nudge_notes (true, false); }
446  void nudge_notes_later_fine () { nudge_notes (true, true); }
447  void nudge_notes_earlier () { nudge_notes (false, false); }
448  void nudge_notes_earlier_fine () { nudge_notes (false, true); }
449 
451 
452  void strum_notes_forward () { strum_notes (true, false); }
453  void strum_notes_backward () { strum_notes (false, false); }
454 
455  protected:
458  friend class NoteDrag;
459  friend class NoteCreateDrag;
460  friend class HitCreateDrag;
461  friend class NoteBrushDrag;
462  friend class MidiGhostRegion;
463 
464  friend class EditNoteDialog;
465 
469  void play_midi_note (std::shared_ptr<NoteType> note);
470  void start_playing_midi_note (std::shared_ptr<NoteType> note);
471  void start_playing_midi_chord (std::vector<std::shared_ptr<NoteType> > notes);
472 
476 
477  virtual void clear_events ();
478  virtual void clear_ghost_events() {}
479  virtual void ghosts_model_changed() {}
480  virtual void ghosts_view_changed() {}
481  virtual void ghost_remove_note (NoteBase*) {}
482  virtual void ghost_add_note (NoteBase*) {}
483  virtual void ghost_sync_selection (NoteBase*) {}
484 
486 
492 
495 
496  void change_note_channel (NoteBase *, int8_t, bool relative=false);
497  void change_note_velocity(NoteBase* ev, int8_t vel, bool relative=false);
498  uint8_t change_note_note(NoteBase* ev, int8_t note, bool relative=false);
499  void change_note_time(NoteBase* ev, ARDOUR::MidiModel::TimeType, bool relative=false);
502  ARDOUR::MidiModel::TimeType end_delta);
503 
504  bool update_drag_selection (Temporal::timepos_t const & start, Temporal::timepos_t const & end, double y0, double y1, bool extend, bool drag_in_progress);
505  void update_vertical_drag_selection (double last_y, double y, bool extend);
506 
509 
510  std::string get_note_name (std::shared_ptr<NoteType> note, uint8_t note_value) const;
511 
512  void show_verbose_cursor (std::string const &, double, double) const;
513  void show_verbose_cursor (std::shared_ptr<NoteType>) const;
514 
517 
518  typedef std::unordered_map<std::shared_ptr<NoteType>, NoteBase*> Events;
519  typedef std::unordered_map<ARDOUR::MidiModel::PatchChangePtr, PatchChange*> PatchChanges;
520  typedef std::unordered_map<ARDOUR::MidiModel::constSysExPtr, SysEx*> SysExes;
521  typedef std::vector<NoteBase*> CopyDragEvents;
522 
523  std::shared_ptr<ARDOUR::MidiTrack> _midi_track;
526  std::shared_ptr<ARDOUR::MidiModel> _model;
527  std::shared_ptr<ARDOUR::MidiRegion> _midi_region;
533  std::vector<Note*> _finished_live_notes;
552 
555 
557 
560  std::set< std::shared_ptr<NoteType> > _marked_for_selection;
561 
563  std::set<Evoral::event_id_t> _pending_note_selection;
564 
567  std::set< std::shared_ptr<NoteType> > _marked_for_velocity;
568 
569  std::vector<NoteResizeData *> _resize_data;
570 
573  NoteBase* find_canvas_note (std::shared_ptr<NoteType>);
575  Events::iterator _optimization_iterator;
576 
579 
580  friend class VelocityDisplay;
581  void sync_velocity_drag (double factor);
582 
584  virtual void update_sustained (Note *);
585  virtual void update_hit (Hit *);
586 
587  void create_ghost_note (double, double, uint32_t state);
588  void update_ghost_note (double, double, uint32_t state);
589 
592 
593  void snap_changed ();
594 
595  virtual bool motion (GdkEventMotion*);
596  virtual bool scroll (GdkEventScroll*);
597  virtual bool key_press (GdkEventKey*);
598  virtual bool key_release (GdkEventKey*);
599  virtual bool button_press (GdkEventButton*);
603 
604  void drop_down_keys ();
605  void maybe_select_by_position (GdkEventButton* ev, double x, double y);
606  void get_events (Events& e, Evoral::Sequence<Temporal::Beats>::NoteOperator op, uint8_t val, int chan_mask = 0);
607 
608  void display_patch_changes_on_channel (uint8_t, bool);
609 
610  void data_recorded (std::weak_ptr<ARDOUR::MidiSource>);
611 
614 
616 
618  virtual void mouse_mode_changed ();
619  virtual void enter_internal (uint32_t state);
620  virtual void leave_internal ();
622 
624 
627  bool _entered;
630 
632 
634 
637 
639  uint16_t get_selected_channels () const;
640 
641  virtual double height() const;
642 
643  virtual int contents_height() const { return height() - 2; }
644  inline double note_height() const { return _midi_context.note_height(); }
645 
646  int note_to_y (uint8_t note) const { return _midi_context.note_to_y (note); }
647  uint8_t y_to_note (int y) const { return _midi_context.y_to_note (y); }
648 
650  void update_sysexes ();
651  void view_changed ();
652  void model_changed ();
654 
656 
657  struct SplitInfo {
660  int note;
661  int channel;
662  int velocity;
664 
665  SplitInfo (Temporal::Beats const & t, Temporal::Beats const & l, int n, int c, int v, int ov)
666  : time (t)
667  , base_len (l)
668  , note (n)
669  , channel (c)
670  , velocity (v)
671  , off_velocity (ov) {}
672  };
673  std::vector<SplitInfo> split_info;
675 
676  uint32_t split_tuple;
678  bool _extensible; /* if true, we can add data beyond the current region/source end */
679  bool _redisplaying; /* if true, in the middle of a call to ::redisplay() */
680 
681  bool extensible() const { return _extensible; }
682  void set_extensible (bool yn) { _extensible = yn; }
683 
686 
690  void join_notes ();
691  void join_notes_on_channel (int channel);
692 
694  void region_update_sustained (Note *, double&, double&, double&, double&);
695  void clip_capture_update_sustained (Note *, double&, double&, double&, double&);
696 
698  void size_end_rect ();
701 
702  virtual void add_control_points_to_selection (Temporal::timepos_t const &, Temporal::timepos_t const &, double y0, double y1) {}
703 
704  void color_note (NoteBase*, int channel);
705  virtual bool post_paste (Temporal::timepos_t const & pos, const ::Selection& selection, PasteContext& ctx) { return false; }
707 
708  void _duplicate_notes (int times);
709  bool chord_is_selected () const;
711 };
Definition: editor.h:160
std::shared_ptr< PatchChange< Temporal::Beats > > PatchChangePtr
Definition: Sequence.h:215
std::multiset< NotePtr, EarlierNoteComparator > Notes
Definition: Sequence.h:167
std::shared_ptr< Event< Temporal::Beats > > SysExPtr
Definition: Sequence.h:202
Definition: Filter.h:21
Definition: hit.h:30
uint8_t y_to_note(int y) const
double note_height() const
int note_to_y(uint8_t note) const
void size_start_rect()
void select_next_note()
Definition: midi_view.h:409
bool extensible() const
Definition: midi_view.h:681
void edit_patch_change(PatchChange *)
void duplicate_selection()
void create_note_at(Temporal::timepos_t const &t, double y, Temporal::Beats length, uint32_t state, bool shift_snap, bool control_reversible_command=true)
std::string get_note_name(std::shared_ptr< NoteType > note, uint8_t note_value) const
MidiView(std::shared_ptr< ARDOUR::MidiTrack > mt, ArdourCanvas::Item &parent, EditingContext &ec, MidiViewBackground &bg)
void decrease_note_velocity()
Definition: midi_view.h:423
std::shared_ptr< ARDOUR::MidiRegion > midi_region() const
Definition: midi_view.h:358
std::set< std::shared_ptr< NoteType > > _marked_for_selection
Definition: midi_view.h:560
bool set_velocity_for_notes(std::vector< NoteBase * > &notes, int velocity)
void start_note_diff_command(std::string name="midi edit", bool with_reversible_command=true)
void display_patch_changes()
bool _on_timeline
Definition: midi_view.h:547
StartBoundaryRect * _start_boundary_rect
Definition: midi_view.h:544
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:526
void nudge_notes_earlier()
Definition: midi_view.h:447
void delete_note(std::shared_ptr< NoteType >)
NoteBase * _entered_note
Definition: midi_view.h:628
void invert_selected_chord(bool up)
virtual void ghost_sync_selection(NoteBase *)
Definition: midi_view.h:483
PBD::ScopedConnection track_going_away_connection
Definition: midi_view.h:488
ArdourCanvas::Container * _note_group
Definition: midi_view.h:535
void note_diff_add_change(NoteBase *ev, ARDOUR::MidiModel::NoteDiffCommand::Property, uint8_t val)
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:443
PatchChange * find_canvas_patch_change(ARDOUR::MidiModel::PatchChangePtr p)
void decrease_note_velocity_smush()
Definition: midi_view.h:425
Temporal::Beats earliest_in_selection()
void change_note_length(NoteBase *, ARDOUR::MidiModel::TimeType)
void nudge_notes_later()
Definition: midi_view.h:445
void extend_unfinished_live_notes()
std::vector< NoteResizeData * > _resize_data
Definition: midi_view.h:569
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
Temporal::timecnt_t live_note_end
Definition: midi_view.h:534
PBD::Signal< void()> VisibleChannelChanged
Definition: midi_view.h:378
void remove_from_selection(NoteBase *)
virtual void select_self(bool add)
Definition: midi_view.h:364
void select_all_notes()
double _last_ghost_x
Definition: midi_view.h:538
void store_flags()
Temporal::Beats _step_edit_cursor_position
Definition: midi_view.h:542
void transpose_down_octave_smush()
Definition: midi_view.h:441
NoteBase * channel_selector_scoped_note()
Definition: midi_view.h:334
void end_note_splitting()
void start_playing_midi_chord(std::vector< std::shared_ptr< NoteType > > notes)
void set_show_source(bool yn)
bool update_drag_selection(Temporal::timepos_t const &start, Temporal::timepos_t const &end, double y0, double y1, bool extend, bool drag_in_progress)
void invert_selection()
void display_sysexes()
void show_verbose_cursor(std::string const &, double, double) const
void step_patch(PatchChange &patch, bool bank, int delta)
virtual bool key_release(GdkEventKey *)
MidiView(MidiView const &other)
void move_note_ends_later()
Definition: midi_view.h:403
void increase_note_velocity_smush()
Definition: midi_view.h:416
void nudge_notes_later_fine()
Definition: midi_view.h:446
MidiListEditor * _list_editor
Definition: midi_view.h:590
SysEx * find_canvas_sys_ex(ARDOUR::MidiModel::SysExPtr s)
void apply_note_range(uint8_t lowest, uint8_t highest, bool force=false)
sigc::signal< void > SelectionChanged
Definition: midi_view.h:328
virtual ~MidiView()
void increase_note_velocity_fine_together()
Definition: midi_view.h:419
void increase_note_velocity_fine()
Definition: midi_view.h:415
Drag * selection_drag
Definition: midi_view.h:548
bool paste(Temporal::timepos_t const &pos, const ::Selection &selection, PasteContext &ctx)
void decrease_note_velocity_fine_smush_together()
Definition: midi_view.h:430
void extend_selection()
void change_note_lengths(bool, bool, Temporal::Beats beats, bool start, bool end)
uint32_t split_tuple
Definition: midi_view.h:676
void goto_previous_note(bool add_to_selection)
bool show_source() const
Definition: midi_view.h:131
bool _select_all_notes_after_add
Definition: midi_view.h:629
virtual void update_hit(Hit *)
void decrease_note_velocity_smush_together()
Definition: midi_view.h:429
void duplicate_notes()
Definition: midi_view.h:432
virtual bool motion(GdkEventMotion *)
double _last_ghost_y
Definition: midi_view.h:539
void note_selected(NoteBase *ev, bool add, bool extend=false)
void change_note_velocity(NoteBase *ev, int8_t vel, bool relative=false)
void set_visible_channel(int, bool clear_selection=true)
void change_patch_change(ARDOUR::MidiModel::PatchChangePtr, Evoral::PatchChange< Temporal::Beats > const &)
void add_select_previous_note()
Definition: midi_view.h:412
Temporal::timecnt_t snap_pixel_to_time(double x, bool ensure_snap=false)
void unique_select(NoteBase *ev)
bool in_note_split
Definition: midi_view.h:674
void join_notes()
void move_note_ends_later_fine()
Definition: midi_view.h:402
void change_patch_change(PatchChange &old_patch, const MIDI::Name::PatchPrimaryKey &new_patch)
void abort_resizing()
bool _extensible
Definition: midi_view.h:678
void decrease_note_velocity_fine_together()
Definition: midi_view.h:428
void sync_velocity_drag(double factor)
void sysex_entered(SysEx *p)
void update_patch_changes()
void move_copies(Temporal::timecnt_t const &dx_qn, double dy, double cumulative_dy)
virtual void cut_copy_clear(::Selection &, Editing::CutCopyOp)
double _last_event_x
Definition: midi_view.h:625
void move_note_starts_earlier_fine()
Definition: midi_view.h:400
Selection _selection
Definition: midi_view.h:554
MidiViewBackground & midi_context() const
Definition: midi_view.h:360
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:523
uint8_t get_velocity_for_add(ARDOUR::MidiModel::TimeType time) const
void clear_selection()
void decrease_note_velocity_together()
Definition: midi_view.h:426
virtual bool enter_notify(GdkEventCrossing *)
void show_start(bool yn)
void transpose_down_tone()
Definition: midi_view.h:442
Events _events
Definition: midi_view.h:528
EditingContext & _editing_context
Definition: midi_view.h:524
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 *)
virtual int contents_height() const
Definition: midi_view.h:643
std::unordered_map< std::shared_ptr< NoteType >, NoteBase * > Events
Definition: midi_view.h:518
bool show_context_menu(GdkEventButton *)
ARDOUR::ChannelMode get_channel_mode() const
void set_sensitive(bool)
void invert_note_selection()
void replace_chord(std::vector< int > const &intervals)
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:411
void abort_note_diff()
int _visible_channel
Definition: midi_view.h:550
virtual void ghosts_model_changed()
Definition: midi_view.h:479
void begin_resizing(bool at_front)
bool _entered
Definition: midi_view.h:627
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:481
Evoral::Sequence< Temporal::Beats >::Notes Notes
Definition: midi_view.h:88
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:563
void add_canvas_patch_change(ARDOUR::MidiModel::PatchChangePtr patch)
void update_sysexes()
void clip_capture_update_sustained(Note *, double &, double &, double &, double &)
void selection_as_notevector(std::vector< std::shared_ptr< NoteType > > &selected, bool allow_all_if_none_selected=false)
double get_end_position_pixels()
void velocity_edit()
bool _suspend_note_range_update
Definition: midi_view.h:633
virtual bool leave_notify(GdkEventCrossing *)
NoteBase * find_canvas_note(Evoral::event_id_t id)
void shift_midi(Temporal::timepos_t const &, bool model)
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)
bool start_boundary_event(GdkEvent *)
void data_recorded(std::weak_ptr< ARDOUR::MidiSource >)
void snap_changed()
bool note_editable(NoteBase const *) const
std::shared_ptr< ARDOUR::MidiTrack > midi_track() const
Definition: midi_view.h:357
void note_deselected(NoteBase *ev)
EndBoundaryRect * _end_boundary_rect
Definition: midi_view.h:545
virtual void mouse_mode_changed()
void move_note_starts_later_fine()
Definition: midi_view.h:404
virtual void region_resized(const PBD::PropertyChange &)
void strum_notes_forward()
Definition: midi_view.h:452
void _duplicate_notes(int times)
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 *)
Temporal::timecnt_t view_position_to_model_position(Temporal::timepos_t const &p) const
void begin_write()
virtual GhostRegion * add_ghost(TimeAxisView &)
Definition: midi_view.h:123
void set_on_timeline(bool yn)
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:525
void hide_verbose_cursor()
void select_range(Temporal::timepos_t const &start, Temporal::timepos_t const &end)
bool note_splitting
Definition: midi_view.h:677
void strum_notes(bool forward, bool fine)
void size_end_rect()
bool _redisplaying
Definition: midi_view.h:679
size_t selection_size()
Definition: midi_view.h:224
virtual bool button_release(GdkEventButton *)
void increase_note_velocity_fine_smush()
Definition: midi_view.h:418
void update_vertical_drag_selection(double last_y, double y, bool extend)
ArdourCanvas::Rectangle * _step_edit_cursor
Definition: midi_view.h:540
virtual ArdourCanvas::Item * drag_group() const =0
void drop_selected_chord(std::vector< int > const &which_notes)
Events::iterator _optimization_iterator
Definition: midi_view.h:575
int visible_channel() const
Definition: midi_view.h:375
Gtkmm2ext::Color _patch_change_outline
Definition: midi_view.h:635
virtual void clear_ghost_events()
Definition: midi_view.h:478
void select_previous_note()
Definition: midi_view.h:410
bool should_be_editable(NoteBase const *) const
bool chord_is_selected() const
virtual bool note_group_event(GdkEvent *ev)
SysExes _sys_exes
Definition: midi_view.h:531
void delete_patch_change(PatchChange *)
void quantize_selected_notes()
void create_ghost_note(double, double, uint32_t state)
virtual void color_handler()
double note_height() const
Definition: midi_view.h:644
void selection_changed()
void nudge_notes(bool forward, bool fine)
void move_note_starts_later()
Definition: midi_view.h:405
bool _sensitive
Definition: midi_view.h:551
MIDI::Name::PatchPrimaryKey patch_change_to_patch_key(ARDOUR::MidiModel::PatchChangePtr)
PatchChanges _patch_changes
Definition: midi_view.h:530
std::shared_ptr< ARDOUR::MidiModel > model() const
Definition: midi_view.h:195
void increase_note_velocity_smush_together()
Definition: midi_view.h:420
virtual void ghost_add_note(NoteBase *)
Definition: midi_view.h:482
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:407
void clear_note_selection()
void decrease_note_velocity_fine()
Definition: midi_view.h:424
void move_note_ends_earlier_fine()
Definition: midi_view.h:406
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()
std::vector< SplitInfo > split_info
Definition: midi_view.h:673
void clip_data_recorded(samplecnt_t)
void select_self()
Definition: midi_view.h:366
void set_extensible(bool yn)
Definition: midi_view.h:682
double _last_event_y
Definition: midi_view.h:626
void set_flags(XMLNode *)
void play_midi_note(std::shared_ptr< NoteType > note)
virtual void set_height(double)
uint8_t y_to_note(int y) const
Definition: midi_view.h:647
void hide_step_edit_cursor()
virtual bool midi_canvas_group_event(GdkEvent *ev)
void transpose_down_octave()
Definition: midi_view.h:440
void note_diff_add_change(NoteBase *ev, ARDOUR::MidiModel::NoteDiffCommand::Property, Temporal::Beats val)
Temporal::Beats _step_edit_cursor_width
Definition: midi_view.h:541
void region_update_sustained(Note *, double &, double &, double &, double &)
ARDOUR::MidiModel::NoteDiffCommand * _note_diff_command
Definition: midi_view.h:536
PBD::ScopedConnectionList connections_requiring_model
Definition: midi_view.h:487
void strum_notes_backward()
Definition: midi_view.h:453
void transpose_up_octave_smush()
Definition: midi_view.h:436
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 multi_duplicate_notes()
void split_notes_more()
Temporal::Beats get_grid_beats(Temporal::timepos_t const &pos) const
bool _mouse_changed_selection
Definition: midi_view.h:631
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:401
void increase_note_velocity_together()
Definition: midi_view.h:417
void end_write()
samplecnt_t _last_display_zoom
Definition: midi_view.h:623
void delete_selection()
Selection const & selection() const
Definition: midi_view.h:325
Note ** _unfinished_live_notes
Definition: midi_view.h:532
bool maybe_set_note_range(uint8_t low, uint8_t high)
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
int note_to_y(uint8_t note) const
Definition: midi_view.h:646
void display_model(std::shared_ptr< ARDOUR::MidiModel > model)
void show_step_edit_cursor(Temporal::Beats pos)
int pick_visible_channel() const
std::unordered_map< ARDOUR::MidiModel::PatchChangePtr, PatchChange * > PatchChanges
Definition: midi_view.h:519
Gtkmm2ext::Color _patch_change_fill
Definition: midi_view.h:636
void add_patch_change(Temporal::timecnt_t const &, Evoral::PatchChange< Temporal::Beats > const &)
bool on_timeline() const
Definition: midi_view.h:132
Evoral::Note< Temporal::Beats > NoteType
Definition: midi_view.h:87
uint16_t get_selected_channels() const
void change_note_channel(NoteBase *, int8_t, bool relative=false)
EditingContext & editing_context() const
Definition: midi_view.h:359
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:102
NoteBase * _channel_selection_scoped_note
Definition: midi_view.h:543
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:104
virtual void ghosts_view_changed()
Definition: midi_view.h:480
void note_deleted(NoteBase *)
bool set_note_range(uint8_t low, uint8_t high)
std::set< std::shared_ptr< NoteType > > _marked_for_velocity
Definition: midi_view.h:567
Drag * draw_drag
Definition: midi_view.h:549
void init(std::shared_ptr< ARDOUR::MidiTrack >)
virtual void unselect_self()
Definition: midi_view.h:365
void finish_resizing(NoteBase *primary, bool at_front, double delat_x, bool relative, double snap_delta, bool with_snap)
SimpleMidiNoteSelection Selection
Definition: midi_view.h:324
virtual void update_sustained(Note *)
void channel_edit()
void region_going_away()
void increase_note_velocity_fine_smush_together()
Definition: midi_view.h:421
void extend_unfinished_live_notes(Temporal::timecnt_t const &)
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:537
virtual void select_self_uniquely()
Definition: midi_view.h:367
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:702
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:427
void set_channel_selector_scoped_note(NoteBase *note)
Definition: midi_view.h:333
bool _show_source
Definition: midi_view.h:546
void nudge_notes_earlier_fine()
Definition: midi_view.h:448
uint8_t get_channel_for_add(ARDOUR::MidiModel::TimeType time) const
void transpose_up_tone()
Definition: midi_view.h:437
void display_patch_changes_on_channel(uint8_t, bool)
void add_semitone_interval(int semitones, bool as_subcommand=false)
void end_drag_edit()
void join_notes_on_channel(int channel)
void transpose_up_octave()
Definition: midi_view.h:435
virtual void set_model(std::shared_ptr< ARDOUR::MidiModel >)
PBD::ScopedConnectionList region_connections
Definition: midi_view.h:489
std::vector< NoteBase * > CopyDragEvents
Definition: midi_view.h:521
virtual void clear_events()
virtual void enter_internal(uint32_t state)
CopyDragEvents _copy_drag_events
Definition: midi_view.h:529
std::vector< Note * > _finished_live_notes
Definition: midi_view.h:533
void midi_channel_mode_changed()
void remove_canvas_patch_change(PatchChange *pc)
void note_dropped(NoteBase *ev, Temporal::timecnt_t const &d_qn, int8_t d_note, bool copy)
virtual bool post_paste(Temporal::timepos_t const &pos, const ::Selection &selection, PasteContext &ctx)
Definition: midi_view.h:705
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:438
uint8_t change_note_note(NoteBase *ev, int8_t note, bool relative=false)
void patch_entered(PatchChange *)
std::unordered_map< ARDOUR::MidiModel::constSysExPtr, SysEx * > SysExes
Definition: midi_view.h:520
void selection_as_notelist(Notes &selected, bool allow_all_if_none_selected=false)
void color_note(NoteBase *, int channel)
bool _no_sound_notes
Definition: midi_view.h:591
void increase_note_velocity()
Definition: midi_view.h:414
void track_going_away()
NoteBase * entered_note() const
Definition: midi_view.h:210
void end_note_diff_command()
std::shared_ptr< ARDOUR::MidiRegion > _midi_region
Definition: midi_view.h:527
Definition: sys_ex.h:30
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
std::set< NoteBase * > SimpleMidiNoteSelection
PBD::PropertyDescriptor< bool > selected
PBD::PropertyDescriptor< timecnt_t > length
Temporal::samplecnt_t samplecnt_t
CutCopyOp
Definition: editing.h:241
int32_t event_id_t
void add(const Gtk::StockItem &item)
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:274
Temporal::Beats time
Definition: midi_view.h:658
Temporal::Beats base_len
Definition: midi_view.h:659
SplitInfo(Temporal::Beats const &t, Temporal::Beats const &l, int n, int c, int v, int ov)
Definition: midi_view.h:665