Compare commits

...

2 commits

Author SHA1 Message Date
Paul Davis
2152e7ba3b triggerbox: change FollowActions into an object with a target list (GUI edition) 2022-01-19 15:50:55 -07:00
Paul Davis
95edfbac4a triggerbox: change FollowActions into an object with a target list
Should be no functional changes in this commit, but older sessions will likely not
load.
2022-01-19 15:50:55 -07:00
21 changed files with 299 additions and 201 deletions

View file

@ -244,15 +244,15 @@ CueBoxUI::context_menu (uint64_t idx)
Menu* follow_menu = manage (new Menu);
MenuList& fitems = follow_menu->items ();
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::None, idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::Stop, idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::Again, idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::PrevTrigger, idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::NextTrigger, idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ReverseTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::ReverseTrigger, idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ForwardTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::ForwardTrigger, idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::AnyTrigger, idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::OtherTrigger, idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::None), idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::Stop), idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::Again), idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::PrevTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::PrevTrigger), idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::NextTrigger), idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::ReverseTrigger), idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::ForwardTrigger), idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::AnyTrigger), idx)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::OtherTrigger), idx)));
Menu* launch_menu = manage (new Menu);
MenuList& litems = launch_menu->items ();
@ -355,7 +355,7 @@ CueBoxUI::set_all_colors (uint64_t idx)
}
void
CueBoxUI::set_all_follow_action (Trigger::FollowAction fa, uint64_t idx)
CueBoxUI::set_all_follow_action (FollowAction const & fa, uint64_t idx)
{
TriggerList tl;
get_slots(tl, idx);
@ -426,7 +426,7 @@ CueBoxUI::build ()
_slots.clear ();
for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) { // TODO
for (int32_t n = 0; n < default_triggers_per_box; ++n) { // TODO
CueEntry* te = new CueEntry (this, n);
_slots.push_back (te);
@ -446,7 +446,7 @@ CueBoxUI::_size_allocate (ArdourCanvas::Rect const& alloc)
const float width = alloc.width ();
const float height = alloc.height ();
const float slot_h = height / TriggerBox::default_triggers_per_box; // TODO
const float slot_h = height / default_triggers_per_box; // TODO
float ypos = 0;
for (auto& slot : _slots) {
@ -508,10 +508,10 @@ CueBoxWidget::on_unmap ()
CueBoxWindow::CueBoxWindow ()
{
CueBoxWidget* tbw = manage (new CueBoxWidget (-1., TriggerBox::default_triggers_per_box * 16.));
CueBoxWidget* tbw = manage (new CueBoxWidget (-1., default_triggers_per_box * 16.));
set_title (_("CueBox for XXXX"));
set_default_size (-1., TriggerBox::default_triggers_per_box * 16.);
set_default_size (-1., default_triggers_per_box * 16.);
add (*tbw);
tbw->show ();
}

View file

@ -88,7 +88,7 @@ private:
void clear_all_triggers(uint64_t idx);
void set_all_colors (uint64_t idx);
void set_all_follow_action (ARDOUR::Trigger::FollowAction, uint64_t idx);
void set_all_follow_action (ARDOUR::FollowAction const &, uint64_t idx);
void set_all_launch_style (ARDOUR::Trigger::LaunchStyle, uint64_t idx);
void set_all_quantization (Temporal::BBT_Offset const&, uint64_t idx);

View file

@ -1149,7 +1149,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region,
if (mode == ImportAsTrigger) {
boost::shared_ptr<Region> copy (RegionFactory::create (region, true));
for (int s = 0; s < TriggerBox::default_triggers_per_box; ++s) {
for (int s = 0; s < default_triggers_per_box; ++s) {
if (!existing_track->triggerbox ()->trigger (s)->region ()) {
existing_track->triggerbox ()->set_from_selection (s, copy);
break;

View file

@ -4186,7 +4186,7 @@ Editor::bounce_range_selection (BounceTarget target, bool enable_processing)
HBox* tbox = manage (new HBox);
tslot = manage (new ArdourDropdown ());
for (int c = 0; c < TriggerBox::default_triggers_per_box; ++c) {
for (int c = 0; c < default_triggers_per_box; ++c) {
// XXX ('A' + x) is not translatable, TODO abstract using nth_letter()
tslot->AddMenuElem (Menu_Helpers::MenuElem (string_compose ("%1", (char)('A' + c)), sigc::bind ([] (uint32_t* t, uint32_t v) {*t = v;}, &trigger_slot, c)));
}

View file

@ -251,7 +251,7 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t)
cme = static_cast<Gtk::CheckMenuItem*> (&ruler_items.back());
cme->set_active (Config->get_cue_behavior() != ARDOUR::FollowCues);
cme->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_cue_behavior));
for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) {
for (int32_t n = 0; n < default_triggers_per_box; ++n) {
/* XXX the "letter" names of the cues need to be subject to i18n somehow */
ruler_items.push_back (MenuElem (string_compose (_("Cue %1"), (char) ('A' + n)), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker, n)));
}

View file

@ -112,7 +112,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
, processor_box (sess, boost::bind (&MixerStrip::plugin_selector, this), mx.selection(), this, in_mixer)
, gpm (sess, 250)
, panners (sess)
, trigger_display (-1., TriggerBox::default_triggers_per_box*16.)
, trigger_display (-1., default_triggers_per_box*16.)
, button_size_group (Gtk::SizeGroup::create (Gtk::SIZE_GROUP_HORIZONTAL))
, rec_mon_table (2, 2)
, solo_iso_table (1, 2)

View file

@ -137,27 +137,27 @@ SlotPropertyTable::SlotPropertyTable ()
_follow_probability_slider.set_name("FollowAction");
_follow_left.set_name("FollowAction");
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::None, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Stop, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Again, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::PrevTrigger, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::NextTrigger, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::ReverseTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::ReverseTrigger, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::ForwardTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::ForwardTrigger, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::AnyTrigger, 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::OtherTrigger, 0)));
_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::PrevTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::PrevTrigger), 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::NextTrigger), 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)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::AnyTrigger), 0)));
_follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::OtherTrigger), 0)));
_follow_left.set_sizing_text (longest_follow);
_follow_right.set_name("FollowAction");
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::None, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Stop, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Again, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::PrevTrigger, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::NextTrigger, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::ReverseTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::ReverseTrigger, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::ForwardTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::ForwardTrigger, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::AnyTrigger, 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::OtherTrigger, 1)));
_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)));
_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::PrevTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::PrevTrigger), 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::NextTrigger), 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)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::AnyTrigger), 1)));
_follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::OtherTrigger), 1)));
_follow_right.set_sizing_text (longest_follow);
_launch_style_button.set_name("FollowAction");
@ -468,7 +468,7 @@ SlotPropertyTable::set_launch_style (Trigger::LaunchStyle ls)
}
void
SlotPropertyTable::set_follow_action (Trigger::FollowAction fa, uint64_t idx)
SlotPropertyTable::set_follow_action (FollowAction const & fa, uint64_t idx)
{
if (_ignore_changes) {
return;
@ -538,7 +538,7 @@ SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
_follow_left.set_text (follow_action_to_string (trigger()->follow_action (0)));
/* set widget sensitivity based on 'left' follow action */
bool follow_widgets_sensitive = trigger()->follow_action (0) != Trigger::None;
bool follow_widgets_sensitive = trigger()->follow_action (0).type != FollowAction::None;
if (follow_widgets_sensitive) {
_follow_right.set_sensitive(true);
_follow_count_spinner.set_sensitive(true);

View file

@ -109,7 +109,7 @@ class SlotPropertyTable : public TriggerUI, public Gtk::Table
void set_quantize (Temporal::BBT_Offset);
void set_launch_style (ARDOUR::Trigger::LaunchStyle);
void set_follow_action (ARDOUR::Trigger::FollowAction, uint64_t);
void set_follow_action (ARDOUR::FollowAction const &, uint64_t);
void on_trigger_changed (PBD::PropertyChange const& );

View file

@ -341,15 +341,15 @@ TriggerMaster::context_menu ()
Menu* follow_menu = manage (new Menu);
MenuList& fitems = follow_menu->items ();
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::None)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Stop)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Again)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::PrevTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::NextTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ForwardTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::ForwardTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ReverseTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::ReverseTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::AnyTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::OtherTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::None))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::Stop))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::Again))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::PrevTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::PrevTrigger))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::NextTrigger))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::ForwardTrigger))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::ReverseTrigger))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::AnyTrigger))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::OtherTrigger))));
Menu* launch_menu = manage (new Menu);
MenuList& litems = launch_menu->items ();
@ -441,7 +441,7 @@ TriggerMaster::set_all_colors ()
case Gtk::RESPONSE_ACCEPT: {
c = _color_dialog.get_colorsel()->get_current_color();
color_t ct = ARDOUR_UI_UTILS::gdk_color_to_rgba(c);
for (int n = 0; n< TriggerBox::default_triggers_per_box; n++) {
for (int n = 0; n < default_triggers_per_box; n++) {
_triggerbox->trigger (n)->set_color(ct);
}
} break;
@ -453,10 +453,10 @@ TriggerMaster::set_all_colors ()
}
void
TriggerMaster::set_all_follow_action (Trigger::FollowAction fa)
TriggerMaster::set_all_follow_action (FollowAction const & fa)
{
_triggerbox->set_all_follow_action(fa);
_triggerbox->set_all_probability(0);
_triggerbox->set_all_follow_action (fa);
_triggerbox->set_all_probability (0);
}
void
@ -722,15 +722,15 @@ CueMaster::context_menu ()
Menu* follow_menu = manage (new Menu);
MenuList& fitems = follow_menu->items ();
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::None)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::Stop)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::Again)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::PrevTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::NextTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ForwardTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::ForwardTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ReverseTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::ReverseTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::AnyTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::OtherTrigger)));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::None))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::Stop))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::Again))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::PrevTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::PrevTrigger))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::NextTrigger))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::ForwardTrigger))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::ReverseTrigger))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::AnyTrigger))));
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::OtherTrigger))));
Menu* launch_menu = manage (new Menu);
MenuList& litems = launch_menu->items ();
@ -823,7 +823,7 @@ CueMaster::clear_all_triggers ()
void
CueMaster::set_all_follow_action (Trigger::FollowAction fa)
CueMaster::set_all_follow_action (FollowAction const & fa)
{
TriggerBoxList tl;
get_boxen(tl);

View file

@ -85,7 +85,7 @@ private:
void clear_all_triggers();
void set_all_colors();
void set_all_follow_action (ARDOUR::Trigger::FollowAction);
void set_all_follow_action (ARDOUR::FollowAction const &);
void set_all_launch_style (ARDOUR::Trigger::LaunchStyle);
void set_all_quantization (Temporal::BBT_Offset const&);
@ -134,7 +134,7 @@ private:
void get_boxen (TriggerBoxList &boxlist);
void clear_all_triggers();
void set_all_follow_action (ARDOUR::Trigger::FollowAction);
void set_all_follow_action (ARDOUR::FollowAction const &);
void set_all_launch_style (ARDOUR::Trigger::LaunchStyle);
void set_all_quantization (Temporal::BBT_Offset const&);

View file

@ -66,7 +66,7 @@ using namespace std;
TriggerPage::TriggerPage ()
: Tabbable (_content, _("Trigger Drom"), X_("trigger"))
, _cue_area_frame (0.5, 0, 1.0, 0)
, _cue_box (32, 16 * TriggerBox::default_triggers_per_box)
, _cue_box (32, 16 * default_triggers_per_box)
, _master_widget (32, 16)
, _master (_master_widget.root ())
{

View file

@ -65,7 +65,7 @@ TriggerStrip::TriggerStrip (Session* s, boost::shared_ptr<ARDOUR::Route> rt)
, _pb_selection ()
, _tmaster_widget (-1, 16)
, _processor_box (s, boost::bind (&TriggerStrip::plugin_selector, this), _pb_selection, 0)
, _trigger_display (-1., TriggerBox::default_triggers_per_box * 16.)
, _trigger_display (-1., default_triggers_per_box * 16.)
, _panners (s)
, _level_meter (s)
{

View file

@ -76,18 +76,18 @@ TriggerUI::TriggerUI ()
, _ignore_menu_action (false)
{
if (follow_strings.empty()) {
follow_strings.push_back (follow_action_to_string (Trigger::None));
follow_strings.push_back (follow_action_to_string (Trigger::Stop));
follow_strings.push_back (follow_action_to_string (Trigger::Again));
follow_strings.push_back (follow_action_to_string (Trigger::QueuedTrigger));
follow_strings.push_back (follow_action_to_string (Trigger::NextTrigger));
follow_strings.push_back (follow_action_to_string (Trigger::PrevTrigger));
follow_strings.push_back (follow_action_to_string (Trigger::ForwardTrigger));
follow_strings.push_back (follow_action_to_string (Trigger::ReverseTrigger));
follow_strings.push_back (follow_action_to_string (Trigger::FirstTrigger));
follow_strings.push_back (follow_action_to_string (Trigger::LastTrigger));
follow_strings.push_back (follow_action_to_string (Trigger::AnyTrigger));
follow_strings.push_back (follow_action_to_string (Trigger::OtherTrigger));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::None)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::Stop)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::Again)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::QueuedTrigger)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::NextTrigger)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::PrevTrigger)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::ForwardTrigger)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::ReverseTrigger)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::FirstTrigger)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::LastTrigger)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::AnyTrigger)));
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::OtherTrigger)));
for (std::vector<std::string>::const_iterator i = follow_strings.begin(); i != follow_strings.end(); ++i) {
if (i->length() > longest_follow.length()) {
@ -159,7 +159,7 @@ TriggerUI::register_actions ()
{
trigger_actions = ActionManager::create_action_group (bindings, X_("Triggers"));
for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) {
for (int32_t n = 0; n < default_triggers_per_box; ++n) {
const std::string action_name = string_compose ("trigger-scene-%1", n);
const std::string display_name = string_compose (_("Scene %1"), n);
@ -591,58 +591,58 @@ TriggerUI::follow_context_menu ()
_ignore_menu_action = true;
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::None), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::None)));
if (trigger ()->follow_action (0) == Trigger::None) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::None))));
if (trigger ()->follow_action (0) == FollowAction::None) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::Stop), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::Stop)));
if (trigger ()->follow_action (0) == Trigger::Stop) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::Stop))));
if (trigger ()->follow_action (0) == FollowAction::Stop) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::Again), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::Again)));
if (trigger ()->follow_action (0) == Trigger::Again) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::Again))));
if (trigger ()->follow_action (0) == FollowAction::Again) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
#if QUEUED_SLOTS_IMPLEMENTED
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::QueuedTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::QueuedTrigger)));
if (trigger ()->follow_action (0) == Trigger::QueuedTrigger) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::QueuedTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::QueuedTrigger))));
if (trigger ()->follow_action (0) == FollowAction::QueuedTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
#endif
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::PrevTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::PrevTrigger)));
if (trigger ()->follow_action (0) == Trigger::PrevTrigger) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::PrevTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::PrevTrigger))));
if (trigger ()->follow_action (0) == FollowAction::PrevTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::NextTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::NextTrigger)));
if (trigger ()->follow_action (0) == Trigger::NextTrigger) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::NextTrigger))));
if (trigger ()->follow_action (0) == FollowAction::NextTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::ForwardTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::ForwardTrigger)));
if (trigger ()->follow_action (0) == Trigger::ForwardTrigger) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::ForwardTrigger))));
if (trigger ()->follow_action (0) == FollowAction::ForwardTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::ReverseTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::ReverseTrigger)));
if (trigger ()->follow_action (0) == Trigger::ReverseTrigger) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::ReverseTrigger))));
if (trigger ()->follow_action (0) == FollowAction::ReverseTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
#if 0
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::FirstTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::FirstTrigger)));
if (trigger ()->follow_action (0) == Trigger::FirstTrigger) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::FirstTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::FirstTrigger))));
if (trigger ()->follow_action (0) == FollowAction::FirstTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::LastTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::LastTrigger)));
if (trigger ()->follow_action (0) == Trigger::LastTrigger) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::LastTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::LastTrigger))));
if (trigger ()->follow_action (0) == FollowAction::LastTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
#endif
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::AnyTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::AnyTrigger)));
if (trigger ()->follow_action (0) == Trigger::AnyTrigger) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::AnyTrigger))));
if (trigger ()->follow_action (0) == FollowAction::AnyTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::OtherTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::OtherTrigger)));
if (trigger ()->follow_action (0) == Trigger::OtherTrigger) {
fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::OtherTrigger))));
if (trigger ()->follow_action (0) == FollowAction::OtherTrigger) {
dynamic_cast<Gtk::CheckMenuItem*> (&fitems.back ())->set_active (true);
}
@ -684,7 +684,7 @@ TriggerUI::edit_trigger ()
}
void
TriggerUI::set_follow_action (Trigger::FollowAction fa)
TriggerUI::set_follow_action (FollowAction const & fa)
{
if (_ignore_menu_action) {
return;
@ -778,32 +778,32 @@ TriggerUI::quantize_length_to_string (BBT_Offset const & ql)
}
std::string
TriggerUI::follow_action_to_string (Trigger::FollowAction fa)
TriggerUI::follow_action_to_string (FollowAction const & fa)
{
switch (fa) {
case Trigger::None:
switch (fa.type) {
case FollowAction::None:
return _("None");
case Trigger::Stop:
case FollowAction::Stop:
return _("Stop");
case Trigger::Again:
case FollowAction::Again:
return _("Again");
case Trigger::QueuedTrigger:
case FollowAction::QueuedTrigger:
return _("Queued");
case Trigger::NextTrigger:
case FollowAction::NextTrigger:
return _("Next");
case Trigger::PrevTrigger:
case FollowAction::PrevTrigger:
return _("Prev");
case Trigger::ForwardTrigger:
case FollowAction::ForwardTrigger:
return _("Forward");
case Trigger::ReverseTrigger:
case FollowAction::ReverseTrigger:
return _("Reverse");
case Trigger::FirstTrigger:
case FollowAction::FirstTrigger:
return _("First");
case Trigger::LastTrigger:
case FollowAction::LastTrigger:
return _("Last");
case Trigger::AnyTrigger:
case FollowAction::AnyTrigger:
return _("Any");
case Trigger::OtherTrigger:
case FollowAction::OtherTrigger:
return _("Other");
}
/*NOTREACHED*/

View file

@ -45,8 +45,7 @@ public:
virtual void on_trigger_changed (PBD::PropertyChange const& ) = 0;
static std::string follow_action_to_string (ARDOUR::Trigger::FollowAction);
static ARDOUR::Trigger::FollowAction string_to_follow_action (std::string const &);
static std::string follow_action_to_string (ARDOUR::FollowAction const &);
static std::string quantize_length_to_string (Temporal::BBT_Offset const &);
static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle);
static std::string stretch_mode_to_string (ARDOUR::Trigger::StretchMode);
@ -74,7 +73,7 @@ public:
void follow_context_menu ();
void context_menu ();
void set_follow_action (ARDOUR::Trigger::FollowAction);
void set_follow_action (ARDOUR::FollowAction const &);
void set_launch_style (ARDOUR::Trigger::LaunchStyle);
void set_quantization (Temporal::BBT_Offset const&);
void set_from_selection ();

View file

@ -178,7 +178,7 @@ TriggerEntry::_size_allocate (ArdourCanvas::Rect const& alloc)
}
void
TriggerEntry::draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, Trigger::FollowAction icon, float size, float scale) const
TriggerEntry::draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, FollowAction const & icon, float size, float scale) const
{
uint32_t bg_color = fill_color ();
uint32_t fg_color = UIConfiguration::instance ().color ("neutral:midground");
@ -199,32 +199,32 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, Trigger::
set_source_rgba (context, fg_color);
context->set_line_width (1 * scale);
switch (icon) {
case Trigger::Stop:
switch (icon.type) {
case FollowAction::Stop:
context->rectangle (6 * scale, 6 * scale, size - 12 * scale, size - 12 * scale);
context->stroke ();
break;
case Trigger::Again:
case FollowAction::Again:
context->arc (size / 2, size / 2, size * 0.20, 60. * (M_PI / 180.0), 2 * M_PI);
context->stroke ();
context->arc (size / 2 + size * 0.2, size / 2, 1.5 * scale, 0, 2 * M_PI); // arrow head
context->fill ();
break;
case Trigger::NextTrigger:
case FollowAction::NextTrigger:
context->move_to (size / 2, 3 * scale);
context->line_to (size / 2, size - 5 * scale);
context->stroke ();
context->arc (size / 2, size - 5 * scale, 2 * scale, 0, 2 * M_PI); // arrow head
context->fill ();
break;
case Trigger::PrevTrigger:
case FollowAction::PrevTrigger:
context->move_to (size / 2, 5 * scale);
context->line_to (size / 2, size - 3 * scale);
context->stroke ();
context->arc (size / 2, 5 * scale, 2 * scale, 0, 2 * M_PI); // arrow head
context->fill ();
break;
case Trigger::ForwardTrigger:
case FollowAction::ForwardTrigger:
context->move_to (size / 2, 3 * scale);
context->line_to (size / 2, size - 3 * scale);
context->stroke ();
@ -241,7 +241,7 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, Trigger::
context->arc (size / 2, size - 3 * scale, 2 * scale, 0, 2 * M_PI); // arrow head
context->fill ();
break;
case Trigger::ReverseTrigger:
case FollowAction::ReverseTrigger:
context->arc (size / 2, 3 * scale, 2 * scale, 0, 2 * M_PI); // arrow head
set_source_rgba (context, fg_color);
context->fill ();
@ -259,17 +259,17 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, Trigger::
context->fill ();
break;
case Trigger::QueuedTrigger: {
case FollowAction::QueuedTrigger: {
Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (context);
layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
layout->set_text (icon == Trigger::AnyTrigger ? "&" : "@");
layout->set_text (icon == FollowAction::AnyTrigger ? "&" : "@");
int tw, th;
layout->get_pixel_size (tw, th);
context->move_to (size / 2, size / 2);
context->rel_move_to (-tw / 2, -th / 2);
layout->show_in_cairo_context (context);
} break;
case Trigger::AnyTrigger: {
case FollowAction::AnyTrigger: {
for (int i = 0; i < 6; i++) {
Cairo::Matrix m = context->get_matrix ();
context->translate (size / 2, size / 2);
@ -281,7 +281,7 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, Trigger::
}
context->set_identity_matrix ();
} break;
case Trigger::OtherTrigger: {
case FollowAction::OtherTrigger: {
context->set_line_width (1.5 * scale);
set_source_rgba (context, HSV (UIConfiguration::instance ().color ("neutral:midground")).lighter (0.25).color ()); // needs to be brighter to maintain balance
for (int i = 0; i < 6; i++) {
@ -295,7 +295,7 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, Trigger::
}
context->set_identity_matrix ();
} break;
case Trigger::None:
case FollowAction::None:
default:
break;
}
@ -924,7 +924,7 @@ TriggerBoxUI::_size_allocate (ArdourCanvas::Rect const& alloc)
const float width = alloc.width ();
const float height = alloc.height ();
const float slot_h = height / TriggerBox::default_triggers_per_box; // TODO
const float slot_h = height / default_triggers_per_box; // TODO
float ypos = 0;
for (auto& slot : _slots) {

View file

@ -55,7 +55,7 @@ public:
ArdourCanvas::Text* name_text;
void draw_launch_icon (Cairo::RefPtr<Cairo::Context> context, float size, float scale) const;
void draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, ARDOUR::Trigger::FollowAction icon, float size, float scale) const;
void draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, ARDOUR::FollowAction const & icon, float size, float scale) const;
void render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const;

View file

@ -44,6 +44,8 @@
#include "ardour/midi_state_tracker.h"
#include "ardour/processor.h"
#include "ardour/segment_descriptor.h"
#include "ardour/types.h"
#include "ardour/types_convert.h"
#include "ardour/libardour_visibility.h"
@ -171,21 +173,6 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
LaunchStyle launch_style() const;
void set_launch_style (LaunchStyle);
enum FollowAction {
None,
Stop,
Again,
QueuedTrigger, /* DP-style */
NextTrigger, /* Live-style, and below */
PrevTrigger,
ForwardTrigger, /* any "next" skipping empties */
ReverseTrigger, /* any "prev" skipping empties */
FirstTrigger,
LastTrigger,
AnyTrigger,
OtherTrigger,
};
FollowAction follow_action (uint32_t n) const { assert (n < 2); return n ? _follow_action1 : _follow_action0; }
void set_follow_action (FollowAction, uint32_t n);
@ -571,7 +558,7 @@ class LIBARDOUR_API TriggerBox : public Processor
TriggerPtr currently_playing() const { return _currently_playing; }
void clear_all_triggers ();
void set_all_follow_action (ARDOUR::Trigger::FollowAction, uint32_t n=0);
void set_all_follow_action (ARDOUR::FollowAction const &, uint32_t n=0);
void set_all_launch_style (ARDOUR::Trigger::LaunchStyle);
void set_all_quantization (Temporal::BBT_Offset const&);
void set_all_probability (int zero_to_a_hundred);
@ -617,8 +604,6 @@ class LIBARDOUR_API TriggerBox : public Processor
static void init ();
static const int32_t default_triggers_per_box;
static TriggerBoxThread* worker;
static void start_transport_stop (Session&);
@ -733,8 +718,8 @@ namespace Properties {
LIBARDOUR_API extern PBD::PropertyDescriptor<Temporal::BBT_Offset> quantization;
LIBARDOUR_API extern PBD::PropertyDescriptor<Temporal::BBT_Offset> follow_length;
LIBARDOUR_API extern PBD::PropertyDescriptor<Trigger::LaunchStyle> launch_style;
LIBARDOUR_API extern PBD::PropertyDescriptor<Trigger::FollowAction> follow_action0;
LIBARDOUR_API extern PBD::PropertyDescriptor<Trigger::FollowAction> follow_action1;
LIBARDOUR_API extern PBD::PropertyDescriptor<FollowAction> follow_action0;
LIBARDOUR_API extern PBD::PropertyDescriptor<FollowAction> follow_action1;
LIBARDOUR_API extern PBD::PropertyDescriptor<Trigger::StretchMode> stretch_mode;
LIBARDOUR_API extern PBD::PropertyDescriptor<uint32_t> follow_count;
LIBARDOUR_API extern PBD::PropertyDescriptor<int> follow_action_probability;
@ -751,7 +736,7 @@ namespace Properties {
} // namespace ARDOUR
namespace PBD {
DEFINE_ENUM_CONVERT(ARDOUR::Trigger::FollowAction);
DEFINE_ENUM_CONVERT(ARDOUR::FollowAction::Type);
DEFINE_ENUM_CONVERT(ARDOUR::Trigger::LaunchStyle);
DEFINE_ENUM_CONVERT(ARDOUR::Trigger::StretchMode);
} /* namespace PBD */

View file

@ -31,6 +31,7 @@
#ifndef __ardour_types_h__
#define __ardour_types_h__
#include <bitset>
#include <istream>
#include <vector>
#include <map>
@ -818,6 +819,53 @@ enum CueBehavior {
typedef std::vector<CaptureInfo*> CaptureInfos;
const int32_t default_triggers_per_box = 8;
struct FollowAction {
enum Type {
None,
Stop,
Again,
QueuedTrigger, /* DP-style */
NextTrigger, /* Live-style, and below */
PrevTrigger,
ForwardTrigger, /* any "next" skipping empties */
ReverseTrigger, /* any "prev" skipping empties */
FirstTrigger,
LastTrigger,
AnyTrigger,
OtherTrigger,
};
/* We could theoretically limit this to default_triggers_per_box but
* doing it this way makes it likely that this will not change. Could
* be worth a constexpr-style compile time assert to check
* default_triggers_per_box < 64.
*/
typedef std::bitset<64> Targets;
Type type;
Targets targets;
FollowAction () : type (None) {}
FollowAction (Type t, Targets const & tgts = Targets()) : type (t), targets (tgts) {}
FollowAction (Type t, std::string const & bitstring) : type (t), targets (bitstring) {}
FollowAction (std::string const &);
bool operator!= (FollowAction const & other) const {
return other.type != type || other.targets != targets;
}
bool operator== (FollowAction const & other) const {
return other.type == type && other.targets == targets;
}
std::string to_string() const;
};
} // namespace ARDOUR
/* for now, break the rules and use "using" to make this "global" */

View file

@ -30,6 +30,14 @@
#include "ardour/data_type.h"
#include "ardour/mode.h"
/* NOTE: when adding types to this file, you must add four functions:
std::string to_string (T);
T string_to (std::string const &);
bool to_string (T, std::string &);
bool string_to (std::string const &, T&);
*/
namespace PBD {
DEFINE_ENUM_CONVERT(Timecode::TimecodeFormat)
@ -162,6 +170,33 @@ inline bool string_to (const std::string& str, ARDOUR::DataType& dt)
return true;
}
template <>
inline bool to_string (ARDOUR::FollowAction fa, std::string& str)
{
str = fa.to_string();
return true;
}
template <>
inline bool string_to (const std::string& str, ARDOUR::FollowAction& fa)
{
fa = ARDOUR::FollowAction (str);
return true;
}
template<>
inline std::string to_string (ARDOUR::FollowAction fa)
{
return fa.to_string ();
}
template<>
inline ARDOUR::FollowAction string_to (std::string const & str)
{
return ARDOUR::FollowAction (str);
}
} // namespace PBD
#endif // ARDOUR_TYPES_CONVERT_H

View file

@ -157,7 +157,7 @@ setup_enum_writer ()
LocateTransportDisposition _LocateTransportDisposition;
Trigger::State _TriggerState;
Trigger::LaunchStyle _TriggerLaunchStyle;
Trigger::FollowAction _TriggerFollowAction;
FollowAction::Type _FollowAction;
Trigger::StretchMode _TriggerStretchMode;
CueBehavior _CueBehavior;
@ -859,19 +859,19 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (Trigger, Stopping);
REGISTER (_TriggerState);
REGISTER_CLASS_ENUM (Trigger, None);
REGISTER_CLASS_ENUM (Trigger, Stop);
REGISTER_CLASS_ENUM (Trigger, Again);
REGISTER_CLASS_ENUM (Trigger, QueuedTrigger);
REGISTER_CLASS_ENUM (Trigger, NextTrigger);
REGISTER_CLASS_ENUM (Trigger, PrevTrigger);
REGISTER_CLASS_ENUM (Trigger, ForwardTrigger);
REGISTER_CLASS_ENUM (Trigger, ReverseTrigger);
REGISTER_CLASS_ENUM (Trigger, FirstTrigger);
REGISTER_CLASS_ENUM (Trigger, LastTrigger);
REGISTER_CLASS_ENUM (Trigger, AnyTrigger);
REGISTER_CLASS_ENUM (Trigger, OtherTrigger);
REGISTER (_TriggerFollowAction);
REGISTER_CLASS_ENUM (FollowAction, None);
REGISTER_CLASS_ENUM (FollowAction, Stop);
REGISTER_CLASS_ENUM (FollowAction, Again);
REGISTER_CLASS_ENUM (FollowAction, QueuedTrigger);
REGISTER_CLASS_ENUM (FollowAction, NextTrigger);
REGISTER_CLASS_ENUM (FollowAction, PrevTrigger);
REGISTER_CLASS_ENUM (FollowAction, ForwardTrigger);
REGISTER_CLASS_ENUM (FollowAction, ReverseTrigger);
REGISTER_CLASS_ENUM (FollowAction, FirstTrigger);
REGISTER_CLASS_ENUM (FollowAction, LastTrigger);
REGISTER_CLASS_ENUM (FollowAction, AnyTrigger);
REGISTER_CLASS_ENUM (FollowAction, OtherTrigger);
REGISTER (_FollowAction);
REGISTER_CLASS_ENUM (Trigger, OneShot);
REGISTER_CLASS_ENUM (Trigger, ReTrigger);

View file

@ -54,8 +54,8 @@ namespace ARDOUR {
PBD::PropertyDescriptor<Temporal::BBT_Offset> quantization;
PBD::PropertyDescriptor<Temporal::BBT_Offset> follow_length;
PBD::PropertyDescriptor<Trigger::LaunchStyle> launch_style;
PBD::PropertyDescriptor<Trigger::FollowAction> follow_action0;
PBD::PropertyDescriptor<Trigger::FollowAction> follow_action1;
PBD::PropertyDescriptor<ARDOUR::FollowAction> follow_action0;
PBD::PropertyDescriptor<ARDOUR::FollowAction> follow_action1;
PBD::PropertyDescriptor<uint32_t> currently_playing;
PBD::PropertyDescriptor<uint32_t> follow_count;
PBD::PropertyDescriptor<int> follow_action_probability;
@ -68,6 +68,38 @@ namespace ARDOUR {
}
}
FollowAction::FollowAction (std::string const & str)
{
std::string::size_type colon = str.find_first_of (':');
if (colon == std::string::npos) {
throw failed_constructor ();
}
type = FollowAction::Type (string_2_enum (str.substr (0, colon), type));
/* We use the ulong representation of the bitset because the string
version is absurd.
*/
unsigned long ul;
std::stringstream ss (str.substr (colon+1));
ss >> ul;
if (!ss) {
throw failed_constructor();
}
targets = Targets (ul);
}
std::string
FollowAction::to_string () const
{
/* We use the ulong representation of the bitset because the string
version is absurd.
*/
return string_compose ("%1:%2", enum_2_string (type), targets.to_ulong());
}
Trigger * const Trigger::MagicClearPointerValue = (Trigger*) 0xfeedface;
Trigger::Trigger (uint32_t n, TriggerBox& b)
@ -82,8 +114,8 @@ Trigger::Trigger (uint32_t n, TriggerBox& b)
, _pending_velocity_gain (1.0)
, _velocity_gain (1.0)
, _launch_style (Properties::launch_style, OneShot)
, _follow_action0 (Properties::follow_action0, Again)
, _follow_action1 (Properties::follow_action1, Stop)
, _follow_action0 (Properties::follow_action0, FollowAction (FollowAction::Again))
, _follow_action1 (Properties::follow_action1, FollowAction (FollowAction::Stop))
, _follow_action_probability (Properties::follow_action_probability, 0)
, _follow_count (Properties::follow_count, 1)
, _quantization (Properties::quantization, Temporal::BBT_Offset (1, 0, 0))
@ -148,8 +180,8 @@ Trigger::swap_pending (Trigger* t)
bool
Trigger::will_not_follow () const
{
return (_follow_action0 == None && _follow_action_probability == 0) ||
(_follow_action0 == None && _follow_action1 == None);
return (_follow_action0.val().type == FollowAction::None && _follow_action_probability == 0) ||
(_follow_action0.val().type == FollowAction::None && _follow_action1.val().type == FollowAction::None);
}
void
@ -1132,18 +1164,18 @@ AudioTrigger::set_region_in_worker_thread (boost::shared_ptr<Region> r)
if (_segment_tempo == 0.) {
_stretchable = false;
_quantization = Temporal::BBT_Offset (-1, 0, 0);
_follow_action0 = None;
_follow_action0 = FollowAction (FollowAction::None);
} else {
if (probably_oneshot()) {
/* short trigger, treat as a one shot */
_stretchable = false;
_follow_action0 = None;
_follow_action0 = FollowAction (FollowAction::None);
_quantization = Temporal::BBT_Offset (-1, 0, 0);
} else {
_stretchable = true;
_quantization = Temporal::BBT_Offset (1, 0, 0);
_follow_action0 = Again;
_follow_action0 = FollowAction (FollowAction::Again);
}
}
@ -2138,7 +2170,6 @@ Trigger::make_property_quarks ()
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for stretch_mode = %1\n", Properties::stretch_mode.property_id));
}
const int32_t TriggerBox::default_triggers_per_box = 8;
Temporal::BBT_Offset TriggerBox::_assumed_trigger_duration (4, 0, 0);
//TriggerBox::TriggerMidiMapMode TriggerBox::_midi_map_mode (TriggerBox::AbletonPush);
TriggerBox::TriggerMidiMapMode TriggerBox::_midi_map_mode (TriggerBox::SequentialNote);
@ -2378,7 +2409,7 @@ TriggerBox::set_all_launch_style (ARDOUR::Trigger::LaunchStyle ls)
}
void
TriggerBox::set_all_follow_action (ARDOUR::Trigger::FollowAction fa, uint32_t fa_n)
TriggerBox::set_all_follow_action (ARDOUR::FollowAction const & fa, uint32_t fa_n)
{
for (uint64_t n = 0; n < all_triggers.size(); ++n) {
all_triggers[n]->set_follow_action (fa, fa_n);
@ -2982,7 +3013,7 @@ TriggerBox::determine_next_trigger (uint32_t current)
*/
int r = _pcg.rand (100); // 0 .. 99
Trigger::FollowAction fa;
FollowAction fa;
if (r >= all_triggers[current]->follow_action_probability()) {
fa = all_triggers[current]->follow_action (0);
@ -2994,14 +3025,14 @@ TriggerBox::determine_next_trigger (uint32_t current)
* nothing or just repeat the current trigger
*/
DEBUG_TRACE (DEBUG::Triggers, string_compose ("choose next trigger using follow action %1 given prob %2 and rnd %3\n", enum_2_string (fa), all_triggers[current]->follow_action_probability(), r));
DEBUG_TRACE (DEBUG::Triggers, string_compose ("choose next trigger using follow action %1 given prob %2 and rnd %3\n", fa.to_string(), all_triggers[current]->follow_action_probability(), r));
switch (fa) {
switch (fa.type) {
case Trigger::Stop:
case FollowAction::Stop:
return -1;
case Trigger::QueuedTrigger:
case FollowAction::QueuedTrigger:
/* XXX implement me */
return -1;
default:
@ -3015,15 +3046,15 @@ TriggerBox::determine_next_trigger (uint32_t current)
/* second switch: handle the "real" follow actions */
switch (fa) {
case Trigger::None:
switch (fa.type) {
case FollowAction::None:
return -1;
case Trigger::Again:
case FollowAction::Again:
return current;
case Trigger::NextTrigger:
case FollowAction::NextTrigger:
n = current + 1;
if (n < all_triggers.size()) {
if (all_triggers[n]->region()) {
@ -3032,7 +3063,7 @@ TriggerBox::determine_next_trigger (uint32_t current)
}
break;
case Trigger::PrevTrigger:
case FollowAction::PrevTrigger:
if (current > 0) {
n = current - 1;
if (all_triggers[n]->region()) {
@ -3041,7 +3072,7 @@ TriggerBox::determine_next_trigger (uint32_t current)
}
break;
case Trigger::ForwardTrigger:
case FollowAction::ForwardTrigger:
n = current;
while (true) {
++n;
@ -3062,7 +3093,7 @@ TriggerBox::determine_next_trigger (uint32_t current)
}
break;
case Trigger::ReverseTrigger:
case FollowAction::ReverseTrigger:
n = current;
while (true) {
if (n == 0) {
@ -3081,14 +3112,14 @@ TriggerBox::determine_next_trigger (uint32_t current)
}
break;
case Trigger::FirstTrigger:
case FollowAction::FirstTrigger:
for (n = 0; n < all_triggers.size(); ++n) {
if (all_triggers[n]->region() && !all_triggers[n]->active ()) {
return n;
}
}
break;
case Trigger::LastTrigger:
case FollowAction::LastTrigger:
for (int i = all_triggers.size() - 1; i >= 0; --i) {
if (all_triggers[i]->region() && !all_triggers[i]->active ()) {
return i;
@ -3096,7 +3127,7 @@ TriggerBox::determine_next_trigger (uint32_t current)
}
break;
case Trigger::AnyTrigger:
case FollowAction::AnyTrigger:
while (true) {
n = _pcg.rand (all_triggers.size());
if (!all_triggers[n]->region()) {
@ -3110,7 +3141,7 @@ TriggerBox::determine_next_trigger (uint32_t current)
return n;
case Trigger::OtherTrigger:
case FollowAction::OtherTrigger:
while (true) {
n = _pcg.rand (all_triggers.size());
if ((uint32_t) n == current) {
@ -3128,8 +3159,8 @@ TriggerBox::determine_next_trigger (uint32_t current)
/* NOTREACHED */
case Trigger::Stop:
case Trigger::QueuedTrigger:
case FollowAction::Stop:
case FollowAction::QueuedTrigger:
break;
}