2006-07-23 08:03:19 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2006-2015 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2008-2012 Hans Baier <hansfbaier@googlemail.com>
|
|
|
|
* Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2009-2018 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2015-2017 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
#ifndef __ardour_midi_time_axis_h__
|
|
|
|
#define __ardour_midi_time_axis_h__
|
|
|
|
|
2015-01-12 02:04:08 -05:00
|
|
|
#include <list>
|
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
#include <gtkmm/table.h>
|
|
|
|
#include <gtkmm/button.h>
|
|
|
|
#include <gtkmm/box.h>
|
|
|
|
#include <gtkmm/menu.h>
|
|
|
|
#include <gtkmm/menuitem.h>
|
|
|
|
#include <gtkmm/radiomenuitem.h>
|
|
|
|
#include <gtkmm/checkmenuitem.h>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/types.h"
|
|
|
|
#include "ardour/region.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
#include "widgets/ardour_dropdown.h"
|
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
#include "ardour_dialog.h"
|
|
|
|
#include "route_ui.h"
|
|
|
|
#include "enums.h"
|
|
|
|
#include "route_time_axis.h"
|
2007-07-14 21:56:11 -04:00
|
|
|
#include "midi_streamview.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2022-08-21 07:34:10 -04:00
|
|
|
namespace MIDI {
|
|
|
|
namespace Name {
|
2013-01-20 03:56:00 -05:00
|
|
|
class MasterDeviceNames;
|
|
|
|
class CustomDeviceMode;
|
2016-12-06 12:48:36 -05:00
|
|
|
struct PatchPrimaryKey;
|
2013-01-20 03:56:00 -05:00
|
|
|
}
|
2022-08-21 07:34:10 -04:00
|
|
|
}
|
2013-01-20 03:56:00 -05:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
|
|
|
class RouteGroup;
|
2007-06-27 16:23:48 -04:00
|
|
|
class Processor;
|
2006-07-23 08:03:19 -04:00
|
|
|
class Location;
|
|
|
|
class MidiPlaylist;
|
|
|
|
}
|
|
|
|
|
2015-01-12 02:04:08 -05:00
|
|
|
namespace Evoral {
|
|
|
|
template<typename Time> class Note;
|
|
|
|
}
|
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
class PublicEditor;
|
2007-07-05 03:02:24 -04:00
|
|
|
class MidiStreamView;
|
2008-01-13 12:45:17 -05:00
|
|
|
class PianoRollHeader;
|
2010-08-03 15:22:57 -04:00
|
|
|
class StepEntry;
|
2010-08-15 12:39:51 -04:00
|
|
|
class StepEditor;
|
2013-03-27 21:50:18 -04:00
|
|
|
class MidiChannelSelectorWindow;
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2015-08-14 21:08:55 -04:00
|
|
|
#define NO_MIDI_NOTE 0xff
|
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
class MidiTimeAxisView : public RouteTimeAxisView
|
|
|
|
{
|
2015-01-10 12:07:31 -05:00
|
|
|
public:
|
2014-09-09 08:40:22 -04:00
|
|
|
MidiTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas);
|
|
|
|
virtual ~MidiTimeAxisView ();
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
void set_route (std::shared_ptr<ARDOUR::Route>);
|
2011-07-06 20:37:13 -04:00
|
|
|
|
2007-07-05 03:02:24 -04:00
|
|
|
MidiStreamView* midi_view();
|
|
|
|
|
2022-04-05 22:50:44 -04:00
|
|
|
void set_height (uint32_t, TrackHeightMode m = OnlySelf, bool from_idle = false);
|
2022-03-28 19:30:29 -04:00
|
|
|
void set_layer_display (LayerDisplay d);
|
2007-06-27 11:51:50 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::MidiRegion> add_region (Temporal::timepos_t const &, Temporal::timecnt_t const &, bool);
|
2009-09-03 08:39:50 -04:00
|
|
|
|
2011-03-07 08:04:46 -05:00
|
|
|
void show_all_automation (bool apply_to_selection = false);
|
|
|
|
void show_existing_automation (bool apply_to_selection = false);
|
2008-09-29 18:47:40 -04:00
|
|
|
void create_automation_child (const Evoral::Parameter& param, bool show);
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2020-04-16 14:16:45 -04:00
|
|
|
void get_regions_with_selected_data (RegionSelection&);
|
|
|
|
|
2020-09-26 11:14:59 -04:00
|
|
|
bool paste (Temporal::timepos_t const &, const Selection&, PasteContext& ctx);
|
2014-12-16 14:37:40 -05:00
|
|
|
|
2008-12-23 20:24:49 -05:00
|
|
|
ARDOUR::NoteMode note_mode() const { return _note_mode; }
|
|
|
|
ARDOUR::ColorMode color_mode() const { return _color_mode; }
|
2008-01-13 12:45:17 -05:00
|
|
|
|
2010-06-08 17:48:38 -04:00
|
|
|
Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
|
2010-08-03 17:50:15 -04:00
|
|
|
|
2013-01-20 03:56:00 -05:00
|
|
|
StepEditor* step_editor() { return _step_editor; }
|
|
|
|
void check_step_edit ();
|
2010-08-15 12:39:51 -04:00
|
|
|
|
2010-09-26 22:04:16 -04:00
|
|
|
void first_idle ();
|
2015-08-14 21:08:55 -04:00
|
|
|
void set_note_highlight (uint8_t note);
|
2010-09-26 22:04:16 -04:00
|
|
|
|
2021-11-18 08:32:09 -05:00
|
|
|
uint8_t get_preferred_midi_channel () const;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
void get_per_region_note_selection (std::list<std::pair<PBD::ID, std::set<std::shared_ptr<Evoral::Note<Temporal::Beats> > > > >&);
|
2019-12-23 12:26:33 -05:00
|
|
|
void use_midnam_info ();
|
2015-01-10 12:07:31 -05:00
|
|
|
|
2023-09-11 15:15:39 -04:00
|
|
|
void set_note_range (MidiStreamView::VisibleNoteRange range, bool apply_to_selection = false);
|
|
|
|
|
2015-01-10 12:07:31 -05:00
|
|
|
protected:
|
2010-08-03 17:50:15 -04:00
|
|
|
void start_step_editing ();
|
|
|
|
void stop_step_editing ();
|
2016-10-29 13:28:18 -04:00
|
|
|
void processors_changed (ARDOUR::RouteProcessorChange);
|
2010-08-03 17:50:15 -04:00
|
|
|
|
2015-01-10 12:07:31 -05:00
|
|
|
private:
|
2023-09-11 15:15:12 -04:00
|
|
|
void _midnam_channel_changed();
|
2023-08-17 14:19:07 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
sigc::signal<void, std::string, std::string> _midi_patch_settings_changed;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2016-10-29 13:28:18 -04:00
|
|
|
void setup_midnam_patches ();
|
|
|
|
|
2016-11-24 08:50:29 -05:00
|
|
|
sigc::connection _note_range_changed_connection;
|
|
|
|
|
2020-02-06 16:43:41 -05:00
|
|
|
void maybe_trigger_model_change ();
|
2014-12-12 23:38:41 -05:00
|
|
|
void model_changed(const std::string& model);
|
|
|
|
void custom_device_mode_changed(const std::string& mode);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-07-14 21:56:11 -04:00
|
|
|
void append_extra_display_menu_items ();
|
2011-03-07 08:04:36 -05:00
|
|
|
void build_automation_action_menu (bool);
|
2008-12-28 20:02:41 -05:00
|
|
|
Gtk::Menu* build_note_mode_menu();
|
2008-12-23 20:24:49 -05:00
|
|
|
Gtk::Menu* build_color_mode_menu();
|
2014-09-09 08:40:22 -04:00
|
|
|
|
2012-06-13 13:24:15 -04:00
|
|
|
void set_note_mode (ARDOUR::NoteMode mode, bool apply_to_selection = false);
|
|
|
|
void set_color_mode (ARDOUR::ColorMode, bool force = false, bool redisplay = true, bool apply_to_selection = false);
|
2006-07-23 08:03:19 -04:00
|
|
|
void route_active_changed ();
|
2011-08-14 14:40:57 -04:00
|
|
|
void note_range_changed ();
|
2023-08-18 15:48:39 -04:00
|
|
|
void parameter_changed (std::string const &);
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2022-03-28 19:30:29 -04:00
|
|
|
void update_scroomer_visbility (uint32_t, LayerDisplay);
|
|
|
|
|
2016-02-11 18:25:17 -05:00
|
|
|
void update_control_names ();
|
2020-07-10 12:16:18 -04:00
|
|
|
void update_midi_controls_visibility (uint32_t);
|
2016-02-11 18:25:17 -05:00
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
bool _ignore_signals;
|
2020-09-07 00:44:47 -04:00
|
|
|
bool _asked_all_automation;
|
2020-04-02 21:42:56 -04:00
|
|
|
std::string _effective_model;
|
|
|
|
std::string _effective_mode;
|
2017-07-15 11:38:28 -04:00
|
|
|
PianoRollHeader* _piano_roll_header;
|
|
|
|
ARDOUR::NoteMode _note_mode;
|
|
|
|
Gtk::RadioMenuItem* _note_mode_item;
|
|
|
|
Gtk::RadioMenuItem* _percussion_mode_item;
|
|
|
|
ARDOUR::ColorMode _color_mode;
|
|
|
|
Gtk::RadioMenuItem* _meter_color_mode_item;
|
|
|
|
Gtk::RadioMenuItem* _channel_color_mode_item;
|
|
|
|
Gtk::RadioMenuItem* _track_color_mode_item;
|
|
|
|
Gtk::VBox _midi_controls_box;
|
|
|
|
MidiChannelSelectorWindow* _channel_selector;
|
|
|
|
ArdourWidgets::ArdourDropdown _midnam_model_selector;
|
|
|
|
ArdourWidgets::ArdourDropdown _midnam_custom_device_mode_selector;
|
2023-08-17 14:19:07 -04:00
|
|
|
ArdourWidgets::ArdourDropdown _midnam_channel_selector;
|
2009-09-03 08:39:50 -04:00
|
|
|
|
|
|
|
Gtk::CheckMenuItem* _step_edit_item;
|
2009-09-25 15:00:34 -04:00
|
|
|
Gtk::Menu* default_channel_menu;
|
2009-09-03 08:39:50 -04:00
|
|
|
|
2010-01-08 21:36:47 -05:00
|
|
|
void change_all_channel_tracks_visibility (bool yn, Evoral::Parameter param);
|
2010-01-06 16:56:23 -05:00
|
|
|
void add_basic_parameter_menu_item (Gtk::Menu_Helpers::MenuList& items, const std::string& label, Evoral::Parameter param);
|
2010-01-08 21:36:47 -05:00
|
|
|
void add_channel_command_menu_item (Gtk::Menu_Helpers::MenuList& items, const std::string& label, ARDOUR::AutomationType auto_type, uint8_t cmd);
|
2010-01-06 16:56:23 -05:00
|
|
|
|
2010-01-07 14:15:33 -05:00
|
|
|
Gtk::Menu* controller_menu;
|
2013-01-19 05:02:00 -05:00
|
|
|
|
|
|
|
void add_single_channel_controller_item (Gtk::Menu_Helpers::MenuList& ctl_items, int ctl, const std::string& name);
|
2022-10-07 21:14:01 -04:00
|
|
|
void add_multi_channel_controller_item (Gtk::Menu_Helpers::MenuList& ctl_items, uint16_t channels, int ctl, const std::string& name);
|
2010-01-07 14:15:33 -05:00
|
|
|
void build_controller_menu ();
|
2021-07-12 21:29:07 -04:00
|
|
|
void toggle_restore_pgm_on_load ();
|
2014-09-09 08:40:22 -04:00
|
|
|
void toggle_channel_selector ();
|
|
|
|
void channel_selector_hidden ();
|
2010-01-08 21:36:47 -05:00
|
|
|
void set_channel_mode (ARDOUR::ChannelMode, uint16_t);
|
2010-01-07 14:15:33 -05:00
|
|
|
|
2012-01-19 21:54:23 -05:00
|
|
|
void set_note_selection (uint8_t note);
|
2010-01-07 14:15:33 -05:00
|
|
|
void add_note_selection (uint8_t note);
|
|
|
|
void extend_note_selection (uint8_t note);
|
|
|
|
void toggle_note_selection (uint8_t note);
|
2012-01-19 21:54:23 -05:00
|
|
|
void set_note_selection_region_view (RegionView* rv, uint8_t note, uint16_t chn_mask);
|
2010-01-07 14:15:33 -05:00
|
|
|
void add_note_selection_region_view (RegionView* rv, uint8_t note, uint16_t chn_mask);
|
|
|
|
void extend_note_selection_region_view (RegionView*, uint8_t note, uint16_t chn_mask);
|
|
|
|
void toggle_note_selection_region_view (RegionView*, uint8_t note, uint16_t chn_mask);
|
2023-02-16 18:33:28 -05:00
|
|
|
void get_per_region_note_selection_region_view (RegionView*, std::list<std::pair<PBD::ID, std::set<std::shared_ptr<Evoral::Note<Temporal::Beats> > > > >&);
|
2010-06-08 17:48:38 -04:00
|
|
|
|
2011-02-12 07:29:20 -05:00
|
|
|
void ensure_step_editor ();
|
|
|
|
|
2010-06-08 17:48:38 -04:00
|
|
|
/** parameter -> menu item map for the channel command items */
|
|
|
|
ParameterMenuMap _channel_command_menu_map;
|
|
|
|
/** parameter -> menu item map for the controller menu */
|
|
|
|
ParameterMenuMap _controller_menu_map;
|
2010-08-03 15:22:57 -04:00
|
|
|
|
2013-01-20 03:56:00 -05:00
|
|
|
StepEditor* _step_editor;
|
2023-06-24 18:17:41 -04:00
|
|
|
|
|
|
|
std::shared_ptr<AutomationTimeAxisView> velocity_track;
|
|
|
|
Gtk::CheckMenuItem* velocity_menu_item;
|
|
|
|
void create_velocity_automation_child (Evoral::Parameter const &, bool show);
|
2023-08-17 14:19:07 -04:00
|
|
|
|
|
|
|
void update_patch_selector ();
|
2023-09-13 13:53:18 -04:00
|
|
|
void mouse_mode_changed ();
|
|
|
|
PBD::ScopedConnection mouse_mode_connection;
|
2006-07-23 08:03:19 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ardour_midi_time_axis_h__ */
|