From 5e4124f66a758096bdd04c2aaf69318d77a11308 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 19 Sep 2020 03:50:56 -0400 Subject: [PATCH] Rename bypassed to bypass everywhere. --- include/app/ModuleWidget.hpp | 1 - include/engine/Engine.hpp | 2 +- include/engine/Module.hpp | 2 +- include/history.hpp | 2 +- src/app/CableWidget.cpp | 2 +- src/app/ModuleWidget.cpp | 8 ++++---- src/engine/Engine.cpp | 12 ++++++------ src/engine/Module.cpp | 27 ++++++++++++--------------- src/history.cpp | 4 ++-- 9 files changed, 28 insertions(+), 32 deletions(-) diff --git a/include/app/ModuleWidget.hpp b/include/app/ModuleWidget.hpp index 11b6c0dd..4dca1de1 100644 --- a/include/app/ModuleWidget.hpp +++ b/include/app/ModuleWidget.hpp @@ -59,7 +59,6 @@ struct ModuleWidget : widget::OpaqueWidget { PortWidget* getInput(int portId); PortWidget* getOutput(int portId); - /** Serializes/unserializes the module state */ json_t* toJson(); void fromJson(json_t* rootJ); void copyClipboard(); diff --git a/include/engine/Engine.hpp b/include/engine/Engine.hpp index 9fe601f6..2deb0a16 100644 --- a/include/engine/Engine.hpp +++ b/include/engine/Engine.hpp @@ -83,7 +83,7 @@ struct Engine { Module* getModule(int64_t moduleId); void resetModule(Module* module); void randomizeModule(Module* module); - void bypassModule(Module* module, bool bypassed); + void bypassModule(Module* module, bool bypass); /** Serializes/deserializes with locking, ensuring that Module::process() is not called during toJson()/fromJson(). */ json_t* moduleToJson(Module* module); diff --git a/include/engine/Module.hpp b/include/engine/Module.hpp index 06a15d36..78ee96cd 100644 --- a/include/engine/Module.hpp +++ b/include/engine/Module.hpp @@ -320,7 +320,7 @@ struct Module { /** private */ float& cpuTime(); /** private */ - bool& bypassed(); + bool& bypass(); }; diff --git a/include/history.hpp b/include/history.hpp index 33b64368..f9db1c6e 100644 --- a/include/history.hpp +++ b/include/history.hpp @@ -101,7 +101,7 @@ struct ModuleMove : ModuleAction { struct ModuleBypass : ModuleAction { - bool bypassed; + bool bypass; void undo() override; void redo() override; ModuleBypass() { diff --git a/src/app/CableWidget.cpp b/src/app/CableWidget.cpp index ce3afdac..b3e131de 100644 --- a/src/app/CableWidget.cpp +++ b/src/app/CableWidget.cpp @@ -108,7 +108,7 @@ json_t* CableWidget::toJson() { void CableWidget::fromJson(json_t* rootJ) { json_t* colorJ = json_object_get(rootJ, "color"); if (colorJ) { - // v0.6.0 and earlier patches use JSON objects. Just ignore them if so and use the existing cable color. + // In <=v0.6.0, patches used JSON objects. Just ignore them if so and use the existing cable color. if (json_is_string(colorJ)) color = color::fromHexString(json_string_value(colorJ)); } diff --git a/src/app/ModuleWidget.cpp b/src/app/ModuleWidget.cpp index 456785cd..a05911d0 100644 --- a/src/app/ModuleWidget.cpp +++ b/src/app/ModuleWidget.cpp @@ -380,7 +380,7 @@ ModuleWidget::~ModuleWidget() { void ModuleWidget::draw(const DrawArgs& args) { nvgScissor(args.vg, RECT_ARGS(args.clipBox)); - if (module && module->bypassed()) { + if (module && module->bypass()) { nvgGlobalAlpha(args.vg, 0.33); } @@ -926,12 +926,12 @@ void ModuleWidget::cloneAction() { void ModuleWidget::bypassAction() { assert(module); - APP->engine->bypassModule(module, !module->bypassed()); + APP->engine->bypassModule(module, !module->bypass()); // history::ModuleBypass history::ModuleBypass* h = new history::ModuleBypass; h->moduleId = module->id; - h->bypassed = module->bypassed(); + h->bypass = module->bypass(); APP->history->push(h); } @@ -999,7 +999,7 @@ void ModuleWidget::createContextMenu() { ModuleBypassItem* bypassItem = new ModuleBypassItem; bypassItem->text = "Bypass"; bypassItem->rightText = RACK_MOD_CTRL_NAME "+E"; - if (module && module->bypassed()) + if (module && module->bypass()) bypassItem->rightText = CHECKMARK_STRING " " + bypassItem->rightText; bypassItem->moduleWidget = this; menu->addChild(bypassItem); diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index f2ee9c78..2b527f3e 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -344,7 +344,7 @@ static void Engine_stepModulesWorker(Engine* that, int threadId) { } // Step module - if (!module->bypassed()) + if (!module->bypass()) module->process(processArgs); else module->processBypass(processArgs); @@ -786,21 +786,21 @@ void Engine::randomizeModule(Module* module) { } -void Engine::bypassModule(Module* module, bool bypassed) { +void Engine::bypassModule(Module* module, bool bypass) { ExclusiveSharedLock lock(internal->mutex); assert(module); - if (module->bypassed() == bypassed) + if (module->bypass() == bypass) return; // Clear outputs and set to 1 channel for (Output& output : module->outputs) { // This zeros all voltages, but the channel is set to 1 if connected output.setChannels(0); } - // Set bypassed - module->bypassed() = bypassed; + // Set bypass state + module->bypass() = bypass; // Trigger event - if (bypassed) { + if (bypass) { Module::BypassEvent eBypass; module->onBypass(eBypass); } diff --git a/src/engine/Module.cpp b/src/engine/Module.cpp index aedf9d4f..9bea267f 100644 --- a/src/engine/Module.cpp +++ b/src/engine/Module.cpp @@ -12,7 +12,7 @@ struct Module::Internal { Only written when CPU timing is enabled, since time measurement is expensive. */ float cpuTime = 0.f; - bool bypassed = false; + bool bypass = false; }; @@ -97,9 +97,9 @@ json_t* Module::toJson() { if (paramsJ) json_object_set_new(rootJ, "params", paramsJ); - // bypassed - if (internal->bypassed) - json_object_set_new(rootJ, "bypassed", json_boolean(true)); + // bypass + if (internal->bypass) + json_object_set_new(rootJ, "bypass", json_boolean(true)); // leftModuleId if (leftExpander.moduleId >= 0) @@ -162,16 +162,13 @@ void Module::fromJson(json_t* rootJ) { if (paramsJ) paramsFromJson(paramsJ); - // bypassed - json_t* bypassedJ = json_object_get(rootJ, "bypassed"); - // legacy "bypass" in v0.6 or early v1 (don't remember) - if (!bypassedJ) - bypassedJ = json_object_get(rootJ, "bypass"); + // bypass + json_t* bypassJ = json_object_get(rootJ, "bypass"); // legacy "disabled" in v1 - if (!bypassedJ) - bypassedJ = json_object_get(rootJ, "disabled"); - if (bypassedJ) - internal->bypassed = json_boolean_value(bypassedJ); + if (!bypassJ) + bypassJ = json_object_get(rootJ, "disabled"); + if (bypassJ) + internal->bypass = json_boolean_value(bypassJ); // leftModuleId json_t *leftModuleIdJ = json_object_get(rootJ, "leftModuleId"); @@ -271,8 +268,8 @@ float& Module::cpuTime() { } -bool& Module::bypassed() { - return internal->bypassed; +bool& Module::bypass() { + return internal->bypass; } diff --git a/src/history.cpp b/src/history.cpp index 8b30d464..fa927afb 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -91,14 +91,14 @@ void ModuleBypass::undo() { engine::Module* module = APP->engine->getModule(moduleId); if (!module) return; - APP->engine->bypassModule(module, !bypassed); + APP->engine->bypassModule(module, !bypass); } void ModuleBypass::redo() { engine::Module* module = APP->engine->getModule(moduleId); if (!module) return; - APP->engine->bypassModule(module, bypassed); + APP->engine->bypassModule(module, bypass); }