Browse Source

Change `bypass` variable name to `bypassed` when appropriate.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
5f8f9b8e35
9 changed files with 26 additions and 26 deletions
  1. +2
    -2
      include/engine/Engine.hpp
  2. +2
    -2
      include/engine/Module.hpp
  3. +1
    -1
      include/history.hpp
  4. +1
    -1
      include/widget/FramebufferWidget.hpp
  5. +4
    -4
      src/app/ModuleWidget.cpp
  6. +5
    -5
      src/engine/Engine.cpp
  7. +8
    -8
      src/engine/Module.cpp
  8. +2
    -2
      src/history.cpp
  9. +1
    -1
      src/widget/FramebufferWidget.cpp

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

@@ -124,10 +124,10 @@ struct Engine {
Write-locks. Write-locks.
*/ */
void randomizeModule(Module* module); void randomizeModule(Module* module);
/** Sets the bypass state and triggers a BypassEvent or UnBypassEvent of the given Module.
/** Sets the bypassed state and triggers a BypassEvent or UnBypassEvent of the given Module.
Write-locks. Write-locks.
*/ */
void bypassModule(Module* module, bool bypass);
void bypassModule(Module* module, bool bypassed);
/** Serializes the given Module with locking, ensuring that Module::process() is not called simultaneously. /** Serializes the given Module with locking, ensuring that Module::process() is not called simultaneously.
Read-locks. Read-locks.
*/ */


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

@@ -344,8 +344,8 @@ struct Module {
/** DEPRECATED. Override `onSampleRateChange(e)` instead. */ /** DEPRECATED. Override `onSampleRateChange(e)` instead. */
virtual void onSampleRateChange() {} virtual void onSampleRateChange() {}


bool isBypass();
PRIVATE void setBypass(bool bypass);
bool isBypassed();
PRIVATE void setBypassed(bool bypassed);
PRIVATE const float* meterBuffer(); PRIVATE const float* meterBuffer();
PRIVATE int meterLength(); PRIVATE int meterLength();
PRIVATE int meterIndex(); PRIVATE int meterIndex();


+ 1
- 1
include/history.hpp View File

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




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


+ 1
- 1
include/widget/FramebufferWidget.hpp View File

@@ -16,7 +16,7 @@ struct FramebufferWidget : Widget {


/** Set this to true to re-render the children to the framebuffer the next time it is drawn */ /** Set this to true to re-render the children to the framebuffer the next time it is drawn */
bool dirty = true; bool dirty = true;
bool bypass = false;
bool bypassed = false;
float oversample = 1.0; float oversample = 1.0;
/** Redraw when the world offset of the FramebufferWidget changes its fractional value. */ /** Redraw when the world offset of the FramebufferWidget changes its fractional value. */
bool dirtyOnSubpixelChange = true; bool dirtyOnSubpixelChange = true;


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

@@ -394,7 +394,7 @@ ModuleWidget::~ModuleWidget() {
void ModuleWidget::draw(const DrawArgs& args) { void ModuleWidget::draw(const DrawArgs& args) {
nvgScissor(args.vg, RECT_ARGS(args.clipBox)); nvgScissor(args.vg, RECT_ARGS(args.clipBox));


if (module && module->isBypass()) {
if (module && module->isBypassed()) {
nvgGlobalAlpha(args.vg, 0.33); nvgGlobalAlpha(args.vg, 0.33);
} }


@@ -1002,12 +1002,12 @@ void ModuleWidget::cloneAction() {


void ModuleWidget::bypassAction() { void ModuleWidget::bypassAction() {
assert(module); assert(module);
APP->engine->bypassModule(module, !module->isBypass());
APP->engine->bypassModule(module, !module->isBypassed());


// history::ModuleBypass // history::ModuleBypass
history::ModuleBypass* h = new history::ModuleBypass; history::ModuleBypass* h = new history::ModuleBypass;
h->moduleId = module->id; h->moduleId = module->id;
h->bypass = module->isBypass();
h->bypassed = module->isBypassed();
APP->history->push(h); APP->history->push(h);
} }


@@ -1075,7 +1075,7 @@ void ModuleWidget::createContextMenu() {
ModuleBypassItem* bypassItem = new ModuleBypassItem; ModuleBypassItem* bypassItem = new ModuleBypassItem;
bypassItem->text = "Bypass"; bypassItem->text = "Bypass";
bypassItem->rightText = RACK_MOD_CTRL_NAME "+E"; bypassItem->rightText = RACK_MOD_CTRL_NAME "+E";
if (module && module->isBypass())
if (module && module->isBypassed())
bypassItem->rightText = CHECKMARK_STRING " " + bypassItem->rightText; bypassItem->rightText = CHECKMARK_STRING " " + bypassItem->rightText;
bypassItem->moduleWidget = this; bypassItem->moduleWidget = this;
menu->addChild(bypassItem); menu->addChild(bypassItem);


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

@@ -782,21 +782,21 @@ void Engine::randomizeModule(Module* module) {
} }




void Engine::bypassModule(Module* module, bool bypass) {
void Engine::bypassModule(Module* module, bool bypassed) {
WriteLock lock(internal->mutex); WriteLock lock(internal->mutex);
assert(module); assert(module);


if (module->isBypass() == bypass)
if (module->isBypassed() == bypassed)
return; return;
// Clear outputs and set to 1 channel // Clear outputs and set to 1 channel
for (Output& output : module->outputs) { for (Output& output : module->outputs) {
// This zeros all voltages, but the channel is set to 1 if connected // This zeros all voltages, but the channel is set to 1 if connected
output.setChannels(0); output.setChannels(0);
} }
// Set bypass state
module->setBypass(bypass);
// Set bypassed state
module->setBypassed(bypassed);
// Trigger event // Trigger event
if (bypass) {
if (bypassed) {
Module::BypassEvent eBypass; Module::BypassEvent eBypass;
module->onBypass(eBypass); module->onBypass(eBypass);
} }


+ 8
- 8
src/engine/Module.cpp View File

@@ -18,7 +18,7 @@ static const int meterBufferLength = 128;




struct Module::Internal { struct Module::Internal {
bool bypass = false;
bool bypassed = false;


int64_t meterLastBlock = 0; int64_t meterLastBlock = 0;
int meterSamples = 0; int meterSamples = 0;
@@ -117,7 +117,7 @@ json_t* Module::toJson() {
json_object_set_new(rootJ, "params", paramsJ); json_object_set_new(rootJ, "params", paramsJ);


// bypass // bypass
if (internal->bypass)
if (internal->bypassed)
json_object_set_new(rootJ, "bypass", json_boolean(true)); json_object_set_new(rootJ, "bypass", json_boolean(true));


// leftModuleId // leftModuleId
@@ -187,7 +187,7 @@ void Module::fromJson(json_t* rootJ) {
if (!bypassJ) if (!bypassJ)
bypassJ = json_object_get(rootJ, "disabled"); bypassJ = json_object_get(rootJ, "disabled");
if (bypassJ) if (bypassJ)
internal->bypass = json_boolean_value(bypassJ);
internal->bypassed = json_boolean_value(bypassJ);


// leftModuleId // leftModuleId
json_t *leftModuleIdJ = json_object_get(rootJ, "leftModuleId"); json_t *leftModuleIdJ = json_object_get(rootJ, "leftModuleId");
@@ -282,13 +282,13 @@ void Module::onRandomize(const RandomizeEvent& e) {
} }




bool Module::isBypass() {
return internal->bypass;
bool Module::isBypassed() {
return internal->bypassed;
} }




void Module::setBypass(bool bypass) {
internal->bypass = bypass;
void Module::setBypassed(bool bypassed) {
internal->bypassed = bypassed;
} }




@@ -344,7 +344,7 @@ void Module::doProcess(const ProcessArgs& args) {
} }


// Step module // Step module
if (!internal->bypass)
if (!internal->bypassed)
process(args); process(args);
else else
processBypass(args); processBypass(args);


+ 2
- 2
src/history.cpp View File

@@ -91,14 +91,14 @@ void ModuleBypass::undo() {
engine::Module* module = APP->engine->getModule(moduleId); engine::Module* module = APP->engine->getModule(moduleId);
if (!module) if (!module)
return; return;
APP->engine->bypassModule(module, !bypass);
APP->engine->bypassModule(module, !bypassed);
} }


void ModuleBypass::redo() { void ModuleBypass::redo() {
engine::Module* module = APP->engine->getModule(moduleId); engine::Module* module = APP->engine->getModule(moduleId);
if (!module) if (!module)
return; return;
APP->engine->bypassModule(module, bypass);
APP->engine->bypassModule(module, bypassed);
} }






+ 1
- 1
src/widget/FramebufferWidget.cpp View File

@@ -163,7 +163,7 @@ void FramebufferWidget::step() {


void FramebufferWidget::draw(const DrawArgs& args) { void FramebufferWidget::draw(const DrawArgs& args) {
// Draw directly if already drawing in a framebuffer // Draw directly if already drawing in a framebuffer
if (bypass || args.fb) {
if (bypassed || args.fb) {
Widget::draw(args); Widget::draw(args);
return; return;
} }


Loading…
Cancel
Save