summaryrefslogtreecommitdiff
path: root/libs/ardour/globals.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2013-07-25 21:38:59 +1000
committerTim Mayberry <mojofunk@gmail.com>2013-08-13 20:15:47 +1000
commit9d340af10da0bdb4e20681918dac6dde987c8e5e (patch)
tree746269f28ddc480c567da7ff98c8712da967389f /libs/ardour/globals.cc
parentd51eba1162c072760a38d00bb39ee21749d87abb (diff)
Prevent libardour from being initialized more than once
This is not thread safe of course, it is not intended to be. This was implemented as at one stage ARDOUR::init was being called multiple times in the testsuite which was causing a subtle bug that took some time to track down.
Diffstat (limited to 'libs/ardour/globals.cc')
-rw-r--r--libs/ardour/globals.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 5e3553ad8a..78994c4101 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -107,6 +107,8 @@ using namespace ARDOUR;
using namespace std;
using namespace PBD;
+bool libardour_initialized = false;
+
compute_peak_t ARDOUR::compute_peak = 0;
find_peaks_t ARDOUR::find_peaks = 0;
apply_gain_to_buffer_t ARDOUR::apply_gain_to_buffer = 0;
@@ -218,6 +220,10 @@ lotsa_files_please ()
bool
ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir)
{
+ if (libardour_initialized) {
+ return true;
+ }
+
if (!Glib::thread_supported()) {
Glib::thread_init();
}
@@ -331,6 +337,8 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir
EventTypeMap::instance().new_parameter(EnvelopeAutomation);
EventTypeMap::instance().new_parameter(MidiCCAutomation);
+ libardour_initialized = true;
+
return true;
}