Browse Source

Create `engine::` namespace

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
64602576b0
24 changed files with 60 additions and 28 deletions
  1. +9
    -4
      include/app.hpp
  2. +1
    -1
      include/app/CableWidget.hpp
  3. +1
    -1
      include/app/ModuleLightWidget.hpp
  4. +3
    -3
      include/app/ModuleWidget.hpp
  5. +2
    -2
      include/app/ParamQuantity.hpp
  6. +1
    -1
      include/app/PortWidget.hpp
  7. +2
    -0
      include/engine/Cable.hpp
  8. +2
    -0
      include/engine/Engine.hpp
  9. +2
    -0
      include/engine/Light.hpp
  10. +2
    -0
      include/engine/Module.hpp
  11. +4
    -0
      include/engine/Param.hpp
  12. +2
    -0
      include/engine/Port.hpp
  13. +10
    -10
      include/helpers.hpp
  14. +4
    -2
      include/plugin/Model.hpp
  15. +1
    -0
      include/rack.hpp
  16. +1
    -1
      src/app.cpp
  17. +1
    -1
      src/app/CableWidget.cpp
  18. +1
    -1
      src/app/ModuleWidget.cpp
  19. +1
    -1
      src/app/ParamQuantity.cpp
  20. +2
    -0
      src/engine/Cable.cpp
  21. +2
    -0
      src/engine/Engine.cpp
  22. +2
    -0
      src/engine/Module.cpp
  23. +2
    -0
      src/engine/Param.cpp
  24. +2
    -0
      src/engine/Port.cpp

+ 9
- 4
include/app.hpp View File

@@ -11,14 +11,19 @@ namespace rack {

namespace event {
struct State;
}
} // namespace event


namespace history {
struct State;
}
} // namespace history


namespace engine {
struct Engine;
} // namespace engine


struct Engine;
struct Window;
struct PatchManager;

