From dcea35191c0fe93942d63a0e1feb49af41e15b01 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 15 Sep 2020 15:50:02 +0200 Subject: [PATCH] Consolidate code: use API to print plugin-type 1/2 --- libs/surfaces/faderport8/faderport8.cc | 24 ++---------------------- share/scripts/list_plugins.lua | 9 +-------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/libs/surfaces/faderport8/faderport8.cc b/libs/surfaces/faderport8/faderport8.cc index d038eca62e..e215fa77bf 100644 --- a/libs/surfaces/faderport8/faderport8.cc +++ b/libs/surfaces/faderport8/faderport8.cc @@ -41,6 +41,7 @@ #include "ardour/panner_shell.h" #include "ardour/plugin.h" #include "ardour/plugin_insert.h" +#include "ardour/plugin_manager.h" #include "ardour/processor.h" #include "ardour/rc_configuration.h" #include "ardour/route.h" @@ -1428,27 +1429,6 @@ FaderPort8::select_plugin_preset (size_t num) assign_processor_ctrls (); } -/* short 4 chars at most */ -static std::string plugintype (ARDOUR::PluginType t) { - switch (t) { - case AudioUnit: - return "AU"; - case LADSPA: - return "LV1"; - case LV2: - return "LV2"; - case Windows_VST: - case LXVST: - case MacVST: - return "VST"; - case Lua: - return "Lua"; - default: - break; - } - return enum_2_string (t); -} - void FaderPort8::spill_plugins () { @@ -1540,7 +1520,7 @@ FaderPort8::spill_plugins () _ctrls.strip(id).select_button ().set_blinking (false); _ctrls.strip(id).set_text_line (0, proc->name()); _ctrls.strip(id).set_text_line (1, pi->plugin()->maker()); - _ctrls.strip(id).set_text_line (2, plugintype (pi->type())); + _ctrls.strip(id).set_text_line (2, PluginManager::plugin_type_name (pi->type())); _ctrls.strip(id).set_text_line (3, ""); pi->ActiveChanged.connect (processor_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::spill_plugins, this), this); diff --git a/share/scripts/list_plugins.lua b/share/scripts/list_plugins.lua index aeddb48b68..fb2f6f1b0d 100644 --- a/share/scripts/list_plugins.lua +++ b/share/scripts/list_plugins.lua @@ -28,14 +28,7 @@ function factory () return function () end function plugintypestr (t) - if (t == ARDOUR.PluginType.LADSPA) then return "LADSPA" end - if (t == ARDOUR.PluginType.LV2) then return "LV2" end - if (t == ARDOUR.PluginType.AudioUnit) then return "AU" end - if (t == ARDOUR.PluginType.Windows_VST) then return "VST" end - if (t == ARDOUR.PluginType.LXVST) then return "VST" end - if (t == ARDOUR.PluginType.MacVST) then return "VST" end - if (t == ARDOUR.PluginType.Lua) then return "Lua" end - return "??" + return ARDOUR.PluginType.name (t) end if next(all_plugs) == nil then