diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 7319be632e..cc173c80e3 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -78,6 +78,7 @@ #include "ardour/midi_track.h" #include "ardour/filesystem_paths.h" #include "ardour/filename_extensions.h" +#include "ardour/process_thread.h" typedef uint64_t microseconds_t; @@ -332,6 +333,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) starting.connect (sigc::mem_fun(*this, &ARDOUR_UI::startup)); stopping.connect (sigc::mem_fun(*this, &ARDOUR_UI::shutdown)); + _process_thread = new ProcessThread (); + _process_thread->init (); } /** @return true if a session was chosen and `apply' clicked, otherwise false if `cancel' was clicked */ @@ -3851,3 +3854,17 @@ ARDOUR_UI::ambiguous_file (std::string file, std::string /*path*/, std::vectorget_buffers (); +} + +/** Drop our thread-local buffers */ +void +ARDOUR_UI::drop_process_buffers () +{ + _process_thread->drop_buffers (); +} diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 025039156e..c6dc7ba0b0 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -105,6 +105,7 @@ namespace ARDOUR { class Route; class RouteGroup; class Location; + class ProcessThread; } class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr @@ -266,6 +267,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void add_window_proxy (WindowProxyBase *); void remove_window_proxy (WindowProxyBase *); + void get_process_buffers (); + void drop_process_buffers (); + protected: friend class PublicEditor; @@ -724,6 +728,11 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr bool click_button_clicked (GdkEventButton *); VisibilityGroup _status_bar_visibility; + + /** A ProcessThread so that we have some thread-local buffers for use by + * PluginEqGui::impulse_analysis (). + */ + ARDOUR::ProcessThread* _process_thread; }; #endif /* __ardour_gui_h__ */ diff --git a/gtk2_ardour/plugin_eq_gui.cc b/gtk2_ardour/plugin_eq_gui.cc index 254f57a243..bab2119f69 100644 --- a/gtk2_ardour/plugin_eq_gui.cc +++ b/gtk2_ardour/plugin_eq_gui.cc @@ -317,6 +317,9 @@ PluginEqGui::signal_collect_callback(ARDOUR::BufferSet *in, ARDOUR::BufferSet *o void PluginEqGui::run_impulse_analysis() { + /* Allocate some thread-local buffers so that Plugin::connect_and_run can use them */ + ARDOUR_UI::instance()->get_process_buffers (); + uint32_t inputs = _plugin->get_info()->n_inputs.n_audio(); uint32_t outputs = _plugin->get_info()->n_outputs.n_audio(); @@ -406,6 +409,8 @@ PluginEqGui::run_impulse_analysis() // This signals calls expose_analysis_area() _analysis_area->queue_draw(); + + ARDOUR_UI::instance()->drop_process_buffers (); } bool diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 7c713980c3..0a4ec4cab3 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -337,7 +337,7 @@ ARDOUR::init (bool use_vst, bool try_optimization) new PluginManager (); ProcessThread::init (); - BufferManager::init (10); // XX should be num_processors_for_dsp + BufferManager::init (10); // XX should be num_processors_for_dsp + 1 for the GUI thread PannerManager::instance().discover_panners();