From 00c76e785c3fbf4ca3464b16be1808dc2f52ae90 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 17 Feb 2024 15:01:58 +0100 Subject: [PATCH] Add Lua binding to query current editor-mixer route https://discourse.ardour.org/t/lua-editor-mixer-strip/109886 --- gtk2_ardour/editor.h | 2 ++ gtk2_ardour/editor_mixer.cc | 9 +++++++++ gtk2_ardour/luainstance.cc | 2 ++ gtk2_ardour/public_editor.h | 2 ++ 4 files changed, 15 insertions(+) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index aa7938b334..71aad5fb1e 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -295,6 +295,8 @@ public: void set_selection (std::list, Selection::Operation); void set_selected_midi_region_view (MidiRegionView&); + std::shared_ptr current_mixer_stripable () const; + bool extend_selection_to_track (TimeAxisView&); void play_selection (); diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index c99a819683..4f5ed4cf81 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -176,6 +176,15 @@ Editor::show_editor_mixer (bool yn) #endif } +std::shared_ptr +Editor::current_mixer_stripable () const +{ + if (current_mixer_strip) { + return current_mixer_strip->route (); + } + return std::shared_ptr (); +} + #ifdef __APPLE__ void Editor::ensure_all_elements_drawn () diff --git a/gtk2_ardour/luainstance.cc b/gtk2_ardour/luainstance.cc index 0de6a24078..f2c5fe0966 100644 --- a/gtk2_ardour/luainstance.cc +++ b/gtk2_ardour/luainstance.cc @@ -912,6 +912,8 @@ LuaInstance::register_classes (lua_State* L, bool sandbox) .addFunction ("get_cut_buffer", &PublicEditor::get_cut_buffer) .addRefFunction ("get_selection_extents", &PublicEditor::get_selection_extents) + .addFunction ("current_mixer_stripable", &PublicEditor::current_mixer_stripable) + .addFunction ("set_selection", &PublicEditor::set_selection) .addFunction ("play_selection", &PublicEditor::play_selection) diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 507bc6e7bb..e474b95dfb 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -242,6 +242,8 @@ public: virtual void set_selection (std::list, Selection::Operation) = 0; virtual void set_selected_midi_region_view (MidiRegionView&) = 0; + virtual std::shared_ptr current_mixer_stripable () const = 0; + virtual bool extend_selection_to_track (TimeAxisView&) = 0; virtual void play_solo_selection(bool restart) = 0; virtual void play_selection () = 0;