2021-11-29 17:30:34 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2021 Ben Loftis <ben@harrisonconsoles.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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <algorithm>
|
2021-12-30 11:25:00 -05:00
|
|
|
#include "pbd/basename.h"
|
2021-11-29 17:30:34 -05:00
|
|
|
#include "pbd/compose.h"
|
2021-12-30 11:25:00 -05:00
|
|
|
#include "pbd/convert.h"
|
|
|
|
#include "pbd/file_utils.h"
|
|
|
|
#include "pbd/pathexpand.h"
|
|
|
|
#include "pbd/search_path.h"
|
2021-11-29 17:30:34 -05:00
|
|
|
|
|
|
|
#include "gtkmm2ext/utils.h"
|
2021-12-30 11:25:00 -05:00
|
|
|
#include "gtkmm2ext/gui_thread.h"
|
2021-11-29 17:30:34 -05:00
|
|
|
#include "gtkmm2ext/actions.h"
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
#include <gtkmm/alignment.h>
|
|
|
|
#include <gtkmm/filechooserdialog.h>
|
|
|
|
#include <gtkmm/menu.h>
|
|
|
|
#include <gtkmm/menuitem.h>
|
|
|
|
#include <gtkmm/stock.h>
|
|
|
|
|
2022-02-18 20:25:43 -05:00
|
|
|
#include "widgets/tooltips.h"
|
|
|
|
|
2021-11-29 17:30:34 -05:00
|
|
|
#include "ardour/location.h"
|
|
|
|
#include "ardour/profile.h"
|
|
|
|
#include "ardour/session.h"
|
2021-12-30 11:25:00 -05:00
|
|
|
#include "ardour/region.h"
|
|
|
|
#include "ardour/triggerbox.h"
|
2021-11-29 17:30:34 -05:00
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
#include "ardour_ui.h"
|
2021-11-29 17:30:34 -05:00
|
|
|
#include "audio_clock.h"
|
|
|
|
#include "region_view.h"
|
|
|
|
#include "trigger_ui.h"
|
2021-12-30 11:25:00 -05:00
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
#include "audio_region_properties_box.h"
|
|
|
|
#include "audio_trigger_properties_box.h"
|
|
|
|
#include "audio_region_operations_box.h"
|
|
|
|
|
|
|
|
#include "midi_trigger_properties_box.h"
|
|
|
|
#include "midi_region_properties_box.h"
|
|
|
|
#include "midi_region_operations_box.h"
|
|
|
|
#include "midi_clip_editor.h"
|
2021-11-29 17:30:34 -05:00
|
|
|
|
|
|
|
#include "slot_properties_box.h"
|
|
|
|
|
|
|
|
#include "pbd/i18n.h"
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
|
2021-11-29 17:30:34 -05:00
|
|
|
using namespace Gtk;
|
2021-12-30 11:25:00 -05:00
|
|
|
using namespace PBD;
|
2021-11-29 17:30:34 -05:00
|
|
|
using namespace ARDOUR;
|
2021-12-30 11:25:00 -05:00
|
|
|
using namespace ArdourWidgets;
|
|
|
|
using namespace Temporal;
|
2021-11-29 17:30:34 -05:00
|
|
|
using std::min;
|
|
|
|
using std::max;
|
|
|
|
|
|
|
|
SlotPropertiesBox::SlotPropertiesBox ()
|
|
|
|
{
|
|
|
|
_header_label.set_text(_("Slot Properties:"));
|
|
|
|
_header_label.set_alignment(0.0, 0.5);
|
2022-01-14 11:06:49 -05:00
|
|
|
// pack_start(_header_label, false, false, 6);
|
2021-11-29 17:30:34 -05:00
|
|
|
|
2021-12-30 10:05:24 -05:00
|
|
|
_triggerwidget = manage (new SlotPropertyWidget ());
|
2021-11-29 17:30:34 -05:00
|
|
|
_triggerwidget->show();
|
|
|
|
|
|
|
|
pack_start (*_triggerwidget, true, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
SlotPropertiesBox::~SlotPropertiesBox ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SlotPropertiesBox::set_session (Session* s)
|
|
|
|
{
|
|
|
|
SessionHandlePtr::set_session (s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-24 16:13:36 -05:00
|
|
|
SlotPropertiesBox::set_slot (TriggerReference tref)
|
2021-11-29 17:30:34 -05:00
|
|
|
{
|
2021-12-24 16:13:36 -05:00
|
|
|
_triggerwidget->set_trigger (tref);
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|
2021-12-30 11:25:00 -05:00
|
|
|
|
|
|
|
/* **************************************** */
|
|
|
|
|
|
|
|
SlotPropertyTable::SlotPropertyTable ()
|
|
|
|
: _color_button (ArdourButton::Element (ArdourButton::just_led_default_elements | ArdourButton::ColorBox))
|
2022-01-16 17:56:59 -05:00
|
|
|
, _color_label (_("Color:"))
|
2021-12-30 11:25:00 -05:00
|
|
|
, _velocity_adjustment(1.,0.,1.0,0.01,0.1)
|
2023-02-16 18:33:28 -05:00
|
|
|
, _velocity_slider (&_velocity_adjustment, std::shared_ptr<PBD::Controllable>(), 24/*length*/, 12/*girth*/ )
|
2022-01-16 17:56:59 -05:00
|
|
|
, _gain_adjustment( 0.0, -20.0, +20.0, 1.0, 3.0, 0)
|
|
|
|
, _gain_spinner (_gain_adjustment)
|
2022-03-15 09:54:23 -04:00
|
|
|
, _allow_button (ArdourButton::Element (ArdourButton::led_default_elements))
|
2021-12-30 11:25:00 -05:00
|
|
|
, _follow_probability_adjustment(0,0,100,2,5)
|
2023-02-16 18:33:28 -05:00
|
|
|
, _follow_probability_slider (&_follow_probability_adjustment, std::shared_ptr<PBD::Controllable>(), 24/*length*/, 12/*girth*/ )
|
2021-12-30 11:25:00 -05:00
|
|
|
, _follow_count_adjustment (1, 1, 128, 1, 4)
|
|
|
|
, _follow_count_spinner (_follow_count_adjustment)
|
2022-01-16 11:56:30 -05:00
|
|
|
, _use_follow_length_button (ArdourButton::default_elements)
|
|
|
|
, _follow_length_adjustment (1, 1, 128, 1, 4)
|
2022-01-14 11:06:49 -05:00
|
|
|
, _follow_length_spinner (_follow_length_adjustment)
|
2021-12-30 11:25:00 -05:00
|
|
|
, _legato_button (ArdourButton::led_default_elements)
|
2022-01-25 08:20:15 -05:00
|
|
|
, _isolate_button (ArdourButton::led_default_elements)
|
2022-01-16 11:56:30 -05:00
|
|
|
, _ignore_changes(false)
|
2021-12-30 11:25:00 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
using namespace Gtk::Menu_Helpers;
|
2022-02-18 20:25:43 -05:00
|
|
|
using namespace ArdourWidgets;
|
2021-12-30 11:25:00 -05:00
|
|
|
|
|
|
|
_follow_count_spinner.set_can_focus(false);
|
|
|
|
_follow_count_spinner.signal_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::follow_count_event));
|
|
|
|
|
2022-01-16 11:56:30 -05:00
|
|
|
_use_follow_length_button.signal_event().connect (sigc::mem_fun (*this, (&SlotPropertyTable::use_follow_length_event)));
|
|
|
|
|
2022-01-14 11:06:49 -05:00
|
|
|
_follow_length_spinner.set_can_focus(false);
|
|
|
|
_follow_length_spinner.signal_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::follow_length_event));
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
_velocity_adjustment.signal_value_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::velocity_adjusted));
|
|
|
|
|
|
|
|
_velocity_slider.set_name("FollowAction");
|
|
|
|
|
|
|
|
_follow_probability_adjustment.signal_value_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::probability_adjusted));
|
|
|
|
|
|
|
|
_follow_probability_slider.set_name("FollowAction");
|
|
|
|
|
|
|
|
_follow_left.set_name("FollowAction");
|
2022-01-19 17:50:47 -05:00
|
|
|
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::None), 0)));
|
|
|
|
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::Stop), 0)));
|
|
|
|
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::Again), 0)));
|
|
|
|
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::ReverseTrigger), 0)));
|
|
|
|
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::ForwardTrigger), 0)));
|
2022-01-21 15:47:13 -05:00
|
|
|
Menu* jump_menu = manage (new Menu);
|
|
|
|
MenuList& jitems = jump_menu->items ();
|
2022-01-31 15:59:24 -05:00
|
|
|
jitems.push_back (MenuElem (_("Multi..."), sigc::bind (sigc::mem_fun (*this, &TriggerUI::edit_jump), false)));
|
2022-10-04 21:55:15 -04:00
|
|
|
for (int i = 0; i < TriggerBox::default_triggers_per_box; i++) {
|
2022-01-21 15:47:13 -05:00
|
|
|
FollowAction jump_fa = (FollowAction::JumpTrigger);
|
|
|
|
jump_fa.targets.set(i);
|
2022-02-11 13:33:43 -05:00
|
|
|
jitems.push_back (MenuElem (cue_marker_name (i), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), jump_fa, 0)));
|
2022-01-21 15:47:13 -05:00
|
|
|
}
|
2022-01-31 15:59:24 -05:00
|
|
|
_follow_left.AddMenuElem (MenuElem (_("Jump"), *jump_menu));
|
2021-12-30 11:25:00 -05:00
|
|
|
_follow_left.set_sizing_text (longest_follow);
|
|
|
|
|
|
|
|
_follow_right.set_name("FollowAction");
|
2022-03-19 17:56:28 -04:00
|
|
|
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::None), 1)));
|
2022-01-19 17:50:47 -05:00
|
|
|
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::Stop), 1)));
|
|
|
|
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::Again), 1)));
|
|
|
|
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::ReverseTrigger), 1)));
|
|
|
|
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::ForwardTrigger), 1)));
|
2022-01-21 15:47:13 -05:00
|
|
|
Menu* jump_menu_1 = manage (new Menu);
|
|
|
|
MenuList& jitems_1 = jump_menu_1->items ();
|
2022-01-31 15:59:24 -05:00
|
|
|
jitems_1.push_back (MenuElem (_("Multi..."), sigc::bind (sigc::mem_fun (*this, &TriggerUI::edit_jump), true)));
|
2022-10-04 21:55:15 -04:00
|
|
|
for (int i = 0; i < TriggerBox::default_triggers_per_box; i++) {
|
2022-01-21 15:47:13 -05:00
|
|
|
FollowAction jump_fa = (FollowAction::JumpTrigger);
|
|
|
|
jump_fa.targets.set(i);
|
2022-02-11 13:33:43 -05:00
|
|
|
jitems_1.push_back (MenuElem (cue_marker_name (i), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), jump_fa, 1)));
|
2022-01-21 15:47:13 -05:00
|
|
|
}
|
2022-01-31 15:59:24 -05:00
|
|
|
_follow_right.AddMenuElem (MenuElem (_("Jump"), *jump_menu_1));
|
2021-12-30 11:25:00 -05:00
|
|
|
_follow_right.set_sizing_text (longest_follow);
|
|
|
|
|
|
|
|
_launch_style_button.set_name("FollowAction");
|
|
|
|
_launch_style_button.set_sizing_text (longest_launch);
|
|
|
|
_launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::OneShot), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::OneShot)));
|
2022-01-03 19:45:13 -05:00
|
|
|
_launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::ReTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::ReTrigger)));
|
2021-12-30 11:25:00 -05:00
|
|
|
_launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::Gate), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::Gate)));
|
|
|
|
_launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::Toggle), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::Toggle)));
|
|
|
|
_launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::Repeat), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::Repeat)));
|
|
|
|
|
|
|
|
_launch_style_button.set_name("FollowAction");
|
2022-01-25 08:20:15 -05:00
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
_legato_button.set_text (_("Legato"));
|
|
|
|
_legato_button.signal_event().connect (sigc::mem_fun (*this, (&SlotPropertyTable::legato_button_event)));
|
|
|
|
|
2022-01-25 08:20:15 -05:00
|
|
|
_isolate_button.set_text (_("Isolate"));
|
|
|
|
_isolate_button.signal_event().connect (sigc::mem_fun (*this, (&SlotPropertyTable::isolate_button_event)));
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
#define quantize_item(b) _quantize_button.AddMenuElem (MenuElem (quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_quantize), b)));
|
|
|
|
|
|
|
|
#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IMPLEMENTED
|
|
|
|
quantize_item (BBT_Offset (0, 0, 0));
|
|
|
|
#endif
|
2022-01-07 09:51:18 -05:00
|
|
|
quantize_item (BBT_Offset (4, 0, 0));
|
|
|
|
quantize_item (BBT_Offset (2, 0, 0));
|
2021-12-30 11:25:00 -05:00
|
|
|
quantize_item (BBT_Offset (1, 0, 0));
|
|
|
|
quantize_item (BBT_Offset (0, 2, 0));
|
|
|
|
quantize_item (BBT_Offset (0, 1, 0));
|
|
|
|
quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/2));
|
|
|
|
quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/4));
|
|
|
|
quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/8));
|
|
|
|
quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/16));
|
|
|
|
quantize_item (BBT_Offset (-1, 0, 0));
|
|
|
|
|
|
|
|
for (std::vector<std::string>::const_iterator i = quantize_strings.begin(); i != quantize_strings.end(); ++i) {
|
|
|
|
if (i->length() > longest_quantize.length()) {
|
|
|
|
longest_quantize = *i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_quantize_button.set_sizing_text (longest_quantize);
|
|
|
|
_quantize_button.set_name("FollowAction");
|
|
|
|
|
|
|
|
#undef quantize_item
|
|
|
|
|
|
|
|
_name_label.set_name (X_("TrackNameEditor"));
|
|
|
|
_name_label.set_alignment (0.0, 0.5);
|
|
|
|
_name_label.set_padding (4, 0);
|
2022-01-17 14:48:41 -05:00
|
|
|
_name_label.set_width_chars (24);
|
2021-12-30 11:25:00 -05:00
|
|
|
|
|
|
|
_namebox.add (_name_label);
|
|
|
|
_namebox.add_events (Gdk::BUTTON_PRESS_MASK);
|
|
|
|
_namebox.signal_button_press_event ().connect (sigc::mem_fun (*this, &SlotPropertyTable::namebox_button_press));
|
|
|
|
|
|
|
|
_name_frame.add (_namebox);
|
|
|
|
_name_frame.set_edge_color (0x000000ff);
|
|
|
|
_name_frame.set_border_width (0);
|
|
|
|
_name_frame.set_padding (0);
|
|
|
|
|
2022-01-16 17:56:59 -05:00
|
|
|
_gain_spinner.set_can_focus(false);
|
|
|
|
_gain_spinner.configure(_gain_adjustment, 0.0, 1);
|
|
|
|
_gain_spinner.signal_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::gain_change_event));
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
_load_button.set_name("FollowAction");
|
|
|
|
_load_button.set_text (_("Load"));
|
2022-01-06 17:28:57 -05:00
|
|
|
_load_button.signal_clicked.connect (sigc::bind((sigc::mem_fun (*this, (&TriggerUI::choose_sample))), false));
|
2021-12-30 11:25:00 -05:00
|
|
|
|
|
|
|
_color_button.set_name("FollowAction");
|
2021-12-30 22:25:06 -05:00
|
|
|
_color_button.signal_clicked.connect (sigc::mem_fun (*this, (&TriggerUI::choose_color)));
|
2021-12-30 11:25:00 -05:00
|
|
|
|
|
|
|
_follow_size_group = Gtk::SizeGroup::create (Gtk::SIZE_GROUP_VERTICAL);
|
|
|
|
_follow_size_group->add_widget(_name_frame);
|
|
|
|
_follow_size_group->add_widget(_load_button);
|
|
|
|
_follow_size_group->add_widget(_color_button);
|
|
|
|
_follow_size_group->add_widget(_velocity_slider);
|
|
|
|
_follow_size_group->add_widget(_follow_count_spinner);
|
|
|
|
|
2022-02-11 11:39:53 -05:00
|
|
|
_patch_button.set_text (_("MIDI Patches"));
|
|
|
|
_patch_button.set_name("FollowAction");
|
|
|
|
_patch_button.signal_clicked.connect (sigc::mem_fun (*this, (&SlotPropertyTable::patch_button_event)));
|
|
|
|
|
2022-03-15 09:54:23 -04:00
|
|
|
_allow_button.set_text (_("Send Patches"));
|
|
|
|
_allow_button.set_name("FollowAction");
|
|
|
|
_allow_button.signal_event().connect (sigc::mem_fun (*this, (&SlotPropertyTable::allow_button_event)));
|
|
|
|
|
2022-01-17 14:48:41 -05:00
|
|
|
set_spacings (8); //match to TriggerPage:: table->set_spacings
|
|
|
|
set_border_width (0); //change TriggerPage:: table->set_border_width instead
|
2022-01-14 11:06:49 -05:00
|
|
|
set_homogeneous (false);
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
int row=0;
|
|
|
|
|
2022-01-14 11:06:49 -05:00
|
|
|
/* ---- Basic trigger properties (name, color) ----- */
|
|
|
|
_trigger_table.set_spacings (4);
|
2022-01-17 14:48:41 -05:00
|
|
|
_trigger_table.set_border_width (8);
|
2022-01-14 11:06:49 -05:00
|
|
|
_trigger_table.set_homogeneous (false);
|
|
|
|
|
2022-03-15 09:54:23 -04:00
|
|
|
_trigger_table.attach(_name_frame, 0, 6, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK ); row++;
|
2022-01-17 14:48:41 -05:00
|
|
|
_trigger_table.attach(_load_button, 0, 1, row, row+1, Gtk::SHRINK, Gtk::SHRINK );
|
|
|
|
_trigger_table.attach(_color_label, 1, 2, row, row + 1, Gtk::FILL, Gtk::SHRINK);
|
|
|
|
_trigger_table.attach(_color_button, 2, 3, row, row+1, Gtk::SHRINK, Gtk::SHRINK );
|
2022-03-15 09:54:23 -04:00
|
|
|
_trigger_table.attach(_gain_label, 3, 5, row, row + 1, Gtk::FILL, Gtk::SHRINK);
|
|
|
|
_trigger_table.attach(_gain_spinner, 5, 6, row, row + 1, Gtk::FILL, Gtk::SHRINK); row++;
|
|
|
|
_trigger_table.attach(_allow_button, 0, 3, row, row + 1, Gtk::FILL, Gtk::SHRINK);
|
|
|
|
_trigger_table.attach(_patch_button, 3, 6, row, row + 1, Gtk::FILL, Gtk::SHRINK);
|
2022-01-14 11:06:49 -05:00
|
|
|
|
|
|
|
|
|
|
|
/* ---- Launch settings ----- */
|
|
|
|
_launch_table.set_spacings (2);
|
|
|
|
_launch_table.set_border_width (8);
|
|
|
|
_launch_table.set_homogeneous (false);
|
|
|
|
row=0;
|
2021-12-30 11:25:00 -05:00
|
|
|
|
2022-01-18 09:12:17 -05:00
|
|
|
_vel_sense_label.set_text(_("Velocity Sense:")); _vel_sense_label.set_alignment(1.0, 0.5);
|
|
|
|
_launch_table.attach(_vel_sense_label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
|
2022-01-14 11:06:49 -05:00
|
|
|
_launch_table.attach(_velocity_slider, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
|
2021-12-30 11:25:00 -05:00
|
|
|
|
2022-01-18 09:12:17 -05:00
|
|
|
_launch_style_label.set_text(_("Launch Style:")); _launch_style_label.set_alignment(1.0, 0.5);
|
|
|
|
_launch_table.attach(_launch_style_label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
|
2022-01-14 11:06:49 -05:00
|
|
|
_launch_table.attach(_launch_style_button, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
|
2021-12-30 11:25:00 -05:00
|
|
|
|
2022-01-18 09:12:17 -05:00
|
|
|
_launch_quant_label.set_text(_("Launch Quantize:")); _launch_quant_label.set_alignment(1.0, 0.5);
|
|
|
|
_launch_table.attach(_launch_quant_label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
|
|
|
|
_launch_table.attach(_quantize_button, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
|
2021-12-30 11:25:00 -05:00
|
|
|
|
2022-01-23 18:54:50 -05:00
|
|
|
_legato_label.set_text(_("Legato:")); _legato_label.set_alignment(1.0, 0.5);
|
2022-01-18 09:12:17 -05:00
|
|
|
_launch_table.attach(_legato_label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
|
2022-01-14 11:06:49 -05:00
|
|
|
_launch_table.attach(_legato_button, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
|
|
|
|
|
2022-01-25 08:20:15 -05:00
|
|
|
_isolate_label.set_text(_("Cue Isolate:")); _isolate_label.set_alignment(1.0, 0.5);
|
|
|
|
_launch_table.attach(_isolate_label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
|
|
|
|
_launch_table.attach(_isolate_button, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
|
|
|
|
|
2022-01-14 11:06:49 -05:00
|
|
|
|
|
|
|
/* ---- Follow settings ----- */
|
|
|
|
_follow_table.set_spacings (2);
|
|
|
|
_follow_table.set_border_width (8);
|
|
|
|
_follow_table.set_homogeneous (false);
|
|
|
|
row=0;
|
2021-12-30 11:25:00 -05:00
|
|
|
|
2022-01-14 13:55:51 -05:00
|
|
|
Gtkmm2ext::set_size_request_to_display_given_text (_left_probability_label, "100% Left ", 12, 0);
|
|
|
|
_left_probability_label.set_alignment(0.0, 0.5);
|
|
|
|
Gtkmm2ext::set_size_request_to_display_given_text (_right_probability_label, "100% Right", 12, 0);
|
|
|
|
_right_probability_label.set_alignment(1.0, 0.5);
|
|
|
|
|
|
|
|
Gtk::Table *prob_table = manage(new Gtk::Table());
|
|
|
|
prob_table->set_spacings(2);
|
2022-01-16 17:04:12 -05:00
|
|
|
prob_table->set_border_width(0);
|
|
|
|
prob_table->attach(_left_probability_label, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK );
|
|
|
|
prob_table->attach(_right_probability_label, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK );
|
|
|
|
prob_table->attach(_follow_probability_slider, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK );
|
2022-01-14 13:55:51 -05:00
|
|
|
|
2022-01-16 17:04:12 -05:00
|
|
|
/* follow count, follow length */
|
|
|
|
Gtk::Table *fol_table = manage(new Gtk::Table());
|
|
|
|
fol_table->set_spacings(2);
|
|
|
|
fol_table->set_border_width(4);
|
2021-12-30 11:25:00 -05:00
|
|
|
|
2022-01-18 09:12:17 -05:00
|
|
|
_follow_count_label.set_text(_("Follow Count:")); _follow_count_label.set_alignment(1.0, 0.5);
|
|
|
|
fol_table->attach(_follow_count_label, 1, 2, row, row+1, Gtk::FILL, Gtk::SHRINK );
|
2021-12-30 11:25:00 -05:00
|
|
|
Gtk::Alignment *align = manage (new Gtk::Alignment (0, .5, 0, 0));
|
|
|
|
align->add (_follow_count_spinner);
|
2022-01-18 09:12:17 -05:00
|
|
|
fol_table->attach(*align, 2, 3, row, row+1, Gtk::FILL, Gtk::SHRINK, 0, 0 ); row++;
|
2022-01-14 11:06:49 -05:00
|
|
|
|
2022-01-18 09:12:17 -05:00
|
|
|
_follow_length_label.set_text(_("Follow Length:")); _follow_length_label.set_alignment(1.0, 0.5);
|
|
|
|
_beat_label.set_text(_("(beats)")); _beat_label.set_alignment (0.0, 0.5);
|
2022-01-14 11:06:49 -05:00
|
|
|
Gtk::Alignment *fl_align = manage (new Gtk::Alignment (0, .5, 0, 0));
|
|
|
|
fl_align->add (_follow_length_spinner);
|
2022-01-16 17:04:12 -05:00
|
|
|
fol_table->attach(_use_follow_length_button, 0, 1, row, row+1, Gtk::SHRINK, Gtk::SHRINK);
|
2022-01-18 09:12:17 -05:00
|
|
|
fol_table->attach(_follow_length_label, 1, 2, row, row+1, Gtk::FILL, Gtk::SHRINK );
|
2022-01-16 17:04:12 -05:00
|
|
|
fol_table->attach(*fl_align, 2, 3, row, row+1, Gtk::FILL, Gtk::SHRINK );
|
2022-01-18 09:12:17 -05:00
|
|
|
fol_table->attach(_beat_label, 3, 4, row, row+1, Gtk::SHRINK, Gtk::SHRINK);
|
2022-01-16 17:04:12 -05:00
|
|
|
|
|
|
|
_follow_table.attach(_follow_left, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
|
|
|
|
_follow_table.attach(_follow_right, 1, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
|
|
|
|
_follow_table.attach( *prob_table, 0, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
|
|
|
|
_follow_table.attach( *fol_table, 0, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
|
2021-12-30 11:25:00 -05:00
|
|
|
|
2022-01-17 14:48:41 -05:00
|
|
|
ArdourWidgets::Frame* trigBox = manage (new ArdourWidgets::Frame);
|
2022-09-28 18:02:50 -04:00
|
|
|
trigBox->set_label(_("Clip Properties"));
|
2022-01-17 14:48:41 -05:00
|
|
|
trigBox->set_name("EditorDark");
|
|
|
|
trigBox->set_edge_color (0x000000ff); // black
|
|
|
|
trigBox->add (_trigger_table);
|
|
|
|
|
2022-01-16 17:04:12 -05:00
|
|
|
ArdourWidgets::Frame* eFollowBox = manage (new ArdourWidgets::Frame);
|
2022-09-28 18:02:50 -04:00
|
|
|
eFollowBox->set_label(_("Follow Options"));
|
2022-01-14 11:06:49 -05:00
|
|
|
eFollowBox->set_name("EditorDark");
|
2022-01-16 17:04:12 -05:00
|
|
|
eFollowBox->set_edge_color (0x000000ff); // black
|
2022-01-14 11:06:49 -05:00
|
|
|
eFollowBox->add (_follow_table);
|
|
|
|
|
2022-01-16 17:04:12 -05:00
|
|
|
ArdourWidgets::Frame* eLaunchBox = manage (new ArdourWidgets::Frame);
|
2022-09-28 18:02:50 -04:00
|
|
|
eLaunchBox->set_label(_("Launch Options"));
|
2022-01-14 11:06:49 -05:00
|
|
|
eLaunchBox->set_name("EditorDark");
|
2022-01-16 17:04:12 -05:00
|
|
|
eLaunchBox->set_edge_color (0x000000ff); // black
|
2022-01-14 11:06:49 -05:00
|
|
|
eLaunchBox->add (_launch_table);
|
|
|
|
|
2022-01-24 12:53:58 -05:00
|
|
|
attach(*trigBox, 0,1, 0,1, Gtk::FILL, Gtk::SHRINK | Gtk::FILL);
|
|
|
|
attach(*eLaunchBox, 1,2, 0,1, Gtk::FILL, Gtk::SHRINK | Gtk::FILL);
|
|
|
|
attach(*eFollowBox, 2,3, 0,1, Gtk::FILL, Gtk::SHRINK | Gtk::FILL);
|
2022-02-18 20:25:43 -05:00
|
|
|
|
2022-07-13 18:06:48 -04:00
|
|
|
set_tooltip(_name_frame, _("Double-click to rename this clip"));
|
|
|
|
set_tooltip(_gain_spinner, _("Adjust audio gain (or MIDI velocity) for this slot"));
|
|
|
|
set_tooltip(_load_button, _("Load a new file into this slot"));
|
2022-02-18 20:25:43 -05:00
|
|
|
set_tooltip(_color_button, _("Pick a color for this clip"));
|
|
|
|
set_tooltip(_patch_button, _("View and edit the programs (patches) that this MIDI clip will send to a synth"));
|
2022-07-13 18:06:48 -04:00
|
|
|
set_tooltip(_allow_button, _("Allow this slot to send MIDI patches to a synth"));
|
2022-02-18 20:25:43 -05:00
|
|
|
|
|
|
|
set_tooltip(_follow_count_spinner, _("Number of times to repeat this clip's Follow Length before triggering the Follow-Action"));
|
|
|
|
set_tooltip(_use_follow_length_button, _("Click to use the Follow Length instead of the Clip Length"));
|
|
|
|
set_tooltip(_follow_length_spinner, _("When enabled, the Follow Length is used instead of Clip Length"));
|
|
|
|
set_tooltip(_velocity_slider, _("MIDI Velocity Sensitivity for clip's volume"));
|
|
|
|
set_tooltip(_follow_probability_slider, _("Probability for the Left vs Right Follow-Action to be activated"));
|
|
|
|
set_tooltip(_follow_left, _("Select an action that will occur when this clip ends"));
|
|
|
|
set_tooltip(_follow_right, _("Select an action that will occur when this clip ends"));
|
|
|
|
|
|
|
|
set_tooltip(_launch_style_button, _("Set the behavior of this clip's launch button"));
|
|
|
|
set_tooltip(_quantize_button, _("Clip will wait until the timeline passes this boundary before it triggers"));
|
|
|
|
set_tooltip(_legato_button, _("If selected, this clip can 'take over' playback in the playback position of the prior clip"));
|
|
|
|
set_tooltip(_isolate_button, _("If selected, this slot will not respond to Cue events (either starting or stopping)"));
|
2021-12-30 11:25:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
SlotPropertyTable::~SlotPropertyTable ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SlotPropertyTable::set_quantize (BBT_Offset bbo)
|
|
|
|
{
|
|
|
|
#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IMPLEMENTED
|
|
|
|
if (bbo == BBT_Offset (0, 0, 0)) {
|
|
|
|
/* use grid */
|
|
|
|
bbo = BBT_Offset (1, 2, 3); /* XXX get grid from editor */
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
trigger()->set_quantization (bbo);
|
|
|
|
}
|
|
|
|
|
2022-02-11 11:39:53 -05:00
|
|
|
void
|
|
|
|
SlotPropertyTable::patch_button_event ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Trigger> trigr = trigger();
|
|
|
|
if (std::dynamic_pointer_cast<MIDITrigger> (trigr)) {
|
2022-02-11 11:39:53 -05:00
|
|
|
SessionObject* obj = trigr->box ().owner ();
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Stripable> stripable = obj->session().stripable_by_id (obj->id ());
|
|
|
|
_patch_change_window.reset (std::dynamic_pointer_cast<Route> (stripable), std::dynamic_pointer_cast<MIDITrigger> (trigr));
|
2022-02-11 11:39:53 -05:00
|
|
|
_patch_change_window.present ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-15 09:54:23 -04:00
|
|
|
bool
|
|
|
|
SlotPropertyTable::allow_button_event (GdkEvent* ev)
|
|
|
|
{
|
|
|
|
if (_ignore_changes) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (ev->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
trigger()->set_allow_patch_changes (!trigger()->allow_patch_changes());
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-02-11 11:39:53 -05:00
|
|
|
|
2022-01-14 11:06:49 -05:00
|
|
|
void
|
|
|
|
SlotPropertyTable::follow_length_event ()
|
|
|
|
{
|
2022-01-16 11:56:30 -05:00
|
|
|
if (_ignore_changes) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-14 11:06:49 -05:00
|
|
|
int beatz = (int) _follow_length_adjustment.get_value();
|
|
|
|
|
|
|
|
int metrum_numerator = trigger()->meter().divisions_per_bar();
|
|
|
|
|
|
|
|
int bars = beatz/metrum_numerator;
|
|
|
|
int beats = beatz%metrum_numerator;
|
|
|
|
|
|
|
|
trigger()->set_follow_length(Temporal::BBT_Offset(bars,beats,0));
|
2022-01-16 11:56:30 -05:00
|
|
|
trigger()->set_use_follow_length (true); //if the user is adjusting follow-length, they want to use it
|
2022-01-14 11:06:49 -05:00
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
void
|
|
|
|
SlotPropertyTable::follow_count_event ()
|
|
|
|
{
|
2022-01-16 11:56:30 -05:00
|
|
|
if (_ignore_changes) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
trigger()->set_follow_count ((int) _follow_count_adjustment.get_value());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SlotPropertyTable::velocity_adjusted ()
|
|
|
|
{
|
2022-01-16 11:56:30 -05:00
|
|
|
if (_ignore_changes) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-26 12:12:03 -05:00
|
|
|
trigger()->set_velocity_effect (_velocity_adjustment.get_value());
|
2021-12-30 11:25:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SlotPropertyTable::probability_adjusted ()
|
|
|
|
{
|
2022-01-16 11:56:30 -05:00
|
|
|
if (_ignore_changes) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
trigger()->set_follow_action_probability ((int) _follow_probability_adjustment.get_value());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2022-01-16 11:56:30 -05:00
|
|
|
SlotPropertyTable::use_follow_length_event (GdkEvent* ev)
|
2021-12-30 11:25:00 -05:00
|
|
|
{
|
2022-01-16 11:56:30 -05:00
|
|
|
if (_ignore_changes) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
switch (ev->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
2022-01-16 11:56:30 -05:00
|
|
|
trigger()->set_use_follow_length (!trigger()->use_follow_length());
|
2021-12-30 11:25:00 -05:00
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2022-01-16 11:56:30 -05:00
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-01-16 17:56:59 -05:00
|
|
|
void
|
|
|
|
SlotPropertyTable::gain_change_event ()
|
|
|
|
{
|
|
|
|
if (_ignore_changes) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
float coeff = dB_to_coefficient(_gain_adjustment.get_value());
|
|
|
|
|
|
|
|
trigger()->set_gain(coeff);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
bool
|
|
|
|
SlotPropertyTable::legato_button_event (GdkEvent* ev)
|
|
|
|
{
|
2022-01-16 11:56:30 -05:00
|
|
|
if (_ignore_changes) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
switch (ev->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
trigger()->set_legato (!trigger()->legato());
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-01-25 08:20:15 -05:00
|
|
|
bool
|
|
|
|
SlotPropertyTable::isolate_button_event (GdkEvent* ev)
|
|
|
|
{
|
|
|
|
if (_ignore_changes) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (ev->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
2022-01-25 20:10:49 -05:00
|
|
|
trigger()->set_cue_isolated (!trigger()->cue_isolated());
|
2022-01-25 08:20:15 -05:00
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
void
|
|
|
|
SlotPropertyTable::set_launch_style (Trigger::LaunchStyle ls)
|
|
|
|
{
|
2022-01-16 11:56:30 -05:00
|
|
|
if (_ignore_changes) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
trigger()->set_launch_style (ls);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-01-19 17:50:47 -05:00
|
|
|
SlotPropertyTable::set_follow_action (FollowAction const & fa, uint64_t idx)
|
2021-12-30 11:25:00 -05:00
|
|
|
{
|
2022-01-16 11:56:30 -05:00
|
|
|
if (_ignore_changes) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-25 20:07:13 -05:00
|
|
|
if (idx == 0) {
|
|
|
|
trigger()->set_follow_action0 (fa);
|
|
|
|
} else {
|
|
|
|
trigger()->set_follow_action1 (fa);
|
|
|
|
}
|
2021-12-30 11:25:00 -05:00
|
|
|
}
|
|
|
|
|
2022-02-11 11:39:53 -05:00
|
|
|
void
|
|
|
|
SlotPropertyTable::on_trigger_set ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Trigger> trigr = trigger();
|
|
|
|
if (std::dynamic_pointer_cast<MIDITrigger> (trigr)) {
|
2022-02-11 11:39:53 -05:00
|
|
|
SessionObject* obj = triggerbox ().owner ();
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Stripable> stripable = obj->session().stripable_by_id (obj->id ());
|
|
|
|
_patch_change_window.reset (std::dynamic_pointer_cast<Route> (stripable), std::dynamic_pointer_cast<MIDITrigger> (trigr));
|
2022-02-11 11:39:53 -05:00
|
|
|
_patch_button.show();
|
2022-03-15 09:54:23 -04:00
|
|
|
_allow_button.show();
|
2022-02-11 11:39:53 -05:00
|
|
|
} else {
|
|
|
|
_patch_button.hide();
|
2022-03-15 09:54:23 -04:00
|
|
|
_allow_button.hide();
|
2022-02-11 11:39:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
void
|
2021-12-30 13:10:50 -05:00
|
|
|
SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
|
2021-12-30 11:25:00 -05:00
|
|
|
{
|
2022-01-16 11:56:30 -05:00
|
|
|
_ignore_changes = true;
|
|
|
|
|
2022-01-14 13:55:51 -05:00
|
|
|
int probability = trigger()->follow_action_probability();
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
if (pc.contains (Properties::name)) {
|
|
|
|
_name_label.set_text (trigger()->name());
|
|
|
|
}
|
|
|
|
if (pc.contains (Properties::color)) {
|
|
|
|
_color_button.set_custom_led_color (trigger()->color());
|
|
|
|
}
|
2022-01-16 17:56:59 -05:00
|
|
|
|
|
|
|
if (pc.contains (Properties::gain)) {
|
|
|
|
float gain = accurate_coefficient_to_dB(trigger()->gain());
|
|
|
|
if (gain != _gain_adjustment.get_value()) {
|
|
|
|
_gain_adjustment.set_value (gain);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (triggerbox().data_type () == DataType::AUDIO) {
|
2022-02-02 12:47:50 -05:00
|
|
|
_gain_label.set_text(_("Gain (dB):"));
|
2022-01-16 17:56:59 -05:00
|
|
|
} else {
|
2022-02-02 12:47:50 -05:00
|
|
|
_gain_label.set_text(_("Velocity Adj:"));
|
2022-01-16 17:56:59 -05:00
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
if (pc.contains (Properties::quantization)) {
|
|
|
|
BBT_Offset bbo (trigger()->quantization());
|
|
|
|
_quantize_button.set_active (quantize_length_to_string (bbo));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pc.contains (Properties::follow_count)) {
|
|
|
|
_follow_count_adjustment.set_value (trigger()->follow_count());
|
|
|
|
}
|
|
|
|
|
2022-01-16 11:56:30 -05:00
|
|
|
if (pc.contains (Properties::tempo_meter) || pc.contains (Properties::follow_length)) {
|
2022-01-14 11:06:49 -05:00
|
|
|
int metrum_numerator = trigger()->meter().divisions_per_bar();
|
|
|
|
int bar_beats = metrum_numerator * trigger()->follow_length().bars;
|
|
|
|
int beats = trigger()->follow_length().beats;
|
2022-01-16 11:56:30 -05:00
|
|
|
_follow_length_adjustment.set_value (bar_beats+beats);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pc.contains (Properties::use_follow_length)) {
|
|
|
|
_use_follow_length_button.set_active_state(trigger()->use_follow_length() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
2022-01-14 11:06:49 -05:00
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
if (pc.contains (Properties::legato)) {
|
|
|
|
_legato_button.set_active_state (trigger()->legato() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
|
|
|
}
|
|
|
|
|
2022-01-26 12:12:03 -05:00
|
|
|
if (pc.contains (Properties::cue_isolated)) {
|
2022-01-25 20:10:49 -05:00
|
|
|
_isolate_button.set_active_state (trigger()->cue_isolated() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
2022-01-25 08:20:15 -05:00
|
|
|
}
|
|
|
|
|
2022-03-15 09:54:23 -04:00
|
|
|
if (pc.contains (Properties::allow_patch_changes)) {
|
|
|
|
_patch_button.set_sensitive(trigger()->allow_patch_changes());
|
|
|
|
_allow_button.set_active_state (trigger()->allow_patch_changes() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
|
|
|
}
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
if (pc.contains (Properties::launch_style)) {
|
|
|
|
_launch_style_button.set_active (launch_style_to_string (trigger()->launch_style()));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pc.contains (Properties::follow_action0)) {
|
2022-01-31 15:59:24 -05:00
|
|
|
_follow_left.set_text (follow_action_to_string (trigger()->follow_action0 (), true));
|
2022-01-18 09:12:17 -05:00
|
|
|
|
|
|
|
/* set widget sensitivity based on 'left' follow action */
|
2022-01-26 12:12:03 -05:00
|
|
|
bool follow_widgets_sensitive = trigger()->follow_action0 ().type != FollowAction::None;
|
2022-01-18 09:12:17 -05:00
|
|
|
if (follow_widgets_sensitive) {
|
|
|
|
_follow_right.set_sensitive(true);
|
|
|
|
_follow_count_spinner.set_sensitive(true);
|
|
|
|
_follow_length_spinner.set_sensitive(true);
|
|
|
|
_use_follow_length_button.set_sensitive(true);
|
|
|
|
_follow_probability_slider.set_sensitive(true);
|
|
|
|
_left_probability_label.set_sensitive(true);
|
|
|
|
_right_probability_label.set_sensitive(true);
|
|
|
|
_beat_label.set_sensitive(true);
|
|
|
|
_follow_count_label.set_sensitive(true);
|
|
|
|
_follow_length_label.set_sensitive(true);
|
|
|
|
} else {
|
|
|
|
_follow_right.set_sensitive(false);
|
|
|
|
_follow_count_spinner.set_sensitive(false);
|
|
|
|
_follow_length_spinner.set_sensitive(false);
|
|
|
|
_use_follow_length_button.set_sensitive(false);
|
|
|
|
_follow_probability_slider.set_sensitive(false);
|
|
|
|
_left_probability_label.set_sensitive(false);
|
|
|
|
_right_probability_label.set_sensitive(false);
|
|
|
|
_beat_label.set_sensitive(false);
|
|
|
|
_follow_count_label.set_sensitive(false);
|
|
|
|
_follow_length_label.set_sensitive(false);
|
|
|
|
}
|
2021-12-30 11:25:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pc.contains (Properties::follow_action1)) {
|
2022-01-31 15:59:24 -05:00
|
|
|
_follow_right.set_text (follow_action_to_string (trigger()->follow_action1 (), true));
|
2021-12-30 11:25:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pc.contains (Properties::velocity_effect)) {
|
2022-01-26 12:12:03 -05:00
|
|
|
_velocity_adjustment.set_value (trigger()->velocity_effect());
|
2021-12-30 11:25:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pc.contains (Properties::follow_action_probability)) {
|
2022-01-14 13:55:51 -05:00
|
|
|
_follow_probability_adjustment.set_value (probability);
|
|
|
|
_left_probability_label.set_text (string_compose(_("%1%% Left"), 100-probability));
|
|
|
|
_right_probability_label.set_text (string_compose(_("%1%% Right"), probability));
|
2021-12-30 11:25:00 -05:00
|
|
|
}
|
|
|
|
|
2022-01-16 11:56:30 -05:00
|
|
|
_ignore_changes = false;
|
2021-12-30 11:25:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------ */
|
|
|
|
|
|
|
|
SlotPropertyWidget::SlotPropertyWidget ()
|
|
|
|
{
|
|
|
|
ui = new SlotPropertyTable ();
|
|
|
|
pack_start(*ui);
|
|
|
|
ui->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------ */
|
|
|
|
|
|
|
|
SlotPropertyWindow::SlotPropertyWindow (TriggerReference tref)
|
|
|
|
{
|
|
|
|
TriggerPtr trigger (tref.trigger());
|
|
|
|
|
2022-01-31 21:01:58 -05:00
|
|
|
set_title (string_compose (_("Trigger Slot: %1"), trigger->name()));
|
2021-12-30 11:25:00 -05:00
|
|
|
|
|
|
|
SlotPropertiesBox* slot_prop_box = manage (new SlotPropertiesBox ());
|
|
|
|
slot_prop_box->set_slot (tref);
|
|
|
|
|
|
|
|
Gtk::Table* table = manage (new Gtk::Table);
|
|
|
|
table->set_homogeneous (false);
|
|
|
|
table->set_spacings (16);
|
|
|
|
table->set_border_width (8);
|
|
|
|
|
|
|
|
int col = 0;
|
|
|
|
table->attach(*slot_prop_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
|
|
|
|
|
|
|
|
if (trigger->region()) {
|
|
|
|
if (trigger->region()->data_type() == DataType::AUDIO) {
|
|
|
|
_trig_box = manage(new AudioTriggerPropertiesBox ());
|
|
|
|
_ops_box = manage(new AudioRegionOperationsBox ());
|
|
|
|
_trim_box = manage(new AudioClipEditorBox ());
|
|
|
|
|
|
|
|
_trig_box->set_trigger (tref);
|
|
|
|
} else {
|
|
|
|
_trig_box = manage(new MidiTriggerPropertiesBox ());
|
|
|
|
_ops_box = manage(new MidiRegionOperationsBox ());
|
|
|
|
_trim_box = manage(new MidiClipEditorBox ());
|
|
|
|
|
|
|
|
_trig_box->set_trigger (tref);
|
|
|
|
}
|
|
|
|
|
|
|
|
_trim_box->set_region(trigger->region(), tref);
|
|
|
|
_ops_box->set_session(&trigger->region()->session());
|
|
|
|
|
|
|
|
table->attach(*_trig_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
|
|
|
|
table->attach(*_trim_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
|
|
|
|
table->attach(*_ops_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
|
|
|
|
}
|
|
|
|
|
|
|
|
add (*table);
|
|
|
|
table->show_all();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SlotPropertyWindow::on_key_press_event (GdkEventKey* ev)
|
|
|
|
{
|
|
|
|
Gtk::Window& main_window (ARDOUR_UI::instance()->main_window());
|
|
|
|
return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SlotPropertyWindow::on_key_release_event (GdkEventKey* ev)
|
|
|
|
{
|
|
|
|
Gtk::Window& main_window (ARDOUR_UI::instance()->main_window());
|
|
|
|
return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window);
|
|
|
|
}
|