diff --git a/gtk2_ardour/about.cc b/gtk2_ardour/about.cc index 2007f06749..771512f331 100644 --- a/gtk2_ardour/about.cc +++ b/gtk2_ardour/about.cc @@ -258,7 +258,8 @@ static const char* translators[] = { N_("Brazilian Portuguese:\n\tAlexander da Franca Fernandes \ \n\tChris Ross \n"), N_("Spanish:\n\t Alex Krohn \ -\n\tPablo Fernández \n"), +\n\tPablo Fernández \ +\n\tJuan Cruz Vardy Sabaté \n"), N_("Russian:\n\t Igor Blinov \ \n\tAleksandr Koltsov \ \n\tPetr Semiletov \ diff --git a/gtk2_ardour/cue_editor.cc b/gtk2_ardour/cue_editor.cc index b6cae5e0e2..6197db0944 100644 --- a/gtk2_ardour/cue_editor.cc +++ b/gtk2_ardour/cue_editor.cc @@ -489,10 +489,15 @@ CueEditor::build_upper_toolbar () play_button.set_size_request (PX_SCALE(20), PX_SCALE(20)); #undef PX_SCALE + set_tooltip (play_button, _("Play this clip from the top")); + set_tooltip (loop_button, _("Loop the range of this clip")); + set_tooltip (solo_button, _("Solo the track containing this clip")); + play_button.signal_button_release_event().connect (sigc::mem_fun (*this, &CueEditor::play_button_press), false); solo_button.signal_button_release_event().connect (sigc::mem_fun (*this, &CueEditor::solo_button_press), false); loop_button.signal_button_release_event().connect (sigc::mem_fun (*this, &CueEditor::loop_button_press), false); } else { + set_tooltip (play_button, _("Launch selected clip")); rec_box.pack_start (play_button, false, false); play_button.signal_button_release_event().connect (sigc::mem_fun (*this, &CueEditor::bang_button_press), false); } @@ -502,6 +507,9 @@ CueEditor::build_upper_toolbar () rec_enable_button.signal_button_release_event().connect (sigc::mem_fun (*this, &CueEditor::rec_button_press), false); rec_enable_button.set_name ("record enable button"); + set_tooltip (rec_enable_button, _("Record clip")); + set_tooltip (length_selector, _("Record length")); + std::string label; std::string noun; diff --git a/gtk2_ardour/editing_context.cc b/gtk2_ardour/editing_context.cc index 9b1796c787..6d6fde5fc1 100644 --- a/gtk2_ardour/editing_context.cc +++ b/gtk2_ardour/editing_context.cc @@ -234,7 +234,6 @@ EditingContext::EditingContext (std::string const & name) set_tooltip (play_note_selection_button, _("Play notes when selected")); set_tooltip (note_mode_button, _("Switch between sustained and percussive mode")); - set_tooltip (follow_playhead_button, _("Scroll automatically to keep playhead visible")); set_tooltip (follow_edits_button, _("Playhead follows Range tool clicks, and Range selections")); /* Leave tip for full zoom button to derived class */ set_tooltip (visible_channel_selector, _("Select visible MIDI channel")); @@ -455,6 +454,8 @@ EditingContext::register_common_actions (Bindings* common_bindings, std::string follow_playhead_action = toggle_reg_sens (_common_actions, "toggle-follow-playhead", _("Follow Playhead"), sigc::mem_fun (*this, &EditingContext::follow_playhead_chosen)); stationary_playhead_action = toggle_reg_sens (_common_actions, "toggle-stationary-playhead", _("Stationary Playhead"), (mem_fun(*this, &EditingContext::stationary_playhead_chosen))); + follow_playhead_action->set_tooltip (_("Scroll automatically to keep playhead visible")); + undo_action = reg_sens (_common_actions, "undo", S_("Command|Undo"), sigc::bind (sigc::mem_fun (*this, &EditingContext::undo), 1U)); redo_action = reg_sens (_common_actions, "redo", _("Redo"), sigc::bind (sigc::mem_fun (*this, &EditingContext::redo), 1U)); alternate_redo_action = reg_sens (_common_actions, "alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun (*this, &EditingContext::redo), 1U)); @@ -2350,8 +2351,11 @@ EditingContext::bind_mouse_mode_buttons () RefPtr act; act = ActionManager::get_action ((_name + X_("Editing")).c_str(), X_("temporal-zoom-in")); + act->set_tooltip (_("Zoom In")); zoom_in_button.set_related_action (act); + act = ActionManager::get_action ((_name + X_("Editing")).c_str(), X_("temporal-zoom-out")); + act->set_tooltip (_("Zoom Out")); zoom_out_button.set_related_action (act); follow_playhead_button.set_related_action (follow_playhead_action); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 062ebdb708..dc601b3e97 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -2894,8 +2894,6 @@ Editor::setup_tooltips () set_tooltip (*_group_tabs, _("Groups: click to (de)activate\nContext-click for other operations")); set_tooltip (nudge_forward_button, _("Nudge Region/Selection Later")); set_tooltip (nudge_backward_button, _("Nudge Region/Selection Earlier")); - set_tooltip (zoom_in_button, _("Zoom In")); - set_tooltip (zoom_out_button, _("Zoom Out")); set_tooltip (zoom_preset_selector, _("Zoom to Time Scale")); set_tooltip (full_zoom_button, _("Zoom to Session")); set_tooltip (tav_expand_button, _("Expand Tracks")); diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index cd217d6102..a0f7e18826 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -1523,7 +1523,7 @@ Editor::sensitize_the_right_region_actions (bool because_canvas_crossing) if (rs.size() > 1) { _region_actions->get_action("show-region-list-editor")->set_sensitive (false); - _region_actions->get_action("show-region-properties")->set_sensitive (false); + _region_actions->get_action("edit-region-dedicated-window")->set_sensitive (false); _region_actions->get_action("rename-region")->set_sensitive (false); /* XXX need to check whether there is than 1 per playlist, because otherwise this makes no sense. diff --git a/gtk2_ardour/plugin_pin_dialog.cc b/gtk2_ardour/plugin_pin_dialog.cc index fa62276515..7f4b8d132b 100644 --- a/gtk2_ardour/plugin_pin_dialog.cc +++ b/gtk2_ardour/plugin_pin_dialog.cc @@ -123,7 +123,7 @@ PluginPinWidget::PluginPinWidget (std::shared_ptr pi) _pm_size_group = SizeGroup::create (SIZE_GROUP_BOTH); _add_plugin.set_tweaks (ArdourButton::Square); _del_plugin.set_tweaks (ArdourButton::Square); - if (_pi->plugin (0)->get_info()->reconfigurable_io ()) { + if (_pi->plugin (0)->get_info()->reconfigurable_io () || _pi->plugin (0)->get_info()->variable_bus_layout ()) { _pm_size_group->add_widget (_add_input_audio); _pm_size_group->add_widget (_del_input_audio); _pm_size_group->add_widget (_add_input_midi); @@ -151,7 +151,7 @@ PluginPinWidget::PluginPinWidget (std::shared_ptr pi) /* left side */ tl->pack_start (_set_config, false, false); - if (_pi->plugin (0)->get_info()->reconfigurable_io ()) { + if (_pi->plugin (0)->get_info()->reconfigurable_io () || _pi->plugin (0)->get_info()->variable_bus_layout ()) { box = manage (new HBox ()); box->set_border_width (2); box->pack_start (_add_input_audio, true, false); diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 5d18b2cb59..59e2079977 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -384,20 +384,36 @@ PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& return false; } + bool search_name = _search_name_checkbox->get_active(); + bool search_tags = _search_tags_checkbox->get_active(); + bool search_creator = false; + + if (!search_name && !search_tags) { + search_name = true; + search_tags = true; + search_creator = true; + } + if (!searchstr.empty()) { - if (_search_name_checkbox->get_active()) { /* name contains */ + if (search_name) { std::string compstr = info->name; setup_search_string (compstr); maybe_show |= match_search_strings (compstr, searchstr); } - if (_search_tags_checkbox->get_active()) { /* tag contains */ + if (search_tags) { std::string compstr = manager.get_tags_as_string (info); setup_search_string (compstr); maybe_show |= match_search_strings (compstr, searchstr); } + if (search_creator) { + std::string compstr = info->creator; + setup_search_string (compstr); + maybe_show |= match_search_strings (compstr, searchstr); + } + if (!maybe_show) { return false; } diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index be9cb36b81..1bcf456152 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -492,6 +492,8 @@ def configure(conf): autowaf.check_pkg(conf, 'pangoft2', uselib_store='PANGOFT2', atleast_version='1.36.8', mandatory=False) autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG') + conf.check(header_name='unistd.h', define_name='HAVE_UNISTD_H',mandatory=False) + if conf.env.CC_NAME == 'gcc' and Options.options.strict: conf.define('GLIB_DISABLE_DEPRECATION_WARNINGS', 1) for var in ['CFLAGS', 'CXXFLAGS']: diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index bab471ddfa..0557c7cffd 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -315,6 +315,7 @@ public: virtual bool reconfigure_io (ChanCount /*in*/, ChanCount /*aux_in*/, ChanCount /*out*/) { return true; } virtual bool match_variable_io (ChanCount& /*in*/, ChanCount& /*aux_in*/, ChanCount& /*out*/) { return false; } + virtual void request_bus_layout (ChanCount const& /*in*/, ChanCount const& /*aux_in*/, ChanCount const& /*out*/) { } virtual ChanCount output_streams () const; virtual ChanCount input_streams () const; @@ -532,6 +533,11 @@ public: /* @return true if the plugin can change its inputs or outputs on demand. */ virtual bool reconfigurable_io () const { return false; } + /* @return true if the plugin has configurable busses but no AU style reconfigureable I/O (VST3) + * implies request_bus_layout () + */ + virtual bool variable_bus_layout () const { return false; } + /* max [re]configurable outputs (if finite, 0 otherwise) */ virtual uint32_t max_configurable_outputs () const { diff --git a/libs/ardour/ardour/vst3_plugin.h b/libs/ardour/ardour/vst3_plugin.h index 77facaa43b..2ea28375ad 100644 --- a/libs/ardour/ardour/vst3_plugin.h +++ b/libs/ardour/ardour/vst3_plugin.h @@ -202,6 +202,7 @@ public: void set_owner (ARDOUR::SessionObject* o); void set_non_realtime (bool); + void request_bus_layout (uint32_t main_in, uint32_t aux_in, uint32_t main_out); void enable_io (std::vector const&, std::vector const&, bool force = false); void process (float** ins, float** outs, uint32_t n_samples); @@ -242,8 +243,10 @@ private: bool disconnect_components (); bool update_processor (); + void query_io_config (); int32 count_channels (Vst::MediaType, Vst::BusDirection, Vst::BusType); + bool evoral_to_vst3 (Vst::Event&, Evoral::Event const&, int32_t); void update_shadow_data (); @@ -403,6 +406,12 @@ public: IOPortDescription describe_io_port (DataType dt, bool input, uint32_t id) const; PluginOutputConfiguration possible_output () const; + void request_bus_layout (ChanCount const& /*in*/, ChanCount const& /*aux_in*/, ChanCount const& /*out*/); + bool reconfigure_io (ChanCount /*in*/, ChanCount /*aux_in*/, ChanCount /*out*/); + + ChanCount output_streams () const; + ChanCount input_streams () const; + void set_automation_control (uint32_t, std::shared_ptr); std::string state_node_name () const @@ -487,6 +496,8 @@ public: bool is_instrument () const; PBD::Searchpath preset_search_path () const; + bool variable_bus_layout () const { return true; } + std::optional has_editor; std::shared_ptr m; diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index ebeea2d71e..e0d92f4331 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -46,6 +46,7 @@ #include "ardour/port.h" #include "ardour/session.h" #include "ardour/types.h" +#include "ardour/vst3_plugin.h" #include "pbd/i18n.h" @@ -2100,6 +2101,10 @@ PluginInsert::configure_io (ChanCount in, ChanCount out) /* NB. When resolving impossible matches, "replicate 1 time" is valid. * e.g. add a MIDI filter (1 MIDI in, 1 MIDI out) after some audio plugin */ assert (!_plugins.front()->get_info()->reconfigurable_io ()); + /* VST3 */ + for (auto const& p : _plugins) { + p->reconfigure_io (natural_input_streams (), aux_in, natural_output_streams ()); + } break; default: @@ -2260,6 +2265,24 @@ PluginInsert::configure_io (ChanCount in, ChanCount out) bool PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out) { + if (plugin()->get_info ()->variable_bus_layout ()) { + ChanCount input_streams = natural_input_streams (); + ChanCount sc; + if (_sidechain) { + _sidechain->can_support_io_configuration (sc, sc); + } + for (auto const& p : _plugins) { + if (_custom_cfg) { + p->request_bus_layout (_custom_sinks, sc, _custom_sinks); + } else { + p->request_bus_layout (in, sc, in); + } + } + if (input_streams != natural_input_streams ()) { + mapping_changed (); + } + } + if (_sidechain) { _sidechain->can_support_io_configuration (in, out); // never fails, sets "out" } diff --git a/libs/ardour/region_fx_plugin.cc b/libs/ardour/region_fx_plugin.cc index 431cf1f011..87c5b59de4 100644 --- a/libs/ardour/region_fx_plugin.cc +++ b/libs/ardour/region_fx_plugin.cc @@ -32,6 +32,7 @@ #include "ardour/readonly_control.h" #include "ardour/region_fx_plugin.h" #include "ardour/session.h" +#include "ardour/vst3_plugin.h" using namespace std; using namespace ARDOUR; @@ -835,6 +836,12 @@ RegionFxPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& ou out = ChanCount::min (in, out); return true; } + if (plugin()->get_info ()->variable_bus_layout ()) { + ChanCount sc; + for (auto const& p : _plugins) { + p->request_bus_layout (in, sc, in); + } + } return private_can_support_io_configuration (in, out).method != Impossible; } diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index c881cdad92..89311127d4 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -16,13 +16,16 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifdef WAF_BUILD +#include "libardour-config.h" +#endif + #include #include "pbd/gstdio_compat.h" #include #include "pbd/basename.h" -#include "pbd/compose.h" #include "pbd/convert.h" #include "pbd/debug.h" #include "pbd/error.h" @@ -98,22 +101,6 @@ VST3Plugin::init () _plug->OnResizeView.connect_same_thread (_connections, std::bind (&VST3Plugin::forward_resize_view, this, _1, _2)); _plug->OnParameterChange.connect_same_thread (_connections, std::bind (&VST3Plugin::parameter_change_handler, this, _1, _2, _3)); _plug->OnProcessorChange.connect_same_thread (_connections, [&](ARDOUR::RouteProcessorChange const& rpc) { Plugin::send_processors_changed (rpc); }); - - /* assume only default active busses are connected */ - for (auto const& abi : _plug->bus_info_in ()) { - for (int32_t i = 0; i < abi.second.n_chn; ++i) { - _connected_inputs.push_back (abi.second.dflt); - } - } - - for (auto const& abi : _plug->bus_info_out ()) { - for (int32_t i = 0; i < abi.second.n_chn; ++i) { - _connected_outputs.push_back (abi.second.dflt); - } - } - - /* pre-configure from GUI thread */ - _plug->enable_io (_connected_inputs, _connected_outputs, true); } void @@ -337,6 +324,53 @@ VST3Plugin::possible_output () const #endif } +ChanCount +VST3Plugin::input_streams () const +{ + ChanCount cc; + cc.set_audio (_plug->n_audio_inputs (true)); + cc.set_midi (_plug->n_midi_inputs ()); + return cc; +} + +ChanCount +VST3Plugin::output_streams () const +{ + ChanCount cc; + cc.set_audio (_plug->n_audio_outputs (true)); + cc.set_midi (_plug->n_midi_outputs ()); + return cc; +} + +void +VST3Plugin::request_bus_layout (ChanCount const& in, ChanCount const& aux_in, ChanCount const& out) +{ + _plug->request_bus_layout (in.n_audio (), aux_in.n_audio (), out.n_audio ()); +} + +bool +VST3Plugin::reconfigure_io (ChanCount in, ChanCount aux_in, ChanCount out) +{ + DEBUG_TRACE (DEBUG::VST3Config, string_compose ("VST3Plugin::reconfigure_io in: %1 aux: %2 out: %3 ; n_in=%4 n_out=%5\n", + in, aux_in, out, _plug->n_audio_inputs (), _plug->n_audio_outputs ())); + + assert (_plug->n_audio_inputs () >= in.n_audio () + aux_in.n_audio ()); + assert (_plug->n_audio_outputs () >= out.n_audio ()); + + _connected_inputs.clear (); + _connected_inputs.resize (in.n_audio () + aux_in.n_audio ()); + _connected_inputs.flip (); + _connected_inputs.resize (_plug->n_audio_inputs ()); + + _connected_outputs.clear (); + _connected_outputs.resize (out.n_audio ()); + _connected_outputs.flip (); + _connected_outputs.resize (_plug->n_audio_outputs ()); + + _plug->enable_io (_connected_inputs, _connected_outputs); + return true; +} + /* **************************************************************************** * Plugin UI */ @@ -838,8 +872,6 @@ VST3Plugin::connect_and_run (BufferSet& bufs, } } - _plug->enable_io (_connected_inputs, _connected_outputs); - _plug->process (ins, outs, n_samples); /* handle outgoing MIDI events */ @@ -1303,13 +1335,14 @@ VST3PI::VST3PI (std::shared_ptr m, std::string unique_ _busbuf_in.resize (_n_bus_in); _busbuf_out.resize (_n_bus_out); - /* do not re-order, _io_name is build in sequence */ - _n_inputs = count_channels (Vst::kAudio, Vst::kInput, Vst::kMain); - _n_aux_inputs = count_channels (Vst::kAudio, Vst::kInput, Vst::kAux); - _n_outputs = count_channels (Vst::kAudio, Vst::kOutput, Vst::kMain); - _n_aux_outputs = count_channels (Vst::kAudio, Vst::kOutput, Vst::kAux); - _n_midi_inputs = count_channels (Vst::kEvent, Vst::kInput, Vst::kMain); - _n_midi_outputs = count_channels (Vst::kEvent, Vst::kOutput, Vst::kMain); + query_io_config (); + + if (n_audio_inputs () == 0 && n_audio_outputs () == 0 && n_midi_inputs () == 0 && n_midi_outputs () == 0) { + DEBUG_TRACE (DEBUG::VST3Config, "forcing I/O rescan with stereo layout\n"); + /* see also vst3_scan discover_vst3 -- assume stereo by default */ + request_bus_layout (2, 0, 2); + query_io_config (); + } if (!connect_components ()) { //_controller->terminate(); // XXX ? @@ -1547,6 +1580,26 @@ VST3PI::queryInterface (const TUID _iid, void** obj) return kNoInterface; } +void +VST3PI::query_io_config () +{ + _io_name[Vst::kAudio][Vst::kInput].clear (); + _io_name[Vst::kAudio][Vst::kOutput].clear (); + _io_name[Vst::kEvent][Vst::kInput].clear (); + _io_name[Vst::kEvent][Vst::kOutput].clear (); + _bus_info_in.clear (); + _bus_info_out.clear (); + + /* do not re-order, _io_name is build in sequence */ + _n_inputs = count_channels (Vst::kAudio, Vst::kInput, Vst::kMain); + _n_aux_inputs = count_channels (Vst::kAudio, Vst::kInput, Vst::kAux); + _n_outputs = count_channels (Vst::kAudio, Vst::kOutput, Vst::kMain); + _n_aux_outputs = count_channels (Vst::kAudio, Vst::kOutput, Vst::kAux); + _n_midi_inputs = count_channels (Vst::kEvent, Vst::kInput, Vst::kMain); + _n_midi_outputs = count_channels (Vst::kEvent, Vst::kOutput, Vst::kMain); + +} + tresult VST3PI::restartComponent (int32 flags) { @@ -2253,6 +2306,72 @@ VST3PI::set_event_bus_state (bool enable) } } +void +VST3PI::request_bus_layout (uint32_t in, uint32_t aux_in, uint32_t out) +{ + // TODO only if changed .. and if plugin doesn't have defaults + + DEBUG_TRACE (DEBUG::VST3Config, string_compose ("VST3PI::request_bus_layout: in = %1 aux-in = %2 out = %3\n", in, aux_in, out)); + + bool was_active = _is_processing; + if (!deactivate ()) { + DEBUG_TRACE (DEBUG::VST3Config, "VST3PI::request_bus_layout failed to deactivate plugin\n"); + } + + typedef std::vector VSTSpeakerArrangements; + VSTSpeakerArrangements sa_in; + VSTSpeakerArrangements sa_out; + + Vst::SpeakerArrangement sa = ((uint64_t)1 << in) - 1; + if (in == 1 /*Vst::SpeakerArr::kSpeakerL */ && !_no_kMono) { + sa = Vst::SpeakerArr::kMono; /* 1 << 19 */ + } + + if (_n_bus_in > 0) { + sa_in.push_back (sa); + } + + sa = ((uint64_t)1 << out) - 1; + if (out == 1 /*Vst::SpeakerArr::kSpeakerL */ && !_no_kMono) { + sa = Vst::SpeakerArr::kMono; /* 1 << 19 */ + } + + if (_n_bus_out > 0) { + sa_out.push_back (sa); + } + + sa = ((uint64_t)1 << aux_in) - 1; + + if (_n_bus_in > 1) { + sa_in.push_back (sa); + } + + sa = 0; + while (sa_in.size () < (VSTSpeakerArrangements::size_type) _n_bus_in) { + sa_in.push_back (sa); + } + + while (sa_out.size () < (VSTSpeakerArrangements::size_type) _n_bus_out) { + sa_out.push_back (sa); + } + + Vst::SpeakerArrangement null_arrangement = {}; +#ifndef NDEBUG + tresult rv = +#endif + _processor->setBusArrangements (sa_in.size () > 0 ? &sa_in[0] : &null_arrangement, sa_in.size (), + sa_out.size () > 0 ? &sa_out[0] : &null_arrangement, sa_out.size ()); + + DEBUG_TRACE (DEBUG::VST3Config, string_compose ("VST3PI::request_bus_layout setBusArrangements ins = %1 outs = %2 | rv = %3\n", sa_in.size (), sa_out.size (), rv)); + + query_io_config (); + + if (was_active) { + activate (); + } + +} + void VST3PI::enable_io (std::vector const& ins, std::vector const& outs, bool force) { @@ -2273,11 +2392,11 @@ VST3PI::enable_io (std::vector const& ins, std::vector const& outs, _enabled_audio_in = ins; _enabled_audio_out = outs; - assert (_enabled_audio_in.size () == n_audio_inputs ()); - assert (_enabled_audio_out.size () == n_audio_outputs ()); /* check that settings have not changed */ assert (_n_bus_in == _component->getBusCount (Vst::kAudio, Vst::kInput)); assert (_n_bus_out == _component->getBusCount (Vst::kAudio, Vst::kOutput)); + assert (_bus_info_in.size () == _n_bus_in); + assert (_bus_info_out.size () == _n_bus_out); DEBUG_TRACE (DEBUG::VST3Config, string_compose ("VST3PI::enable_io: n_bus_in = %1 n_bus_out = %2\n", _n_bus_in, _n_bus_out)); diff --git a/libs/ardour/vst3_scan.cc b/libs/ardour/vst3_scan.cc index ed8a62fa45..919ef92ba2 100644 --- a/libs/ardour/vst3_scan.cc +++ b/libs/ardour/vst3_scan.cc @@ -74,7 +74,7 @@ static const char* fmt_type (Vst::BusType t) { } static int32 -count_channels (Vst::IComponent* c, Vst::MediaType media, Vst::BusDirection dir, Vst::BusType type, bool verbose = false) +count_channels (Vst::IComponent* c, Vst::MediaType media, Vst::BusDirection dir, Vst::BusType type, bool verbose = false, bool can_fail = true) { /* see also libs/ardour/vst3_plugin.cc VST3PI::count_channels */ int32 n_busses = c->getBusCount (media, dir); @@ -100,13 +100,57 @@ count_channels (Vst::IComponent* c, Vst::MediaType media, Vst::BusDirection dir, } else { n_channels += bus.channelCount; } - } else if (verbose && rv != kResultTrue) { - PBD::info << "VST3: \\ error getting busInfo for bus: " << i << " rv: " << rv << ", got type: " << fmt_type (bus.busType) << endmsg; + } else if (rv != kResultTrue) { + if (verbose) { + PBD::info << "VST3: \\ error getting busInfo for bus: " << i << " rv: " << rv << ", got type: " << fmt_type (bus.busType) << endmsg; + } + if (!can_fail) { + return -1; + } } } return n_channels; } +static bool +count_all_count_channels (ARDOUR::VST3Info& nfo, Vst::IComponent* c, bool verbose, bool require_result) +{ + nfo.n_inputs = count_channels (c, Vst::kAudio, Vst::kInput, Vst::kMain, verbose, require_result); + nfo.n_aux_inputs = count_channels (c, Vst::kAudio, Vst::kInput, Vst::kAux, verbose); + nfo.n_outputs = count_channels (c, Vst::kAudio, Vst::kOutput, Vst::kMain, verbose, require_result); + nfo.n_aux_outputs = count_channels (c, Vst::kAudio, Vst::kOutput, Vst::kAux, verbose); + nfo.n_midi_inputs = count_channels (c, Vst::kEvent, Vst::kInput, Vst::kMain, verbose); + nfo.n_midi_outputs = count_channels (c, Vst::kEvent, Vst::kOutput, Vst::kMain, verbose); + + return nfo.n_inputs < 0 || nfo.n_outputs < 0; +} + +static void +set_speaker_arrangement (Vst::IComponent* c, IPtr p) +{ + Vst::SpeakerArrangement null_arrangement = {}; + typedef std::vector VSTSpeakerArrangements; + VSTSpeakerArrangements sa_in; + VSTSpeakerArrangements sa_out; + + /* assume stereo by default */ + int n_bus_in = c->getBusCount (Vst::kAudio, Vst::kInput); + int n_bus_out = c->getBusCount (Vst::kAudio, Vst::kOutput); + + while (sa_in.size () < (VSTSpeakerArrangements::size_type) n_bus_in) { + Vst::SpeakerArrangement sa = Vst::SpeakerArr::kStereo; + sa_in.push_back (sa); + } + while (sa_out.size () < (VSTSpeakerArrangements::size_type) n_bus_out) { + Vst::SpeakerArrangement sa = Vst::SpeakerArr::kStereo; + sa_out.push_back (sa); + } + + p->setBusArrangements (sa_in.size () > 0 ? &sa_in[0] : &null_arrangement, sa_in.size (), + sa_out.size () > 0 ? &sa_out[0] : &null_arrangement, sa_out.size ()); + +} + static bool discover_vst3 (std::shared_ptr m, std::vector& rv, bool verbose) { @@ -209,12 +253,12 @@ discover_vst3 (std::shared_ptr m, std::vectorsetProcessing (false); component->setActive (false); diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 1f940d57c7..b6b55fb697 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -341,7 +341,6 @@ def configure(conf): conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False) conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False) - conf.check(header_name='unistd.h', define_name='HAVE_UNISTD_H',mandatory=False) have_sys_ioprio = conf.check_cc( msg="Checking for 'ioprio_set' syscall support", diff --git a/libs/backends/jack/jack_audiobackend.cc b/libs/backends/jack/jack_audiobackend.cc index 8f4f1f0a78..2a9a450a2c 100644 --- a/libs/backends/jack/jack_audiobackend.cc +++ b/libs/backends/jack/jack_audiobackend.cc @@ -846,7 +846,7 @@ JACKAudioBackend::join_process_threads () bool JACKAudioBackend::in_process_thread () { -#if defined COMPILER_MINGW && (!defined PTW32_VERSION || defined __jack_systemdeps_h__) +#if defined COMPILER_MINGW && (!defined __PTW32_VERSION || defined __jack_systemdeps_h__) if (_main_thread == GetCurrentThread()) { return true; } @@ -858,7 +858,7 @@ JACKAudioBackend::in_process_thread () for (auto & thread : _jack_threads) { -#if defined COMPILER_MINGW && (!defined PTW32_VERSION || defined __jack_systemdeps_h__) +#if defined COMPILER_MINGW && (!defined __PTW32_VERSION || defined __jack_systemdeps_h__) if (thread == GetCurrentThread()) { return true; } @@ -909,7 +909,7 @@ JACKAudioBackend::process_thread () /* JACK doesn't do this for us when we use the wait API */ -#if defined COMPILER_MINGW && (!defined PTW32_VERSION || defined __jack_systemdeps_h__) +#if defined COMPILER_MINGW && (!defined __PTW32_VERSION || defined __jack_systemdeps_h__) _main_thread = GetCurrentThread(); #else _main_thread = pthread_self (); diff --git a/libs/pbd/cpus.cc b/libs/pbd/cpus.cc index d43591ce30..1f7e8529aa 100644 --- a/libs/pbd/cpus.cc +++ b/libs/pbd/cpus.cc @@ -35,8 +35,8 @@ #include "pbd/cpus.h" -#if defined(COMPILER_MSVC) && !defined(PTW32_VERSION) -#include // Gets us 'PTW32_VERSION' +#if defined(COMPILER_MSVC) && !defined(__PTW32_VERSION) +#include // Gets us '__PTW32_VERSION' #endif int32_t @@ -69,7 +69,7 @@ PBD::hardware_concurrency() return c; } } -#if defined(PTW32_VERSION) || defined(__hpux) +#if defined(__PTW32_VERSION) || defined(__hpux) return pthread_num_processors_np(); #elif defined(__APPLE__) int count; diff --git a/libs/pbd/pbd/abstract_ui.h b/libs/pbd/pbd/abstract_ui.h index de119fc238..86c12f6fb1 100644 --- a/libs/pbd/pbd/abstract_ui.h +++ b/libs/pbd/pbd/abstract_ui.h @@ -73,7 +73,7 @@ protected: }; typedef typename RequestBuffer::rw_vector RequestBufferVector; -#if defined(COMPILER_MINGW) && defined(PTW32_VERSION) +#if defined(COMPILER_MINGW) && defined(__PTW32_VERSION) struct pthread_cmp { bool operator() (const ptw32_handle_t& thread1, const ptw32_handle_t& thread2) diff --git a/libs/pbd/pbd/abstract_ui.inc.cc b/libs/pbd/pbd/abstract_ui.inc.cc index f3f735c973..dbc0061060 100644 --- a/libs/pbd/pbd/abstract_ui.inc.cc +++ b/libs/pbd/pbd/abstract_ui.inc.cc @@ -21,7 +21,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include #include #include diff --git a/libs/pbd/pbd/debug.h b/libs/pbd/pbd/debug.h index 7efea83d11..de8058c5cd 100644 --- a/libs/pbd/pbd/debug.h +++ b/libs/pbd/pbd/debug.h @@ -29,7 +29,7 @@ #include "pbd/libpbd_visibility.h" #include "pbd/timing.h" -/* check for PTW32_VERSION */ +/* check for __PTW32_VERSION */ #ifdef COMPILER_MSVC #include #else @@ -83,7 +83,7 @@ namespace PBD { #define DEBUG_STR(id) __debug_str ## id #define DEBUG_STR_APPEND(id,s) __debug_str ## id << s; #define DEBUG_ENABLED(bits) (((bits) & PBD::debug_bits).any()) -#ifdef PTW32_VERSION +#ifdef __PTW32_VERSION #define DEBUG_THREAD_SELF pthread_self().p #define DEBUG_THREAD_PRINT(t) t.p #else diff --git a/libs/pbd/pbd/pthread_utils.h b/libs/pbd/pbd/pthread_utils.h index 4324cde9cc..cb9d8759fe 100644 --- a/libs/pbd/pbd/pthread_utils.h +++ b/libs/pbd/pbd/pthread_utils.h @@ -27,13 +27,13 @@ */ #ifndef PTHREAD_MACROS_DEFINED #define PTHREAD_MACROS_DEFINED -#ifdef PTW32_VERSION /* pthread_win32 */ +#ifdef __PTW32_VERSION /* pthread_win32 */ #define mark_pthread_inactive(threadID) threadID.p=0 #define is_pthread_active(threadID) (threadID.p!=0) #else /* normal pthread */ #define mark_pthread_inactive(threadID) threadID=0 #define is_pthread_active(threadID) threadID!=0 -#endif /* PTW32_VERSION */ +#endif /* __PTW32_VERSION */ #endif /* PTHREAD_MACROS_DEFINED */ #ifdef COMPILER_MSVC diff --git a/libs/pbd/pthread_utils.cc b/libs/pbd/pthread_utils.cc index d2d24f38c4..f219403ddb 100644 --- a/libs/pbd/pthread_utils.cc +++ b/libs/pbd/pthread_utils.cc @@ -237,7 +237,7 @@ pthread_set_name (const char* str) /* copy string and delete it when exiting */ thread_name.set (strdup (str)); // leaks -#if !defined PTW32_VERSION && defined _GNU_SOURCE +#if !defined __PTW32_VERSION && defined _GNU_SOURCE /* set public thread name, up to 16 chars */ char ptn[16]; memset (ptn, 0, 16); diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h index dd0e2b0e08..a9f32659ba 100644 --- a/libs/surfaces/mackie/surface.h +++ b/libs/surfaces/mackie/surface.h @@ -20,6 +20,7 @@ #ifndef mackie_surface_h #define mackie_surface_h +#include #include #include diff --git a/libs/zita-convolver/zita-convolver.cc b/libs/zita-convolver/zita-convolver.cc index 3b2473b854..f946638f3d 100644 --- a/libs/zita-convolver/zita-convolver.cc +++ b/libs/zita-convolver/zita-convolver.cc @@ -20,10 +20,11 @@ #include #include #include -#include #ifdef _MSC_VER -#include // Needed for MSVC 'Sleep()' +#include // Needed for MSVC 'Sleep()' +#else +#include // for usleep () #endif #include "zita-convolver/zita-convolver.h" @@ -432,7 +433,7 @@ Convlevel::Convlevel (void) , _npar (0) , _parsize (0) , _options (0) -#ifndef PTW32_VERSION +#ifndef __PTW32_VERSION , _pthr (0) #endif , _inp_list (0) @@ -607,7 +608,7 @@ Convlevel::start (int abspri, int policy) pthread_attr_t attr; struct sched_param parm; -#ifndef PTW32_VERSION +#ifndef __PTW32_VERSION _pthr = 0; #endif min = sched_get_priority_min (policy); @@ -685,7 +686,7 @@ void* Convlevel::static_main (void* arg) { ((Convlevel*)arg)->main (); -#if !defined PTW32_VERSION && defined _GNU_SOURCE +#if !defined __PTW32_VERSION && defined _GNU_SOURCE pthread_setname_np (pthread_self(), "ZConvlevel"); #endif return 0; @@ -699,7 +700,7 @@ Convlevel::main (void) _trig.wait (); if (_stat == ST_TERM) { _stat = ST_IDLE; -#ifndef PTW32_VERSION +#ifndef __PTW32_VERSION _pthr = 0; #endif return; diff --git a/libs/zita-convolver/zita-convolver/zita-convolver.h b/libs/zita-convolver/zita-convolver/zita-convolver.h index 1b0e6ca3f9..4966872e09 100644 --- a/libs/zita-convolver/zita-convolver/zita-convolver.h +++ b/libs/zita-convolver/zita-convolver/zita-convolver.h @@ -27,7 +27,7 @@ #include "zita-convolver/zconvolver_visibility.h" -#if defined(__linux__) || defined(__GNU__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(PTW32_VERSION) || defined(__WINPTHREADS_VERSION) +#if defined(__linux__) || defined(__GNU__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__PTW32_VERSION) || defined(__WINPTHREADS_VERSION) #include #endif @@ -38,7 +38,7 @@ namespace ArdourZita { #endif /* note: mingw and msvc actually use PTW32's implementation of semaphores */ -#if defined(__linux__) || defined(__GNU__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(PTW32_VERSION) || defined (__WINPTHREADS_VERSION) +#if defined(__linux__) || defined(__GNU__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__PTW32_VERSION) || defined (__WINPTHREADS_VERSION) class LIBZCONVOLVER_API ZCsema { diff --git a/msvc_extra_headers/ardourext/ptw32/pthread.h.input b/msvc_extra_headers/ardourext/ptw32/pthread.h.input index 3ac3e174f8..3232d4e257 100644 --- a/msvc_extra_headers/ardourext/ptw32/pthread.h.input +++ b/msvc_extra_headers/ardourext/ptw32/pthread.h.input @@ -42,8 +42,8 @@ * See the README file for an explanation of the pthreads-win32 version * numbering scheme and how the DLL is named etc. */ -#define PTW32_VERSION 2,9,1,0 -#define PTW32_VERSION_STRING "2, 9, 1, 0\0" +#define __PTW32_VERSION 2,9,1,0 +#define __PTW32_VERSION_STRING "2, 9, 1, 0\0" /* There are three implementations of cancel cleanup. * Note that pthread.h is included in both application