13
0

provide a better method to decide if a trigger(slot) is occupied

This is necessary with clip recording because for some short time after recording,
a trigger may be playable despite not yet having a region.

GUI edition.
This commit is contained in:
Paul Davis 2024-10-02 13:46:59 -06:00
parent 1e8b2c521c
commit 1961a9207c
6 changed files with 19 additions and 19 deletions

View File

@ -1115,7 +1115,7 @@ Editor::finish_bringing_in_material (std::shared_ptr<Region> region,
if (mode == ImportAsTrigger) { if (mode == ImportAsTrigger) {
std::shared_ptr<Region> copy (RegionFactory::create (region, true)); std::shared_ptr<Region> copy (RegionFactory::create (region, true));
for (int s = 0; s < TriggerBox::default_triggers_per_box; ++s) { for (int s = 0; s < TriggerBox::default_triggers_per_box; ++s) {
if (!existing_track->triggerbox ()->trigger (s)->region ()) { if (!existing_track->triggerbox ()->trigger (s)->playable ()) {
existing_track->triggerbox ()->set_from_selection (s, copy); existing_track->triggerbox ()->set_from_selection (s, copy);
#if 1 /* assume drop from sidebar */ #if 1 /* assume drop from sidebar */
ARDOUR_UI_UTILS::copy_patch_changes (_session->the_auditioner (), existing_track->triggerbox ()->trigger (s)); ARDOUR_UI_UTILS::copy_patch_changes (_session->the_auditioner (), existing_track->triggerbox ()->trigger (s));

View File

@ -417,7 +417,7 @@ Editor::bounce_region_selection (bool with_processing)
if (!track) { if (!track) {
continue; continue;
} }
if (track->triggerbox()->trigger(trigger_slot)->region()) { if (track->triggerbox()->trigger(trigger_slot)->playable()) {
overwriting = true; overwriting = true;
} }
} }

View File

@ -4527,7 +4527,7 @@ Editor::bounce_range_selection (BounceTarget target, bool with_processing)
if (!track) { if (!track) {
continue; continue;
} }
if (track->triggerbox()->trigger(trigger_slot)->region()) { if (track->triggerbox()->trigger(trigger_slot)->playable()) {
overwriting = true; overwriting = true;
} }
} }

View File

@ -745,15 +745,15 @@ SlotPropertyWindow::SlotPropertyWindow (TriggerReference tref)
int col = 0; int col = 0;
table->attach(*slot_prop_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; table->attach(*slot_prop_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
if (trigger->region()) { if (trigger->the_region()) {
if (trigger->region()->data_type() == DataType::AUDIO) { if (trigger->the_region()->data_type() == DataType::AUDIO) {
_trig_box = manage(new AudioTriggerPropertiesBox ()); _trig_box = manage(new AudioTriggerPropertiesBox ());
_ops_box = manage(new AudioRegionOperationsBox ()); _ops_box = manage(new AudioRegionOperationsBox ());
_trim_box = manage(new AudioClipEditorBox ()); _trim_box = manage(new AudioClipEditorBox ());
_trig_box->set_trigger (tref); _trig_box->set_trigger (tref);
_trim_box->set_region(trigger->region(), tref); _trim_box->set_region(trigger->the_region(), tref);
_ops_box->set_session(&trigger->region()->session()); _ops_box->set_session(&trigger->the_region()->session());
table->attach(*_trig_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; table->attach(*_trig_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++; table->attach(*_ops_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;

View File

@ -404,15 +404,15 @@ TriggerPage::selection_changed ()
_slot_prop_box.set_slot (ref); _slot_prop_box.set_slot (ref);
_slot_prop_box.show (); _slot_prop_box.show ();
if (trigger->region ()) { if (trigger->the_region ()) {
if (trigger->region ()->data_type () == DataType::AUDIO) { if (trigger->the_region ()->data_type () == DataType::AUDIO) {
_audio_trig_box.set_trigger (ref); _audio_trig_box.set_trigger (ref);
_audio_trig_box.show (); _audio_trig_box.show ();
} else { } else {
_midi_trig_box.set_trigger (ref); _midi_trig_box.set_trigger (ref);
_midi_trig_box.show (); _midi_trig_box.show ();
std::shared_ptr<MidiRegion> mr = std::dynamic_pointer_cast<MidiRegion> (trigger->region()); std::shared_ptr<MidiRegion> mr = std::dynamic_pointer_cast<MidiRegion> (trigger->the_region());
if (mr) { if (mr) {
std::shared_ptr<MidiTrack> mt = std::dynamic_pointer_cast<MidiTrack> (entry->strip().stripable()); std::shared_ptr<MidiTrack> mt = std::dynamic_pointer_cast<MidiTrack> (entry->strip().stripable());
_midi_editor->set_region (mt, ref.slot(), mr); _midi_editor->set_region (mt, ref.slot(), mr);

View File

@ -315,7 +315,7 @@ TriggerEntry::draw_launch_icon (Cairo::RefPtr<Cairo::Context> context, float sz,
bool active = trigger ()->active (); bool active = trigger ()->active ();
if (!trigger ()->region ()) { if (!trigger ()->playable ()) {
bool solid = false; bool solid = false;
context->arc (margin + (size * 0.75), margin + (size * 0.75), (size * 0.75), 0., 360.0 * (M_PI/180.0)); context->arc (margin + (size * 0.75), margin + (size * 0.75), (size * 0.75), 0., 360.0 * (M_PI/180.0));
@ -533,7 +533,7 @@ TriggerEntry::render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Conte
} }
/* follow-action icon */ /* follow-action icon */
if (trigger ()->region () && trigger ()->will_follow ()) { if (trigger ()->playable () && trigger ()->will_follow ()) {
context->set_identity_matrix (); context->set_identity_matrix ();
context->translate (self.x0, self.y0 - 0.5); context->translate (self.x0, self.y0 - 0.5);
context->translate (width - height, 0); // right side of the widget context->translate (width - height, 0); // right side of the widget
@ -546,7 +546,7 @@ void
TriggerEntry::on_trigger_changed (PropertyChange const& change) TriggerEntry::on_trigger_changed (PropertyChange const& change)
{ {
if (change.contains (ARDOUR::Properties::name)) { if (change.contains (ARDOUR::Properties::name)) {
if (trigger ()->region ()) { if (trigger ()->playable ()) {
name_text->set (short_version (trigger ()->name (), 16)); name_text->set (short_version (trigger ()->name (), 16));
} else { } else {
name_text->set (""); name_text->set ("");
@ -672,7 +672,7 @@ TriggerEntry::name_button_event (GdkEvent* ev)
bool bool
TriggerEntry::play_button_event (GdkEvent* ev) TriggerEntry::play_button_event (GdkEvent* ev)
{ {
if (!trigger ()->region ()) { if (!trigger ()->playable ()) {
/* empty slot; this is just a stop button */ /* empty slot; this is just a stop button */
switch (ev->type) { switch (ev->type) {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
@ -781,7 +781,7 @@ TriggerEntry::follow_button_event (GdkEvent* ev)
bool bool
TriggerEntry::event (GdkEvent* ev) TriggerEntry::event (GdkEvent* ev)
{ {
if (!trigger ()->region ()) { if (!trigger ()->playable ()) {
return false; return false;
} }
@ -877,7 +877,7 @@ TriggerEntry::drag_begin (Glib::RefPtr<Gdk::DragContext> const& context)
/* ctx leaves scope, cr is destroyed, and pixmap surface is flush()ed */ /* ctx leaves scope, cr is destroyed, and pixmap surface is flush()ed */
} }
std::shared_ptr<Region> region = trigger ()->region (); std::shared_ptr<Region> region = trigger ()->the_region ();
if (region) { if (region) {
PublicEditor::instance ().pbdid_dragged_dt = region->data_type (); PublicEditor::instance ().pbdid_dragged_dt = region->data_type ();
} else { } else {
@ -905,7 +905,7 @@ TriggerEntry::drag_data_get (Glib::RefPtr<Gdk::DragContext> const&, Gtk::Selecti
return; return;
} }
if (data.get_target () == "x-ardour/region.pbdid") { if (data.get_target () == "x-ardour/region.pbdid") {
std::shared_ptr<Region> region = trigger ()->region (); std::shared_ptr<Region> region = trigger ()->the_region ();
if (region) { if (region) {
data.set (data.get_target (), region->id ().to_s ()); data.set (data.get_target (), region->id ().to_s ());
} }
@ -1100,8 +1100,8 @@ TriggerBoxUI::drag_data_received (Glib::RefPtr<Gdk::DragContext> const& context,
Trigger::UIState *state = new Trigger::UIState(); Trigger::UIState *state = new Trigger::UIState();
source->get_ui_state(*state); source->get_ui_state(*state);
std::shared_ptr<Trigger::UIState> state_p (state); std::shared_ptr<Trigger::UIState> state_p (state);
_triggerbox.enqueue_trigger_state_for_region(source->region(), state_p); _triggerbox.enqueue_trigger_state_for_region(source->the_region(), state_p);
_triggerbox.set_from_selection (n, source->region()); _triggerbox.set_from_selection (n, source->the_region());
context->drag_finish (true, false, time); context->drag_finish (true, false, time);
} else { } else {
context->drag_finish (false, false, time); context->drag_finish (false, false, time);