| @@ -3,7 +3,7 @@ | |||||
| /** Accesses the global App pointer */ | /** Accesses the global App pointer */ | ||||
| #define APP rack::app::get() | |||||
| #define APP rack::appGet() | |||||
| namespace rack { | namespace rack { | ||||
| @@ -28,18 +28,15 @@ struct Window; | |||||
| struct PatchManager; | struct PatchManager; | ||||
| /** Rack-specific GUI widgets and functions that control and offer feedback for the rack state. | |||||
| */ | |||||
| namespace app { | namespace app { | ||||
| struct Scene; | |||||
| struct Scene; | |||||
| } // namespace app | |||||
| /** Contains the application state */ | /** Contains the application state */ | ||||
| struct App { | struct App { | ||||
| event::State *event = NULL; | event::State *event = NULL; | ||||
| Scene *scene = NULL; | |||||
| app::Scene *scene = NULL; | |||||
| engine::Engine *engine = NULL; | engine::Engine *engine = NULL; | ||||
| Window *window = NULL; | Window *window = NULL; | ||||
| history::State *history = 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 */ | /** Returns the global App pointer */ | ||||
| App *get(); | |||||
| App *appGet(); | |||||
| } // namespace app | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -5,6 +5,10 @@ | |||||
| namespace rack { | namespace rack { | ||||
| /** Rack-specific GUI widgets and functions that control and offer feedback for the rack state. | |||||
| */ | |||||
| namespace app { | namespace app { | ||||
| @@ -90,14 +90,6 @@ typedef f32<4> f32_4; | |||||
| #define DECLARE_F32_4_OPERATOR_INFIX(operator, func) \ | #define DECLARE_F32_4_OPERATOR_INFIX(operator, func) \ | ||||
| inline f32_4 operator(const f32_4 &a, const f32_4 &b) { \ | inline f32_4 operator(const f32_4 &a, const f32_4 &b) { \ | ||||
| return f32_4(func(a.v, b.v)); \ | return f32_4(func(a.v, b.v)); \ | ||||
| } \ | |||||
| template <typename T> \ | |||||
| f32_4 operator(const T &a, const f32_4 &b) { \ | |||||
| return operator(f32_4(a), b); \ | |||||
| } \ | |||||
| template <typename T> \ | |||||
| f32_4 operator(const f32_4 &a, const T &b) { \ | |||||
| return operator(a, f32_4(b)); \ | |||||
| } | } | ||||
| /** `a @= b` */ | /** `a @= b` */ | ||||
| @@ -105,10 +97,6 @@ typedef f32<4> f32_4; | |||||
| inline f32_4 &operator(f32_4 &a, const f32_4 &b) { \ | inline f32_4 &operator(f32_4 &a, const f32_4 &b) { \ | ||||
| a = opfunc(a, b); \ | a = opfunc(a, b); \ | ||||
| return a; \ | return a; \ | ||||
| } \ | |||||
| template <typename T> \ | |||||
| f32_4 &operator(f32_4 &a, const T &b) { \ | |||||
| return operator(a, f32_4(b)); \ | |||||
| } | } | ||||
| DECLARE_F32_4_OPERATOR_INFIX(operator+, _mm_add_ps) | DECLARE_F32_4_OPERATOR_INFIX(operator+, _mm_add_ps) | ||||
| @@ -80,6 +80,7 @@ | |||||
| #include "plugin/callbacks.hpp" | #include "plugin/callbacks.hpp" | ||||
| #include "dsp/common.hpp" | #include "dsp/common.hpp" | ||||
| #include "dsp/simd.hpp" | |||||
| #include "dsp/digital.hpp" | #include "dsp/digital.hpp" | ||||
| #include "dsp/fft.hpp" | #include "dsp/fft.hpp" | ||||
| #include "dsp/filter.hpp" | #include "dsp/filter.hpp" | ||||
| @@ -8,7 +8,6 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace app { | |||||
| void App::init(bool headless) { | void App::init(bool headless) { | ||||
| @@ -18,7 +17,7 @@ void App::init(bool headless) { | |||||
| history = new history::State; | history = new history::State; | ||||
| window = new Window; | window = new Window; | ||||
| patch = new PatchManager; | patch = new PatchManager; | ||||
| scene = new Scene; | |||||
| scene = new app::Scene; | |||||
| event->rootWidget = 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 | } // namespace rack | ||||
| @@ -132,18 +132,6 @@ void ParamWidget::step() { | |||||
| void ParamWidget::draw(const DrawArgs &args) { | void ParamWidget::draw(const DrawArgs &args) { | ||||
| Widget::draw(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 | // Param map indicator | ||||
| engine::ParamHandle *paramHandle = paramQuantity ? APP->engine->getParamHandle(paramQuantity->module, paramQuantity->paramId) : NULL; | engine::ParamHandle *paramHandle = paramQuantity ? APP->engine->getParamHandle(paramQuantity->module, paramQuantity->paramId) : NULL; | ||||
| if (paramHandle) { | if (paramHandle) { | ||||
| @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) { | |||||
| // Initialize app | // Initialize app | ||||
| INFO("Initializing app"); | INFO("Initializing app"); | ||||
| settings.load(asset::user("settings.json")); | settings.load(asset::user("settings.json")); | ||||
| app::init(headless); | |||||
| appInit(headless); | |||||
| if (!headless) { | if (!headless) { | ||||
| APP->scene->devMode = devMode; | APP->scene->devMode = devMode; | ||||
| APP->patch->init(patchPath); | APP->patch->init(patchPath); | ||||
| @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) { | |||||
| APP->patch->save(asset::user("autosave.vcv")); | APP->patch->save(asset::user("autosave.vcv")); | ||||
| } | } | ||||
| INFO("Destroying app"); | INFO("Destroying app"); | ||||
| app::destroy(); | |||||
| appDestroy(); | |||||
| settings.save(asset::user("settings.json")); | settings.save(asset::user("settings.json")); | ||||
| // Destroy environment | // Destroy environment | ||||