Browse Source

Rename bypassed to bypass everywhere.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
5e4124f66a
9 changed files with 28 additions and 32 deletions
  1. +0
    -1
      include/app/ModuleWidget.hpp
  2. +1
    -1
      include/engine/Engine.hpp
  3. +1
    -1
      include/engine/Module.hpp
  4. +1
    -1
      include/history.hpp
  5. +1
    -1
      src/app/CableWidget.cpp
  6. +4
    -4
      src/app/ModuleWidget.cpp
  7. +6
    -6
      src/engine/Engine.cpp
  8. +12
    -15
      src/engine/Module.cpp
  9. +2
    -2
      src/history.cpp

+ 0
- 1
include/app/ModuleWidget.hpp View File

@@ -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();


+ 1
- 1
include/engine/Engine.hpp View File

@@ -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);


+ 1
- 1
include/engine/Module.hpp View File

@@ -320,7 +320,7 @@ struct Module {
/** private */
float& cpuTime();
/** private */
bool& bypassed();
bool& bypass();
};




+ 1
- 1
include/history.hpp View File

@@ -101,7 +101,7 @@ struct ModuleMove : ModuleAction {


struct ModuleBypass : ModuleAction {
bool bypassed;
bool bypass;
void undo() override;
void redo() override;
ModuleBypass() {


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

@@ -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));
}


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

@@ -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);


+ 6
- 6
src/engine/Engine.cpp View File

@@ -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);
}


+ 12
- 15
src/engine/Module.cpp View File

@@ -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;
}




+ 2
- 2
src/history.cpp View File

@@ -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);
}




Loading…
Cancel
Save