diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-11-24 12:29:25 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-11-24 12:29:25 +0100 |
commit | cf2311b09f788447d1c079274405477992eee9e8 (patch) | |
tree | 2e1e2621f84f525d704d822ce1382280227fcdc6 /pluginlv2.h | |
parent | f7b23621bd749412407dab214083a6c4c70dfbb1 (diff) |
Make midnam threadsafe.
Diffstat (limited to 'pluginlv2.h')
-rw-r--r-- | pluginlv2.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pluginlv2.h b/pluginlv2.h index 43563cc..2ff2226 100644 --- a/pluginlv2.h +++ b/pluginlv2.h @@ -29,6 +29,7 @@ #include <plugin.h> #include <array> +#include <atomic> #include <lv2/lv2plug.in/ns/lv2core/lv2.h> #include <lv2/lv2plug.in/ns/ext/urid/urid.h> @@ -62,7 +63,7 @@ public: virtual ~PluginLV2() = default; //! Not used in LV2 - void init() override {} + void init() override; //! Get current free-wheel mode. bool getFreeWheel() const override; @@ -271,9 +272,8 @@ private: static char* MidnamModel (LV2_Handle instance); static void MidnamFree (char*); #endif - // TODO:: Make this list thread safe! - std::array<std::pair<int, std::string>, 127> midnamData; - volatile bool midnam_changed{false}; + std::atomic<bool> midnam_changed{false}; + std::array<std::pair<int, std::string>, 127> midnamData; // At most 127 different midinotes. bool active{false}; |