From 337e010345fa98f7b5425ef5cbf31e0ed582c678 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 1 Nov 2011 23:19:03 +0000 Subject: Allocate some thread-local buffers for the GUI thread so that the PluginEqGui impulse analysis can use them (fixes #4418). git-svn-id: svn://localhost/ardour2/branches/3.0@10387 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui.cc | 17 +++++++++++++++++ gtk2_ardour/ardour_ui.h | 9 +++++++++ gtk2_ardour/plugin_eq_gui.cc | 5 +++++ libs/ardour/globals.cc | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) 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(); -- cgit v1.2.3