From a24d5c8c81544f6bf20c7f59af0b92b075168a58 Mon Sep 17 00:00:00 2001 From: xenakios Date: Fri, 5 Jan 2018 17:49:54 +0200 Subject: [PATCH] Make callGUI more generic and move it to globals.h. Readme change. --- Source/PS_Source/globals.h | 13 +++++++++++++ Source/PluginProcessor.cpp | 13 ------------- Source/PluginProcessor.h | 4 +++- readme.txt | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Source/PS_Source/globals.h b/Source/PS_Source/globals.h index 32480b2..258a5d7 100644 --- a/Source/PS_Source/globals.h +++ b/Source/PS_Source/globals.h @@ -193,3 +193,16 @@ inline void fill_container(Cont& c, const T& x) { std::fill(std::begin(c), std::end(c), x); } + +template +inline void callGUI(T* ap, F&& f, bool async) +{ + auto ed = dynamic_cast(ap->getActiveEditor()); + if (ed) + { + if (async == false) + f(ed); + else + MessageManager::callAsync([ed, f]() { f(ed); }); + } +} diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 7829c0b..648350a 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -48,19 +48,6 @@ static const PresetEntry g_presets[g_num_presets] = {"Dark noise","cGF1bHN0cmV0Y2gzcGx1Z2luc3RhdGUAASNtYWludm9sdW1lMAABCQQAAACAi1cewHN0cmV0Y2hhbW91bnQwAAEJBAAAAGAAACBAZmZ0c2l6ZTAAAQkEAAAAwMzM7D9waXRjaHNoaWZ0MAABCQQAAAAAAAAAAGZyZXFzaGlmdDAAAQkEAAAAAAAAAABwbGF5cmFuZ2Vfc3RhcnQwAAEJBAAAAAAAAAAAcGxheXJhbmdlX2VuZDAAAQkEAAAAAAAA8D9zcHJlYWQwAAEJBAAAAAAAAPA/Y29tcHJlc3MwAAEJBAAAAKAONdg/bG9vcHhmYWRlbGVuMAABCQQAAABA4XqEP251bWhhcm1vbmljczAAAQkEAAAAAABAWUBoYXJtb25pY3NmcmVxMAABCQQAAAAAAABgQGhhcm1vbmljc2J3MAABCQQAAAAAAAA5QG9jdGF2ZW1peG0yXzAAAQkEAAAAAAAAAABvY3RhdmVtaXhtMV8wAAEJBAAAAAAAAAAAb2N0YXZlbWl4MF8wAAEJBAAAAAAAAPA/b2N0YXZlbWl4MV8wAAEJBAAAAAAAAAAAb2N0YXZlbWl4MTVfMAABCQQAAAAAAAAAAG9jdGF2ZW1peDJfMAABCQQAAAAAAAAAAHRvbmFsdnNub2lzZWJ3XzAAAQkEAAAAgBSu5z90b25hbHZzbm9pc2VwcmVzZXJ2ZV8wAAEJBAAAAAAAAOA/ZmlsdGVyX2xvd18wAAEJBAAAAAAAADRAZmlsdGVyX2hpZ2hfMAABCQQAAABgAHCXQG9uc2V0ZGV0ZWN0XzAAAQkEAAAAAAAAAABtYXhjYXB0dXJlbGVuXzAAAQkEAAAAAAAAJEBudW1vdXRjaGFuczAAAQUBAgAAAG51bXNwZWN0cmFsc3RhZ2VzAAEFAQgAAABzcGVjb3JkZXIwAAEFAQMAAABzcGVjb3JkZXIxAAEFAQAAAABzcGVjb3JkZXIyAAEFAQEAAABzcGVjb3JkZXIzAAEFAQIAAABzcGVjb3JkZXI0AAEFAQQAAABzcGVjb3JkZXI1AAEFAQUAAABzcGVjb3JkZXI2AAEFAQYAAABzcGVjb3JkZXI3AAEFAQcAAAAAzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N"} }; -template -void callGUI(AudioProcessor* ap, F&& f, bool async) -{ - auto ed = dynamic_cast(ap->getActiveEditor()); - if (ed) - { - if (async == false) - f(ed); - else - MessageManager::callAsync([ed,f]() { f(ed); }); - } -} - int get_optimized_updown(int n, bool up) { int orig_n = n; while (true) { diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 139c649..3df21ef 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -80,11 +80,13 @@ public: std::unique_ptr m_props_file; }; +class PaulstretchpluginAudioProcessorEditor; + class PaulstretchpluginAudioProcessor : public AudioProcessor, public MultiTimer { public: - + using EditorType = PaulstretchpluginAudioProcessorEditor; PaulstretchpluginAudioProcessor(); ~PaulstretchpluginAudioProcessor(); diff --git a/readme.txt b/readme.txt index e03fe7d..05828c8 100644 --- a/readme.txt +++ b/readme.txt @@ -37,7 +37,7 @@ History : -Slightly better GUI layout but still mostly just 2 columns of sliders -Remember last file import folder -Added detection of invalid audio output sample values (infinities, NaN) -01-04-2018 1.0.0 preview 4 +01-05-2018 1.0.0 preview 4 -Added reset parameters (except main volume and input pass through) command to settings menu -Added option to settings menu to ignore loading imported audio file when recalling state -Added support for dropping audio files to GUI