From 0b17f9e2ca7947b5a9d98218d0f1ded0189042c1 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Fri, 22 Feb 2019 06:26:12 -0500 Subject: [PATCH] Move App from rack::app:: to rack::. Remove ambiguous operator overloads in simd.hpp. Include simd.hpp in rack.hpp. --- include/app.hpp | 18 +++++++----------- include/app/common.hpp | 4 ++++ include/dsp/simd.hpp | 12 ------------ include/rack.hpp | 1 + src/app.cpp | 26 ++++++++++++-------------- src/app/ParamWidget.cpp | 12 ------------ src/main.cpp | 4 ++-- 7 files changed, 26 insertions(+), 51 deletions(-) diff --git a/include/app.hpp b/include/app.hpp index 52634e6e..e315cc0a 100644 --- a/include/app.hpp +++ b/include/app.hpp @@ -3,7 +3,7 @@ /** Accesses the global App pointer */ -#define APP rack::app::get() +#define APP rack::appGet() namespace rack { @@ -28,18 +28,15 @@ struct Window; struct PatchManager; -/** Rack-specific GUI widgets and functions that control and offer feedback for the rack state. -*/ namespace app { - - -struct Scene; + struct Scene; +} // namespace app /** Contains the application state */ struct App { event::State *event = NULL; - Scene *scene = NULL; + app::Scene *scene = NULL; engine::Engine *engine = NULL; Window *window = NULL; history::State *history = NULL; @@ -50,11 +47,10 @@ struct App { }; -void init(bool headless); -void destroy(); +void appInit(bool headless); +void appDestroy(); /** Returns the global App pointer */ -App *get(); +App *appGet(); -} // namespace app } // namespace rack diff --git a/include/app/common.hpp b/include/app/common.hpp index 9d6193dd..c76083ab 100644 --- a/include/app/common.hpp +++ b/include/app/common.hpp @@ -5,6 +5,10 @@ namespace rack { + + +/** Rack-specific GUI widgets and functions that control and offer feedback for the rack state. +*/ namespace app { diff --git a/include/dsp/simd.hpp b/include/dsp/simd.hpp index 5661475a..1f712828 100644 --- a/include/dsp/simd.hpp +++ b/include/dsp/simd.hpp @@ -90,14 +90,6 @@ typedef f32<4> f32_4; #define DECLARE_F32_4_OPERATOR_INFIX(operator, func) \ inline f32_4 operator(const f32_4 &a, const f32_4 &b) { \ return f32_4(func(a.v, b.v)); \ - } \ - template \ - f32_4 operator(const T &a, const f32_4 &b) { \ - return operator(f32_4(a), b); \ - } \ - template \ - f32_4 operator(const f32_4 &a, const T &b) { \ - return operator(a, f32_4(b)); \ } /** `a @= b` */ @@ -105,10 +97,6 @@ typedef f32<4> f32_4; inline f32_4 &operator(f32_4 &a, const f32_4 &b) { \ a = opfunc(a, b); \ return a; \ - } \ - template \ - f32_4 &operator(f32_4 &a, const T &b) { \ - return operator(a, f32_4(b)); \ } DECLARE_F32_4_OPERATOR_INFIX(operator+, _mm_add_ps) diff --git a/include/rack.hpp b/include/rack.hpp index 8d134873..f6a5f8ac 100644 --- a/include/rack.hpp +++ b/include/rack.hpp @@ -80,6 +80,7 @@ #include "plugin/callbacks.hpp" #include "dsp/common.hpp" +#include "dsp/simd.hpp" #include "dsp/digital.hpp" #include "dsp/fft.hpp" #include "dsp/filter.hpp" diff --git a/src/app.cpp b/src/app.cpp index 1b595b57..511a6515 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -8,7 +8,6 @@ namespace rack { -namespace app { void App::init(bool headless) { @@ -18,7 +17,7 @@ void App::init(bool headless) { history = new history::State; window = new Window; patch = new PatchManager; - scene = new Scene; + scene = new app::Scene; event->rootWidget = scene; } } @@ -40,24 +39,23 @@ App::~App() { } -static App *app = NULL; +static App *appInstance = NULL; -void init(bool headless) { - assert(!app); - app = new App; - app->init(headless); +void appInit(bool headless) { + assert(!appInstance); + appInstance = new App; + appInstance->init(headless); } -void destroy() { - assert(app); - delete app; - app = NULL; +void appDestroy() { + assert(appInstance); + delete appInstance; + appInstance = NULL; } -App *get() { - return app; +App *appGet() { + return appInstance; } -} // namespace app } // namespace rack diff --git a/src/app/ParamWidget.cpp b/src/app/ParamWidget.cpp index a6546919..4a2584b2 100644 --- a/src/app/ParamWidget.cpp +++ b/src/app/ParamWidget.cpp @@ -132,18 +132,6 @@ void ParamWidget::step() { void ParamWidget::draw(const DrawArgs &args) { Widget::draw(args); - // if (paramQuantity) { - // nvgBeginPath(args.vg); - // nvgRect(args.vg, - // box.size.x - 12, box.size.y - 12, - // 12, 12); - // nvgFillColor(args.vg, nvgRGBAf(1, 0, 1, 0.9)); - // nvgFill(args.vg); - - // std::string mapText = string::f("%d", paramQuantity->paramId); - // bndLabel(args.vg, box.size.x - 17.0, box.size.y - 16.0, INFINITY, INFINITY, -1, mapText.c_str()); - // } - // Param map indicator engine::ParamHandle *paramHandle = paramQuantity ? APP->engine->getParamHandle(paramQuantity->module, paramQuantity->paramId) : NULL; if (paramHandle) { diff --git a/src/main.cpp b/src/main.cpp index 39a2c41a..09bc61f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) { // Initialize app INFO("Initializing app"); settings.load(asset::user("settings.json")); - app::init(headless); + appInit(headless); if (!headless) { APP->scene->devMode = devMode; APP->patch->init(patchPath); @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) { APP->patch->save(asset::user("autosave.vcv")); } INFO("Destroying app"); - app::destroy(); + appDestroy(); settings.save(asset::user("settings.json")); // Destroy environment