Browse Source

SC: resolve TODOs

tags/v1.3.0
Brian Heim 5 years ago
parent
commit
904956616e
1 changed files with 13 additions and 13 deletions
  1. +13
    -13
      src/SuperColliderEngine.cpp

+ 13
- 13
src/SuperColliderEngine.cpp View File

@@ -62,6 +62,11 @@ private:
// converts top of stack back to ProcessBlock data // converts top of stack back to ProcessBlock data
void readScProcessBlockResult(ProcessBlock* block) noexcept; void readScProcessBlockResult(ProcessBlock* block) noexcept;


void fail(const std::string& msg) noexcept {
_engine->display(msg);
_ok = false;
}

SuperColliderEngine* _engine; SuperColliderEngine* _engine;
bool _ok = true; bool _ok = true;
}; };
@@ -108,9 +113,6 @@ private:
std::atomic_bool _clientRunning{false}; // set to true when client is ready to process data std::atomic_bool _clientRunning{false}; // set to true when client is ready to process data
}; };


// TODO
#define FAIL(_msg_) do { _engine->display(_msg_); _ok = false; } while (0)

SC_VcvPrototypeClient::SC_VcvPrototypeClient(SuperColliderEngine* engine) SC_VcvPrototypeClient::SC_VcvPrototypeClient(SuperColliderEngine* engine)
: SC_LanguageClient("SC VCV-Prototype client") : SC_LanguageClient("SC VCV-Prototype client")
, _engine(engine) , _engine(engine)
@@ -121,13 +123,13 @@ SC_VcvPrototypeClient::SC_VcvPrototypeClient(SuperColliderEngine* engine)
Path sc_yaml_path = rack::asset::plugin(pluginInstance, "dep/supercollider/sclang_vcv_config.yml"); Path sc_yaml_path = rack::asset::plugin(pluginInstance, "dep/supercollider/sclang_vcv_config.yml");


if (!SC_LanguageConfig::defaultLibraryConfig(/* isStandalone */ true)) if (!SC_LanguageConfig::defaultLibraryConfig(/* isStandalone */ true))
FAIL("Failed setting default library config");
fail("Failed setting default library config");
if (!gLanguageConfig->addIncludedDirectory(sc_lib_root)) if (!gLanguageConfig->addIncludedDirectory(sc_lib_root))
FAIL("Failed to add main include directory");
fail("Failed to add main include directory");
if (!gLanguageConfig->addIncludedDirectory(sc_ext_root)) if (!gLanguageConfig->addIncludedDirectory(sc_ext_root))
FAIL("Failed to add extensions include directory");
fail("Failed to add extensions include directory");
if (!SC_LanguageConfig::writeLibraryConfigYAML(sc_yaml_path)) if (!SC_LanguageConfig::writeLibraryConfigYAML(sc_yaml_path))
FAIL("Failed to write library config YAML file");
fail("Failed to write library config YAML file");


SC_LanguageConfig::setConfigPath(sc_yaml_path); SC_LanguageConfig::setConfigPath(sc_yaml_path);


@@ -135,9 +137,8 @@ SC_VcvPrototypeClient::SC_VcvPrototypeClient(SuperColliderEngine* engine)


initRuntime(); initRuntime();
compileLibrary(/* isStandalone */ true); compileLibrary(/* isStandalone */ true);
// TODO better logging here?
if (!isLibraryCompiled()) if (!isLibraryCompiled())
FAIL("Error while compiling class library");
fail("Error while compiling class library");
} }


SC_VcvPrototypeClient::~SC_VcvPrototypeClient() { SC_VcvPrototypeClient::~SC_VcvPrototypeClient() {
@@ -232,7 +233,7 @@ bool SC_VcvPrototypeClient::isVcvPrototypeProcessBlock(const PyrSlot* slot) cons
void SC_VcvPrototypeClient::readScProcessBlockResult(ProcessBlock* block) noexcept { void SC_VcvPrototypeClient::readScProcessBlockResult(ProcessBlock* block) noexcept {
auto* resultSlot = &scGlobals()->result; auto* resultSlot = &scGlobals()->result;
if (!isVcvPrototypeProcessBlock(resultSlot)) { if (!isVcvPrototypeProcessBlock(resultSlot)) {
FAIL("Result of ~vcv_process must be an instance of VcvPrototypeProcessBlock");
fail("Result of ~vcv_process must be an instance of VcvPrototypeProcessBlock");
return; return;
} }


@@ -338,12 +339,11 @@ int SC_VcvPrototypeClient::getResultAsInt(const char* text) noexcept {
if (intResult > 0) { if (intResult > 0) {
return intResult; return intResult;
} else { } else {
// TODO better formatting
FAIL(std::string("Result of '") + text + "' should be > 0");
fail(std::string("Result of '") + text + "' should be > 0");
return -1; return -1;
} }
} else { } else {
FAIL(std::string("Result of '") + text + "' should be Integer");
fail(std::string("Result of '") + text + "' should be Integer");
return -1; return -1;
} }
} }


Loading…
Cancel
Save