Browse Source

Remove engine pausing as it no longer makes sense with the new "external stepping" engine architecture.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
537b64d011
3 changed files with 12 additions and 47 deletions
  1. +0
    -2
      include/engine/Engine.hpp
  2. +0
    -12
      src/app/MenuBar.cpp
  3. +12
    -33
      src/engine/Engine.cpp

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

@@ -26,8 +26,6 @@ struct Engine {
void setPrimaryModule(Module* module);
Module* getPrimaryModule();

void setPaused(bool paused);
bool isPaused();
float getSampleRate();
/** Returns the inverse of the current sample rate.
*/


+ 0
- 12
src/app/MenuBar.cpp View File

@@ -478,17 +478,10 @@ struct CpuMeterItem : ui::MenuItem {
}
};

struct EnginePauseItem : ui::MenuItem {
void onAction(const event::Action& e) override {
APP->engine->setPaused(!APP->engine->isPaused());
}
};

struct SampleRateValueItem : ui::MenuItem {
float sampleRate;
void onAction(const event::Action& e) override {
settings::sampleRate = sampleRate;
APP->engine->setPaused(false);
}
};

@@ -496,11 +489,6 @@ struct SampleRateItem : ui::MenuItem {
ui::Menu* createChildMenu() override {
ui::Menu* menu = new ui::Menu;

EnginePauseItem* enginePauseItem = new EnginePauseItem;
enginePauseItem->text = "Pause";
enginePauseItem->rightText = CHECKMARK(APP->engine->isPaused());
menu->addChild(enginePauseItem);

for (int i = -2; i <= 4; i++) {
for (int j = 0; j < 2; j++) {
float oversample = std::pow(2.f, i);


+ 12
- 33
src/engine/Engine.cpp View File

@@ -147,7 +147,6 @@ struct Engine::Internal {
std::vector<Cable*> cables;
std::set<ParamHandle*> paramHandles;
std::map<std::tuple<int, int>, ParamHandle*> paramHandleCache;
bool paused = false;

float sampleRate = 0.f;
float sampleTime = 0.f;
@@ -454,28 +453,20 @@ void Engine::step(int frames) {
}
}

if (!internal->paused) {
// Launch workers
if (internal->threadCount != settings::threadCount) {
Engine_relaunchWorkers(this, settings::threadCount);
}

// Update expander pointers
for (Module* module : internal->modules) {
Engine_updateExpander(this, &module->leftExpander);
Engine_updateExpander(this, &module->rightExpander);
}
// Launch workers
if (internal->threadCount != settings::threadCount) {
Engine_relaunchWorkers(this, settings::threadCount);
}

// Step modules
for (int i = 0; i < frames; i++) {
Engine_stepModules(this);
}
// Update expander pointers
for (Module* module : internal->modules) {
Engine_updateExpander(this, &module->leftExpander);
Engine_updateExpander(this, &module->rightExpander);
}
else {
// Stop workers while paused
if (internal->threadCount != 1) {
Engine_relaunchWorkers(this, 1);
}

// Step modules
for (int i = 0; i < frames; i++) {
Engine_stepModules(this);
}

yieldWorkers();
@@ -494,18 +485,6 @@ Module* Engine::getPrimaryModule() {
}


void Engine::setPaused(bool paused) {
std::lock_guard<std::recursive_mutex> lock(internal->mutex);
internal->paused = paused;
}


bool Engine::isPaused() {
// No lock, for performance
return internal->paused;
}


float Engine::getSampleRate() {
// No lock, for performance
return internal->sampleRate;


Loading…
Cancel
Save