Browse Source

Remove real-time menu item and setting.

tags/v2.0.0
Andrew Belt 5 years ago
parent
commit
6907d53a25
4 changed files with 5 additions and 29 deletions
  1. +0
    -1
      include/settings.hpp
  2. +0
    -11
      src/app/MenuBar.cpp
  3. +5
    -10
      src/engine/Engine.cpp
  4. +0
    -7
      src/settings.cpp

+ 0
- 1
include/settings.hpp View File

@@ -28,7 +28,6 @@ extern bool invertZoom;
extern float cableOpacity;
extern float cableTension;
extern bool allowCursorLock;
extern bool realTime;
extern float sampleRate;
extern int threadCount;
extern bool paramTooltip;


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

@@ -456,12 +456,6 @@ struct SampleRateItem : ui::MenuItem {
}
};

struct RealTimeItem : ui::MenuItem {
void onAction(const event::Action& e) override {
settings::realTime ^= true;
}
};

struct ThreadCountValueItem : ui::MenuItem {
int threadCount;
void setThreadCount(int threadCount) {
@@ -482,11 +476,6 @@ struct ThreadCountItem : ui::MenuItem {
ui::Menu* createChildMenu() override {
ui::Menu* menu = new ui::Menu;

RealTimeItem* realTimeItem = new RealTimeItem;
realTimeItem->text = "Real-time priority";
realTimeItem->rightText = CHECKMARK(settings::realTime);
menu->addChild(realTimeItem);

int coreCount = system::getLogicalCoreCount();
for (int i = 1; i <= coreCount; i++) {
ThreadCountValueItem* item = new ThreadCountValueItem;


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

@@ -165,7 +165,6 @@ struct Engine::Internal {

std::recursive_mutex mutex;

bool realTime = false;
int threadCount = 0;
std::vector<EngineWorker> workers;
HybridBarrier engineBarrier;
@@ -341,7 +340,7 @@ static void Engine_updateExpander(Engine* that, Module::Expander* expander) {
}


static void Engine_relaunchWorkers(Engine* that, int threadCount, bool realTime) {
static void Engine_relaunchWorkers(Engine* that, int threadCount) {
Engine::Internal* internal = that->internal;

if (internal->threadCount > 0) {
@@ -360,15 +359,11 @@ static void Engine_relaunchWorkers(Engine* that, int threadCount, bool realTime)

// Configure engine
internal->threadCount = threadCount;
internal->realTime = realTime;

// Set barrier counts
internal->engineBarrier.total = threadCount;
internal->workerBarrier.total = threadCount;

// Configure main thread
system::setThreadRealTime(realTime);

if (threadCount > 0) {
// Create and start engine workers
internal->workers.resize(threadCount - 1);
@@ -391,7 +386,7 @@ Engine::Engine() {


Engine::~Engine() {
Engine_relaunchWorkers(this, 0, false);
Engine_relaunchWorkers(this, 0);
clear();

// Make sure there are no cables or modules in the rack on destruction.
@@ -444,8 +439,8 @@ void Engine::step(int frames) {

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

std::lock_guard<std::recursive_mutex> lock(internal->mutex);
@@ -464,7 +459,7 @@ void Engine::step(int frames) {
else {
// Stop workers while paused
if (internal->threadCount != 1) {
Engine_relaunchWorkers(this, 1, settings::realTime);
Engine_relaunchWorkers(this, 1);
}
}



+ 0
- 7
src/settings.cpp View File

@@ -23,7 +23,6 @@ bool invertZoom = false;
float cableOpacity = 0.5;
float cableTension = 0.5;
bool allowCursorLock = true;
bool realTime = false;
float sampleRate = 44100.0;
int threadCount = 1;
bool paramTooltip = false;
@@ -67,8 +66,6 @@ json_t* toJson() {

json_object_set_new(rootJ, "allowCursorLock", json_boolean(allowCursorLock));

json_object_set_new(rootJ, "realTime", json_boolean(realTime));

json_object_set_new(rootJ, "sampleRate", json_real(sampleRate));

json_object_set_new(rootJ, "threadCount", json_integer(threadCount));
@@ -138,10 +135,6 @@ void fromJson(json_t* rootJ) {
if (allowCursorLockJ)
allowCursorLock = json_is_true(allowCursorLockJ);

json_t* realTimeJ = json_object_get(rootJ, "realTime");
if (realTimeJ)
realTime = json_boolean_value(realTimeJ);

json_t* sampleRateJ = json_object_get(rootJ, "sampleRate");
if (sampleRateJ)
sampleRate = json_number_value(sampleRateJ);


Loading…
Cancel
Save