Make callGUI more generic and move it to globals.h. Readme change.

This commit is contained in:
xenakios 2018-01-05 17:49:54 +02:00
parent 04a6fc33cc
commit a24d5c8c81
4 changed files with 17 additions and 15 deletions

View File

@ -193,3 +193,16 @@ inline void fill_container(Cont& c, const T& x)
{
std::fill(std::begin(c), std::end(c), x);
}
template<typename T, typename F>
inline void callGUI(T* ap, F&& f, bool async)
{
auto ed = dynamic_cast<typename T::EditorType*>(ap->getActiveEditor());
if (ed)
{
if (async == false)
f(ed);
else
MessageManager::callAsync([ed, f]() { f(ed); });
}
}

View File

@ -48,19 +48,6 @@ static const PresetEntry g_presets[g_num_presets] =
{"Dark noise","cGF1bHN0cmV0Y2gzcGx1Z2luc3RhdGUAASNtYWludm9sdW1lMAABCQQAAACAi1cewHN0cmV0Y2hhbW91bnQwAAEJBAAAAGAAACBAZmZ0c2l6ZTAAAQkEAAAAwMzM7D9waXRjaHNoaWZ0MAABCQQAAAAAAAAAAGZyZXFzaGlmdDAAAQkEAAAAAAAAAABwbGF5cmFuZ2Vfc3RhcnQwAAEJBAAAAAAAAAAAcGxheXJhbmdlX2VuZDAAAQkEAAAAAAAA8D9zcHJlYWQwAAEJBAAAAAAAAPA/Y29tcHJlc3MwAAEJBAAAAKAONdg/bG9vcHhmYWRlbGVuMAABCQQAAABA4XqEP251bWhhcm1vbmljczAAAQkEAAAAAABAWUBoYXJtb25pY3NmcmVxMAABCQQAAAAAAABgQGhhcm1vbmljc2J3MAABCQQAAAAAAAA5QG9jdGF2ZW1peG0yXzAAAQkEAAAAAAAAAABvY3RhdmVtaXhtMV8wAAEJBAAAAAAAAAAAb2N0YXZlbWl4MF8wAAEJBAAAAAAAAPA/b2N0YXZlbWl4MV8wAAEJBAAAAAAAAAAAb2N0YXZlbWl4MTVfMAABCQQAAAAAAAAAAG9jdGF2ZW1peDJfMAABCQQAAAAAAAAAAHRvbmFsdnNub2lzZWJ3XzAAAQkEAAAAgBSu5z90b25hbHZzbm9pc2VwcmVzZXJ2ZV8wAAEJBAAAAAAAAOA/ZmlsdGVyX2xvd18wAAEJBAAAAAAAADRAZmlsdGVyX2hpZ2hfMAABCQQAAABgAHCXQG9uc2V0ZGV0ZWN0XzAAAQkEAAAAAAAAAABtYXhjYXB0dXJlbGVuXzAAAQkEAAAAAAAAJEBudW1vdXRjaGFuczAAAQUBAgAAAG51bXNwZWN0cmFsc3RhZ2VzAAEFAQgAAABzcGVjb3JkZXIwAAEFAQMAAABzcGVjb3JkZXIxAAEFAQAAAABzcGVjb3JkZXIyAAEFAQEAAABzcGVjb3JkZXIzAAEFAQIAAABzcGVjb3JkZXI0AAEFAQQAAABzcGVjb3JkZXI1AAEFAQUAAABzcGVjb3JkZXI2AAEFAQYAAABzcGVjb3JkZXI3AAEFAQcAAAAAzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N"}
};
template<typename F>
void callGUI(AudioProcessor* ap, F&& f, bool async)
{
auto ed = dynamic_cast<PaulstretchpluginAudioProcessorEditor*>(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) {

View File

@ -80,11 +80,13 @@ public:
std::unique_ptr<PropertiesFile> m_props_file;
};
class PaulstretchpluginAudioProcessorEditor;
class PaulstretchpluginAudioProcessor : public AudioProcessor,
public MultiTimer
{
public:
using EditorType = PaulstretchpluginAudioProcessorEditor;
PaulstretchpluginAudioProcessor();
~PaulstretchpluginAudioProcessor();

View File

@ -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