| @@ -11,14 +11,19 @@ namespace rack { | |||||
| namespace event { | namespace event { | ||||
| struct State; | struct State; | ||||
| } | |||||
| } // namespace event | |||||
| namespace history { | namespace history { | ||||
| struct State; | struct State; | ||||
| } | |||||
| } // namespace history | |||||
| namespace engine { | |||||
| struct Engine; | |||||
| } // namespace engine | |||||
| struct Engine; | |||||
| struct Window; | struct Window; | ||||
| struct PatchManager; | struct PatchManager; | ||||
| @@ -33,7 +38,7 @@ struct Scene; | |||||
| struct App { | struct App { | ||||
| event::State *event = NULL; | event::State *event = NULL; | ||||
| Scene *scene = NULL; | Scene *scene = NULL; | ||||
| Engine *engine = NULL; | |||||
| engine::Engine *engine = NULL; | |||||
| Window *window = NULL; | Window *window = NULL; | ||||
| history::State *history = NULL; | history::State *history = NULL; | ||||
| PatchManager *patch = NULL; | PatchManager *patch = NULL; | ||||
| @@ -16,7 +16,7 @@ struct CableWidget : widget::OpaqueWidget { | |||||
| PortWidget *inputPort = NULL; | PortWidget *inputPort = NULL; | ||||
| PortWidget *hoveredOutputPort = NULL; | PortWidget *hoveredOutputPort = NULL; | ||||
| PortWidget *hoveredInputPort = NULL; | PortWidget *hoveredInputPort = NULL; | ||||
| Cable *cable; | |||||
| engine::Cable *cable; | |||||
| NVGcolor color; | NVGcolor color; | ||||
| CableWidget(); | CableWidget(); | ||||
| @@ -12,7 +12,7 @@ namespace app { | |||||
| Will access firstLightId, firstLightId + 1, etc. for each added color | Will access firstLightId, firstLightId + 1, etc. for each added color | ||||
| */ | */ | ||||
| struct ModuleLightWidget : MultiLightWidget { | struct ModuleLightWidget : MultiLightWidget { | ||||
| Module *module = NULL; | |||||
| engine::Module *module = NULL; | |||||
| int firstLightId; | int firstLightId; | ||||
| void step() override; | void step() override; | ||||
| }; | }; | ||||
| @@ -15,7 +15,7 @@ namespace app { | |||||
| struct ModuleWidget : widget::OpaqueWidget { | struct ModuleWidget : widget::OpaqueWidget { | ||||
| plugin::Model *model = NULL; | plugin::Model *model = NULL; | ||||
| /** Owns the module pointer */ | /** Owns the module pointer */ | ||||
| Module *module = NULL; | |||||
| engine::Module *module = NULL; | |||||
| widget::Widget *panel = NULL; | widget::Widget *panel = NULL; | ||||
| std::vector<ParamWidget*> params; | std::vector<ParamWidget*> params; | ||||
| @@ -26,7 +26,7 @@ struct ModuleWidget : widget::OpaqueWidget { | |||||
| math::Vec oldPos; | math::Vec oldPos; | ||||
| ModuleWidget() {} | ModuleWidget() {} | ||||
| DEPRECATED ModuleWidget(Module *module) { | |||||
| DEPRECATED ModuleWidget(engine::Module *module) { | |||||
| setModule(module); | setModule(module); | ||||
| } | } | ||||
| ~ModuleWidget(); | ~ModuleWidget(); | ||||
| @@ -44,7 +44,7 @@ struct ModuleWidget : widget::OpaqueWidget { | |||||
| /** Associates this ModuleWidget with the Module | /** Associates this ModuleWidget with the Module | ||||
| Transfers ownership | Transfers ownership | ||||
| */ | */ | ||||
| void setModule(Module *module); | |||||
| void setModule(engine::Module *module); | |||||
| void setPanel(std::shared_ptr<SVG> svg); | void setPanel(std::shared_ptr<SVG> svg); | ||||
| /** Convenience functions for adding special widgets (calls addChild()) */ | /** Convenience functions for adding special widgets (calls addChild()) */ | ||||
| @@ -10,10 +10,10 @@ namespace app { | |||||
| /** A ui::Quantity that wraps an engine Param */ | /** A ui::Quantity that wraps an engine Param */ | ||||
| struct ParamQuantity : ui::Quantity { | struct ParamQuantity : ui::Quantity { | ||||
| Module *module = NULL; | |||||
| engine::Module *module = NULL; | |||||
| int paramId = 0; | int paramId = 0; | ||||
| Param *getParam(); | |||||
| engine::Param *getParam(); | |||||
| /** Request to the engine to smoothly set the value */ | /** Request to the engine to smoothly set the value */ | ||||
| void setSmoothValue(float smoothValue); | void setSmoothValue(float smoothValue); | ||||
| float getSmoothValue(); | float getSmoothValue(); | ||||
| @@ -10,7 +10,7 @@ namespace app { | |||||
| struct PortWidget : widget::OpaqueWidget { | struct PortWidget : widget::OpaqueWidget { | ||||
| Module *module = NULL; | |||||
| engine::Module *module = NULL; | |||||
| int portId; | int portId; | ||||
| enum Type { | enum Type { | ||||
| @@ -4,6 +4,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace engine { | |||||
| struct Cable { | struct Cable { | ||||
| @@ -16,4 +17,5 @@ struct Cable { | |||||
| }; | }; | ||||
| } // namespace engine | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -6,6 +6,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace engine { | |||||
| struct Engine { | struct Engine { | ||||
| @@ -48,4 +49,5 @@ struct Engine { | |||||
| }; | }; | ||||
| } // namespace engine | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -3,6 +3,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace engine { | |||||
| struct Light { | struct Light { | ||||
| @@ -38,4 +39,5 @@ struct Light { | |||||
| }; | }; | ||||
| } // namespace engine | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -9,6 +9,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace engine { | |||||
| struct Module { | struct Module { | ||||
| @@ -53,4 +54,5 @@ struct Module { | |||||
| }; | }; | ||||
| } // namespace engine | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -12,6 +12,9 @@ namespace app { | |||||
| } // namespace app | } // namespace app | ||||
| namespace engine { | |||||
| struct ParamQuantityFactory { | struct ParamQuantityFactory { | ||||
| virtual ~ParamQuantityFactory() {} | virtual ~ParamQuantityFactory() {} | ||||
| virtual app::ParamQuantity *create() = 0; | virtual app::ParamQuantity *create() = 0; | ||||
| @@ -87,4 +90,5 @@ struct Param { | |||||
| }; | }; | ||||
| } // namespace engine | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -4,6 +4,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace engine { | |||||
| static const int PORT_MAX_CHANNELS = 16; | static const int PORT_MAX_CHANNELS = 16; | ||||
| @@ -79,4 +80,5 @@ struct Output : Port {}; | |||||
| struct Input : Port {}; | struct Input : Port {}; | ||||
| } // namespace engine | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -17,7 +17,7 @@ namespace rack { | |||||
| template <class TModule, class TModuleWidget, typename... Tags> | template <class TModule, class TModuleWidget, typename... Tags> | ||||
| plugin::Model *createModel(std::string slug) { | plugin::Model *createModel(std::string slug) { | ||||
| struct TModel : plugin::Model { | struct TModel : plugin::Model { | ||||
| Module *createModule() override { | |||||
| engine::Module *createModule() override { | |||||
| TModule *o = new TModule; | TModule *o = new TModule; | ||||
| return o; | return o; | ||||
| } | } | ||||
| @@ -54,11 +54,11 @@ TWidget *createWidgetCentered(math::Vec pos) { | |||||
| } | } | ||||
| template <class TParamWidget> | 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; | TParamWidget *o = new TParamWidget; | ||||
| o->box.pos = pos; | o->box.pos = pos; | ||||
| if (module) { | if (module) { | ||||
| ParamQuantityFactory *f = module->params[paramId].paramQuantityFactory; | |||||
| engine::ParamQuantityFactory *f = module->params[paramId].paramQuantityFactory; | |||||
| if (f) | if (f) | ||||
| o->paramQuantity = f->create(); | o->paramQuantity = f->create(); | ||||
| else | else | ||||
| @@ -70,14 +70,14 @@ TParamWidget *createParam(math::Vec pos, Module *module, int paramId) { | |||||
| } | } | ||||
| template <class TParamWidget> | 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); | TParamWidget *o = createParam<TParamWidget>(pos, module, paramId); | ||||
| o->box.pos = o->box.pos.minus(o->box.size.div(2)); | o->box.pos = o->box.pos.minus(o->box.size.div(2)); | ||||
| return o; | return o; | ||||
| } | } | ||||
| template <class TPortWidget> | 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; | TPortWidget *o = new TPortWidget; | ||||
| o->box.pos = pos; | o->box.pos = pos; | ||||
| o->module = module; | o->module = module; | ||||
| @@ -87,7 +87,7 @@ TPortWidget *createInput(math::Vec pos, Module *module, int inputId) { | |||||
| } | } | ||||
| template <class TPortWidget> | 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; | TPortWidget *o = new TPortWidget; | ||||
| o->box.pos = pos.minus(o->box.size.div(2)); | o->box.pos = pos.minus(o->box.size.div(2)); | ||||
| o->module = module; | o->module = module; | ||||
| @@ -97,7 +97,7 @@ TPortWidget *createInputCentered(math::Vec pos, Module *module, int inputId) { | |||||
| } | } | ||||
| template <class TPortWidget> | 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; | TPortWidget *o = new TPortWidget; | ||||
| o->box.pos = pos; | o->box.pos = pos; | ||||
| o->module = module; | o->module = module; | ||||
| @@ -107,7 +107,7 @@ TPortWidget *createOutput(math::Vec pos, Module *module, int outputId) { | |||||
| } | } | ||||
| template <class TPortWidget> | 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; | TPortWidget *o = new TPortWidget; | ||||
| o->box.pos = pos.minus(o->box.size.div(2)); | o->box.pos = pos.minus(o->box.size.div(2)); | ||||
| o->module = module; | o->module = module; | ||||
| @@ -117,7 +117,7 @@ TPortWidget *createOutputCentered(math::Vec pos, Module *module, int outputId) { | |||||
| } | } | ||||
| template <class TModuleLightWidget> | 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; | TModuleLightWidget *o = new TModuleLightWidget; | ||||
| o->box.pos = pos; | o->box.pos = pos; | ||||
| o->module = module; | o->module = module; | ||||
| @@ -126,7 +126,7 @@ TModuleLightWidget *createLight(math::Vec pos, Module *module, int firstLightId) | |||||
| } | } | ||||
| template <class TModuleLightWidget> | 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; | TModuleLightWidget *o = new TModuleLightWidget; | ||||
| o->box.pos = pos.minus(o->box.size.div(2)); | o->box.pos = pos.minus(o->box.size.div(2)); | ||||
| o->module = module; | o->module = module; | ||||
| @@ -13,7 +13,9 @@ namespace app { | |||||
| } // namespace app | } // namespace app | ||||
| struct Module; | |||||
| namespace engine { | |||||
| struct Module; | |||||
| } // namespace engine | |||||
| namespace plugin { | namespace plugin { | ||||
| @@ -35,7 +37,7 @@ struct Model { | |||||
| virtual ~Model() {} | virtual ~Model() {} | ||||
| /** Creates a headless Module */ | /** Creates a headless Module */ | ||||
| virtual Module *createModule() { return NULL; } | |||||
| virtual engine::Module *createModule() { return NULL; } | |||||
| /** Creates a ModuleWidget with a Module attached */ | /** Creates a ModuleWidget with a Module attached */ | ||||
| virtual app::ModuleWidget *createModuleWidget() { return NULL; } | virtual app::ModuleWidget *createModuleWidget() { return NULL; } | ||||
| /** Creates a ModuleWidget with no Module, useful for previews */ | /** Creates a ModuleWidget with no Module, useful for previews */ | ||||
| @@ -99,6 +99,7 @@ using namespace ui; | |||||
| using namespace app; | using namespace app; | ||||
| using plugin::Plugin; | using plugin::Plugin; | ||||
| using plugin::Model; | using plugin::Model; | ||||
| using namespace engine; | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -15,7 +15,7 @@ App::App() { | |||||
| event = new event::State; | event = new event::State; | ||||
| history = new history::State; | history = new history::State; | ||||
| window = new Window; | window = new Window; | ||||
| engine = new Engine; | |||||
| engine = new engine::Engine; | |||||
| patch = new PatchManager; | patch = new PatchManager; | ||||
| scene = new Scene; | scene = new Scene; | ||||
| event->rootWidget = scene; | event->rootWidget = scene; | ||||
| @@ -89,7 +89,7 @@ CableWidget::CableWidget() { | |||||
| lastCableColorId = (lastCableColorId + 1) % LENGTHOF(cableColors); | lastCableColorId = (lastCableColorId + 1) % LENGTHOF(cableColors); | ||||
| color = cableColors[lastCableColorId]; | color = cableColors[lastCableColorId]; | ||||
| cable = new Cable; | |||||
| cable = new engine::Cable; | |||||
| } | } | ||||
| CableWidget::~CableWidget() { | CableWidget::~CableWidget() { | ||||
| @@ -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) { | if (this->module) { | ||||
| delete this->module; | delete this->module; | ||||
| } | } | ||||
| @@ -7,7 +7,7 @@ namespace rack { | |||||
| namespace app { | namespace app { | ||||
| Param *ParamQuantity::getParam() { | |||||
| engine::Param *ParamQuantity::getParam() { | |||||
| assert(module); | assert(module); | ||||
| return &module->params[paramId]; | return &module->params[paramId]; | ||||
| } | } | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace engine { | |||||
| void Cable::step() { | void Cable::step() { | ||||
| @@ -16,4 +17,5 @@ void Cable::step() { | |||||
| } | } | ||||
| } // namespace engine | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -13,6 +13,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace engine { | |||||
| /** Threads which obtain a VIPLock will cause wait() to block for other less important threads. | /** 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 | } // namespace rack | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace engine { | |||||
| Module::Module() { | Module::Module() { | ||||
| @@ -88,4 +89,5 @@ void Module::randomize() { | |||||
| } | } | ||||
| } // namespace engine | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -4,6 +4,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace engine { | |||||
| bool Param::isBounded() { | bool Param::isBounded() { | ||||
| @@ -42,4 +43,5 @@ void Param::randomize() { | |||||
| } | } | ||||
| } // namespace engine | |||||
| } // namespace rack | } // namespace rack | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace engine { | |||||
| void Port::step() { | void Port::step() { | ||||
| @@ -30,4 +31,5 @@ void Port::step() { | |||||
| } | } | ||||
| } // namespace engine | |||||
| } // namespace rack | } // namespace rack | ||||