Use global lock to prevent concurrent FFT plan calls
Depending on fftw version, compile-flags and availability of `fftwf_make_planner_thread_safe` fftw_plan_* may not be called concurrently (fftw internally uses a static cache).
This commit is contained in:
@@ -58,6 +58,8 @@ namespace ARDOUR {
|
||||
extern LIBARDOUR_API std::map<std::string, bool> reserved_io_names;
|
||||
extern LIBARDOUR_API float ui_scale_factor;
|
||||
|
||||
extern LIBARDOUR_API Glib::Threads::Mutex fft_planner_lock;
|
||||
|
||||
/**
|
||||
* @param try_optimization true to enable hardware optimized routines
|
||||
* for mixing, finding peak values etc.
|
||||
|
||||
@@ -313,7 +313,6 @@ namespace ARDOUR { namespace DSP {
|
||||
}
|
||||
|
||||
private:
|
||||
static Glib::Threads::Mutex fft_planner_lock;
|
||||
float* hann_window;
|
||||
|
||||
void init (uint32_t window_size, double rate);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <cmath>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ardour/ardour.h"
|
||||
#include "ardour/buffer.h"
|
||||
#include "ardour/dB.h"
|
||||
#include "ardour/dsp_filter.h"
|
||||
@@ -471,8 +472,6 @@ Biquad::dB_at_freq (float freq) const
|
||||
return std::min (120.f, std::max (-120.f, rv));
|
||||
}
|
||||
|
||||
Glib::Threads::Mutex FFTSpectrum::fft_planner_lock;
|
||||
|
||||
FFTSpectrum::FFTSpectrum (uint32_t window_size, double rate)
|
||||
: hann_window (0)
|
||||
{
|
||||
@@ -482,7 +481,7 @@ FFTSpectrum::FFTSpectrum (uint32_t window_size, double rate)
|
||||
FFTSpectrum::~FFTSpectrum ()
|
||||
{
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lk (fft_planner_lock);
|
||||
Glib::Threads::Mutex::Lock lk (ARDOUR::fft_planner_lock);
|
||||
fftwf_destroy_plan (_fftplan);
|
||||
}
|
||||
fftwf_free (_fft_data_in);
|
||||
@@ -495,7 +494,7 @@ void
|
||||
FFTSpectrum::init (uint32_t window_size, double rate)
|
||||
{
|
||||
assert (window_size > 0);
|
||||
Glib::Threads::Mutex::Lock lk (fft_planner_lock);
|
||||
Glib::Threads::Mutex::Lock lk (ARDOUR::fft_planner_lock);
|
||||
|
||||
_fft_window_size = window_size;
|
||||
_fft_data_size = window_size / 2;
|
||||
|
||||
@@ -168,6 +168,8 @@ std::map<std::string, bool> ARDOUR::reserved_io_names;
|
||||
|
||||
float ARDOUR::ui_scale_factor = 1.0;
|
||||
|
||||
Glib::Threads::Mutex ARDOUR::fft_planner_lock;
|
||||
|
||||
static bool have_old_configuration_files = false;
|
||||
static bool running_from_gui = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user