@@ -33,7 +38,7 @@ struct Scene;
struct App {
event::State *event = NULL;
Scene *scene = NULL;
Engine *engine = NULL;
engine::Engine *engine = NULL;
Window *window = NULL;
history::State *history = NULL;
PatchManager *patch = NULL;


+ 1
- 1
include/app/CableWidget.hpp View File

@@ -16,7 +16,7 @@ struct CableWidget : widget::OpaqueWidget {
PortWidget *inputPort = NULL;
PortWidget *hoveredOutputPort = NULL;
PortWidget *hoveredInputPort = NULL;
Cable *cable;
engine::Cable *cable;
NVGcolor color;

CableWidget();


+ 1
- 1
include/app/ModuleLightWidget.hpp View File

@@ -12,7 +12,7 @@ namespace app {
Will access firstLightId, firstLightId + 1, etc. for each added color
*/
struct ModuleLightWidget : MultiLightWidget {
Module *module = NULL;
engine::Module *module = NULL;
int firstLightId;
void step() override;
};


+ 3
- 3
include/app/ModuleWidget.hpp View File

@@ -15,7 +15,7 @@ namespace app {
struct ModuleWidget : widget::OpaqueWidget {
plugin::Model *model = NULL;
/** Owns the module pointer */
Module *module = NULL;
engine::Module *module = NULL;

widget::Widget *panel = NULL;
std::vector<ParamWidget*> params;
@@ -26,7 +26,7 @@ struct ModuleWidget : widget::OpaqueWidget {
math::Vec oldPos;

ModuleWidget() {}
DEPRECATED ModuleWidget(Module *module) {
DEPRECATED ModuleWidget(engine::Module *module) {
setModule(module);
}
~ModuleWidget();
@@ -44,7 +44,7 @@ struct ModuleWidget : widget::OpaqueWidget {
/** Associates this ModuleWidget with the Module
Transfers ownership
*/
void setModule(Module *module);
void setModule(engine::Module *module);
void setPanel(std::shared_ptr<SVG> svg);

/** Convenience functions for adding special widgets (calls addChild()) */


+ 2
- 2
include/app/ParamQuantity.hpp View File

@@ -10,10 +10,10 @@ namespace app {

/** A ui::Quantity that wraps an engine Param */
struct ParamQuantity : ui::Quantity {
Module *module = NULL;
engine::Module *module = NULL;
int paramId = 0;

Param *getParam();
engine::Param *getParam();
/** Request to the engine to smoothly set the value */
void setSmoothValue(float smoothValue);
float getSmoothValue();


+ 1
- 1
include/app/PortWidget.hpp View File

@@ -10,7 +10,7 @@ namespace app {


struct PortWidget : widget::OpaqueWidget {
Module *module = NULL;
engine::Module *module = NULL;
int portId;

enum Type {


+ 2
- 0
include/engine/Cable.hpp View File

@@ -4,6 +4,7 @@


namespace rack {
namespace engine {


struct Cable {
@@ -16,4 +17,5 @@ struct Cable {
};


} // namespace engine
} // namespace rack

+ 2
- 0
include/engine/Engine.hpp View File

@@ -6,6 +6,7 @@


namespace rack {
namespace engine {


struct Engine {
@@ -48,4 +49,5 @@ struct Engine {
};


} // namespace engine
} // namespace rack

+ 2
- 0
include/engine/Light.hpp View File

@@ -3,6 +3,7 @@


namespace rack {
namespace engine {


struct Light {
@@ -38,4 +39,5 @@ struct Light {
};


} // namespace engine
} // namespace rack

+ 2
- 0
include/engine/Module.hpp View File

@@ -9,6 +9,7 @@


namespace rack {
namespace engine {


struct Module {
@@ -53,4 +54,5 @@ struct Module {
};


} // namespace engine
} // namespace rack

+ 4
- 0
include/engine/Param.hpp View File

@@ -12,6 +12,9 @@ namespace app {
} // namespace app


namespace engine {


struct ParamQuantityFactory {
virtual ~ParamQuantityFactory() {}
virtual app::ParamQuantity *create() = 0;
@@ -87,4 +90,5 @@ struct Param {
};


} // namespace engine
} // namespace rack

+ 2
- 0
include/engine/Port.hpp View File

@@ -4,6 +4,7 @@


namespace rack {
namespace engine {


static const int PORT_MAX_CHANNELS = 16;
@@ -79,4 +80,5 @@ struct Output : Port {};
struct Input : Port {};


} // namespace engine
} // namespace rack

+ 10
- 10
include/helpers.hpp View File

@@ -17,7 +17,7 @@ namespace rack {
template <class TModule, class TModuleWidget, typename... Tags>
plugin::Model *createModel(std::string slug) {
struct TModel : plugin::Model {
Module *createModule() override {
engine::Module *createModule() override {
TModule *o = new TModule;
return o;
}
@@ -54,11 +54,11 @@ TWidget *createWidgetCentered(math::Vec pos) {
}

template <class TParamWidget>
TParamWidget *createParam(math::Vec pos, Module *module, int paramId) {
TParamWidget *createParam(math::Vec pos, engine::Module *module, int paramId) {
TParamWidget *o = new TParamWidget;
o->box.pos = pos;
if (module) {
ParamQuantityFactory *f = module->params[paramId].paramQuantityFactory;
engine::ParamQuantityFactory *f = module->params[paramId].paramQuantityFactory;
if (f)
o->paramQuantity = f->create();
else
@@ -70,14 +70,14 @@ TParamWidget *createParam(math::Vec pos, Module *module, int paramId) {
}

template <class TParamWidget>
TParamWidget *createParamCentered(math::Vec pos, Module *module, int paramId) {
TParamWidget *createParamCentered(math::Vec pos, engine::Module *module, int paramId) {
TParamWidget *o = createParam<TParamWidget>(pos, module, paramId);
o->box.pos = o->box.pos.minus(o->box.size.div(2));
return o;
}

template <class TPortWidget>
TPortWidget *createInput(math::Vec pos, Module *module, int inputId) {
TPortWidget *createInput(math::Vec pos, engine::Module *module, int inputId) {
TPortWidget *o = new TPortWidget;
o->box.pos = pos;
o->module = module;
@@ -87,7 +87,7 @@ TPortWidget *createInput(math::Vec pos, Module *module, int inputId) {
}

template <class TPortWidget>
TPortWidget *createInputCentered(math::Vec pos, Module *module, int inputId) {
TPortWidget *createInputCentered(math::Vec pos, engine::Module *module, int inputId) {
TPortWidget *o = new TPortWidget;
o->box.pos = pos.minus(o->box.size.div(2));
o->module = module;
@@ -97,7 +97,7 @@ TPortWidget *createInputCentered(math::Vec pos, Module *module, int inputId) {
}

template <class TPortWidget>
TPortWidget *createOutput(math::Vec pos, Module *module, int outputId) {
TPortWidget *createOutput(math::Vec pos, engine::Module *module, int outputId) {
TPortWidget *o = new TPortWidget;
o->box.pos = pos;
o->module = module;
@@ -107,7 +107,7 @@ TPortWidget *createOutput(math::Vec pos, Module *module, int outputId) {
}

template <class TPortWidget>
TPortWidget *createOutputCentered(math::Vec pos, Module *module, int outputId) {
TPortWidget *createOutputCentered(math::Vec pos, engine::Module *module, int outputId) {
TPortWidget *o = new TPortWidget;
o->box.pos = pos.minus(o->box.size.div(2));
o->module = module;
@@ -117,7 +117,7 @@ TPortWidget *createOutputCentered(math::Vec pos, Module *module, int outputId) {
}

template <class TModuleLightWidget>
TModuleLightWidget *createLight(math::Vec pos, Module *module, int firstLightId) {
TModuleLightWidget *createLight(math::Vec pos, engine::Module *module, int firstLightId) {
TModuleLightWidget *o = new TModuleLightWidget;
o->box.pos = pos;
o->module = module;
@@ -126,7 +126,7 @@ TModuleLightWidget *createLight(math::Vec pos, Module *module, int firstLightId)
}

template <class TModuleLightWidget>
TModuleLightWidget *createLightCentered(math::Vec pos, Module *module, int firstLightId) {
TModuleLightWidget *createLightCentered(math::Vec pos, engine::Module *module, int firstLightId) {
TModuleLightWidget *o = new TModuleLightWidget;
o->box.pos = pos.minus(o->box.size.div(2));
o->module = module;


+ 4
- 2
include/plugin/Model.hpp View File

@@ -13,7 +13,9 @@ namespace app {
} // namespace app


struct Module;
namespace engine {
struct Module;
} // namespace engine


namespace plugin {
@@ -35,7 +37,7 @@ struct Model {

virtual ~Model() {}
/** Creates a headless Module */
virtual Module *createModule() { return NULL; }
virtual engine::Module *createModule() { return NULL; }
/** Creates a ModuleWidget with a Module attached */
virtual app::ModuleWidget *createModuleWidget() { return NULL; }
/** Creates a ModuleWidget with no Module, useful for previews */


+ 1
- 0
include/rack.hpp View File

@@ -99,6 +99,7 @@ using namespace ui;
using namespace app;
using plugin::Plugin;
using plugin::Model;
using namespace engine;


} // namespace rack

+ 1
- 1
src/app.cpp View File

@@ -15,7 +15,7 @@ App::App() {
event = new event::State;
history = new history::State;
window = new Window;
engine = new Engine;
engine = new engine::Engine;
patch = new PatchManager;
scene = new Scene;
event->rootWidget = scene;


+ 1
- 1
src/app/CableWidget.cpp View File

@@ -89,7 +89,7 @@ CableWidget::CableWidget() {
lastCableColorId = (lastCableColorId + 1) % LENGTHOF(cableColors);
color = cableColors[lastCableColorId];

cable = new Cable;
cable = new engine::Cable;
}

CableWidget::~CableWidget() {


+ 1
- 1
src/app/ModuleWidget.cpp View File

@@ -289,7 +289,7 @@ void ModuleWidget::onDragMove(const event::DragMove &e) {
}
}

void ModuleWidget::setModule(Module *module) {
void ModuleWidget::setModule(engine::Module *module) {
if (this->module) {
delete this->module;
}


+ 1
- 1
src/app/ParamQuantity.cpp View File

@@ -7,7 +7,7 @@ namespace rack {
namespace app {


Param *ParamQuantity::getParam() {
engine::Param *ParamQuantity::getParam() {
assert(module);
return &module->params[paramId];
}


+ 2
- 0
src/engine/Cable.cpp View File

@@ -2,6 +2,7 @@


namespace rack {
namespace engine {


void Cable::step() {
@@ -16,4 +17,5 @@ void Cable::step() {
}


} // namespace engine
} // namespace rack

+ 2
- 0
src/engine/Engine.cpp View File

@@ -13,6 +13,7 @@


namespace rack {
namespace engine {


/** Threads which obtain a VIPLock will cause wait() to block for other less important threads.
@@ -414,4 +415,5 @@ float Engine::getSampleTime() {
}


} // namespace engine
} // namespace rack

+ 2
- 0
src/engine/Module.cpp View File

@@ -2,6 +2,7 @@


namespace rack {
namespace engine {


Module::Module() {
@@ -88,4 +89,5 @@ void Module::randomize() {
}


} // namespace engine
} // namespace rack

+ 2
- 0
src/engine/Param.cpp View File

@@ -4,6 +4,7 @@


namespace rack {
namespace engine {


bool Param::isBounded() {
@@ -42,4 +43,5 @@ void Param::randomize() {
}


} // namespace engine
} // namespace rack

+ 2
- 0
src/engine/Port.cpp View File

@@ -2,6 +2,7 @@


namespace rack {
namespace engine {


void Port::step() {
@@ -30,4 +31,5 @@ void Port::step() {
}


} // namespace engine
} // namespace rack

Loading…
Cancel
Save