Ardour  9.0-pre0-582-g084a23a80d
midi_time_axis.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) 2009-2012 Carl Hetherington <carl@carlh.net>
5  * Copyright (C) 2009-2018 Paul Davis <paul@linuxaudiosystems.com>
6  * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
7  * Copyright (C) 2015-2017 Nick Mainsbridge <mainsbridge@gmail.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #pragma once
25 
26 #include <list>
27 
28 #include <gtkmm/table.h>
29 #include <gtkmm/button.h>
30 #include <gtkmm/box.h>
31 #include <gtkmm/menu.h>
32 #include <gtkmm/menuitem.h>
33 #include <gtkmm/radiomenuitem.h>
34 #include <gtkmm/checkmenuitem.h>
35 
36 #include "ardour/types.h"
37 #include "ardour/region.h"
38 
40 
41 #include "ardour_dialog.h"
42 #include "route_ui.h"
43 #include "enums.h"
44 #include "route_time_axis.h"
45 #include "midi_streamview.h"
46 
47 namespace MIDI {
48 namespace Name {
49 class MasterDeviceNames;
50 class CustomDeviceMode;
51 struct PatchPrimaryKey;
52 }
53 }
54 
55 namespace ARDOUR {
56  class Session;
57  class RouteGroup;
58  class Processor;
59  class Location;
60  class MidiPlaylist;
61 }
62 
63 namespace Evoral {
64  template<typename Time> class Note;
65 }
66 
67 class PublicEditor;
68 class MidiStreamView;
69 class PianoRollHeader;
70 class StepEntry;
71 class StepEditor;
73 
74 #define NO_MIDI_NOTE 0xff
75 
77 {
78 public:
80  virtual ~MidiTimeAxisView ();
81 
82  void set_route (std::shared_ptr<ARDOUR::Route>);
83 
85 
86  void set_height (uint32_t, TrackHeightMode m = OnlySelf, bool from_idle = false);
88 
89  std::shared_ptr<ARDOUR::MidiRegion> add_region (Temporal::timepos_t const &, Temporal::timecnt_t const &, bool);
90 
91  void show_all_automation (bool apply_to_selection = false);
92  void show_existing_automation (bool apply_to_selection = false);
93  void create_automation_child (const Evoral::Parameter& param, bool show);
94 
96 
97  bool paste (Temporal::timepos_t const &, const Selection&, PasteContext& ctx);
98 
101 
103 
106 
107  void first_idle ();
108  void set_note_highlight (uint8_t note);
109 
110  uint8_t get_preferred_midi_channel () const;
111 
112  void get_per_region_note_selection (std::list<std::pair<PBD::ID, std::set<std::shared_ptr<Evoral::Note<Temporal::Beats> > > > >&);
114 
115  void set_visibility_note_range (MidiStreamView::VisibleNoteRange range, bool apply_to_selection = false);
116 
117 protected:
121 
122 private:
124 
125  sigc::signal<void, std::string, std::string> _midi_patch_settings_changed;
126 
128 
130 
132  void model_changed(const std::string& model);
133  void custom_device_mode_changed(const std::string& mode);
134 
139 
140  void set_note_mode (ARDOUR::NoteMode mode, bool apply_to_selection = false);
141  void set_color_mode (ARDOUR::ColorMode, bool force = false, bool redisplay = true, bool apply_to_selection = false);
144  void parameter_changed (std::string const &);
145 
147 
150 
153  std::string _effective_model;
154  std::string _effective_mode;
168 
171 
173  void add_basic_parameter_menu_item (Gtk::Menu_Helpers::MenuList& items, const std::string& label, Evoral::Parameter param);
174  void add_channel_command_menu_item (Gtk::Menu_Helpers::MenuList& items, const std::string& label, ARDOUR::AutomationType auto_type, uint8_t cmd);
175 
177 
178  void add_single_channel_controller_item (Gtk::Menu_Helpers::MenuList& ctl_items, int ctl, const std::string& name);
179  void add_multi_channel_controller_item (Gtk::Menu_Helpers::MenuList& ctl_items, uint16_t channels, int ctl, const std::string& name);
185 
186  void set_note_selection (uint8_t note);
187  void add_note_selection (uint8_t note);
188  void extend_note_selection (uint8_t note);
189  void toggle_note_selection (uint8_t note);
190  void set_note_selection_region_view (RegionView* rv, uint8_t note, uint16_t chn_mask);
191  void add_note_selection_region_view (RegionView* rv, uint8_t note, uint16_t chn_mask);
192  void extend_note_selection_region_view (RegionView*, uint8_t note, uint16_t chn_mask);
193  void toggle_note_selection_region_view (RegionView*, uint8_t note, uint16_t chn_mask);
194  void get_per_region_note_selection_region_view (RegionView*, std::list<std::pair<PBD::ID, std::set<std::shared_ptr<Evoral::Note<Temporal::Beats> > > > >&);
195 
197 
202 
204 
205  std::shared_ptr<AutomationTimeAxisView> velocity_track;
208 
212 };
213 
void set_note_mode(ARDOUR::NoteMode mode, bool apply_to_selection=false)
void setup_midnam_patches()
void stop_step_editing()
void extend_note_selection(uint8_t note)
bool paste(Temporal::timepos_t const &, const Selection &, PasteContext &ctx)
Gtk::RadioMenuItem * _meter_color_mode_item
void set_note_highlight(uint8_t note)
ARDOUR::NoteMode note_mode() const
void set_color_mode(ARDOUR::ColorMode, bool force=false, bool redisplay=true, bool apply_to_selection=false)
void set_route(std::shared_ptr< ARDOUR::Route >)
void _midnam_channel_changed()
void build_automation_action_menu(bool)
sigc::signal< void, std::string, std::string > _midi_patch_settings_changed
void set_layer_display(LayerDisplay d)
std::string _effective_mode
void append_extra_display_menu_items()
void toggle_note_selection_region_view(RegionView *, uint8_t note, uint16_t chn_mask)
Gtk::Menu * default_channel_menu
Gtk::Menu * build_note_mode_menu()
void toggle_channel_selector()
MidiTimeAxisView(PublicEditor &, ARDOUR::Session *, ArdourCanvas::Canvas &canvas)
ARDOUR::ColorMode color_mode() const
void change_all_channel_tracks_visibility(bool yn, Evoral::Parameter param)
void toggle_restore_pgm_on_load()
void add_note_selection_region_view(RegionView *rv, uint8_t note, uint16_t chn_mask)
void mouse_mode_changed()
Gtk::Menu * build_color_mode_menu()
void add_basic_parameter_menu_item(Gtk::Menu_Helpers::MenuList &items, const std::string &label, Evoral::Parameter param)
virtual ~MidiTimeAxisView()
void get_per_region_note_selection_region_view(RegionView *, std::list< std::pair< PBD::ID, std::set< std::shared_ptr< Evoral::Note< Temporal::Beats > > > > > &)
Gtk::RadioMenuItem * _note_mode_item
void extend_note_selection_region_view(RegionView *, uint8_t note, uint16_t chn_mask)
Gtk::Menu * controller_menu
void parameter_changed(std::string const &)
void show_existing_automation(bool apply_to_selection=false)
Gtk::CheckMenuItem * _step_edit_item
uint8_t get_preferred_midi_channel() const
StepEditor * step_editor()
void update_midi_controls_visibility(uint32_t)
void toggle_note_selection(uint8_t note)
void create_velocity_automation_child(Evoral::Parameter const &, bool show)
Gtk::CheckMenuItem * automation_child_menu_item(Evoral::Parameter)
void get_per_region_note_selection(std::list< std::pair< PBD::ID, std::set< std::shared_ptr< Evoral::Note< Temporal::Beats > > > > > &)
ArdourWidgets::ArdourDropdown _midnam_model_selector
ARDOUR::NoteMode _note_mode
void channel_selector_hidden()
ArdourWidgets::ArdourDropdown _midnam_custom_device_mode_selector
Gtk::VBox _midi_controls_box
void set_note_selection_region_view(RegionView *rv, uint8_t note, uint16_t chn_mask)
ARDOUR::ColorMode _color_mode
ArdourWidgets::ArdourDropdown _midnam_channel_selector
StepEditor * _step_editor
void show_all_automation(bool apply_to_selection=false)
void maybe_trigger_model_change()
PBD::ScopedConnection mouse_mode_connection
void start_step_editing()
std::shared_ptr< ARDOUR::MidiRegion > add_region(Temporal::timepos_t const &, Temporal::timecnt_t const &, bool)
void add_single_channel_controller_item(Gtk::Menu_Helpers::MenuList &ctl_items, int ctl, const std::string &name)
void route_active_changed()
void set_channel_mode(ARDOUR::ChannelMode, uint16_t)
MidiStreamView * midi_view()
void get_regions_with_selected_data(RegionSelection &)
sigc::connection _note_range_changed_connection
void set_note_selection(uint8_t note)
ParameterMenuMap _channel_command_menu_map
ParameterMenuMap _controller_menu_map
void update_control_names()
void build_controller_menu()
void add_channel_command_menu_item(Gtk::Menu_Helpers::MenuList &items, const std::string &label, ARDOUR::AutomationType auto_type, uint8_t cmd)
void update_patch_selector()
PianoRollHeader * _piano_roll_header
void add_note_selection(uint8_t note)
void custom_device_mode_changed(const std::string &mode)
void processors_changed(ARDOUR::RouteProcessorChange)
Gtk::RadioMenuItem * _channel_color_mode_item
void ensure_step_editor()
Gtk::RadioMenuItem * _percussion_mode_item
void update_scroomer_visbility(uint32_t, LayerDisplay)
void use_midnam_info()
Gtk::RadioMenuItem * _track_color_mode_item
void set_height(uint32_t, TrackHeightMode m=OnlySelf, bool from_idle=false)
void add_multi_channel_controller_item(Gtk::Menu_Helpers::MenuList &ctl_items, uint16_t channels, int ctl, const std::string &name)
std::shared_ptr< AutomationTimeAxisView > velocity_track
void note_range_changed()
Gtk::CheckMenuItem * velocity_menu_item
void create_automation_child(const Evoral::Parameter &param, bool show)
MidiChannelSelectorWindow * _channel_selector
void check_step_edit()
void model_changed(const std::string &model)
std::string _effective_model
void set_visibility_note_range(MidiStreamView::VisibleNoteRange range, bool apply_to_selection=false)
Definition: id.h:34
Representation of the interface of the Editor class.
std::string name() const
Lists of selected things.
std::map< Evoral::Parameter, Gtk::CheckMenuItem * > ParameterMenuMap
LayerDisplay
Definition: editor.h:86