Browse Source

SC: implement getResultAsInt

tags/v1.3.0
Brian Heim 5 years ago
parent
commit
65e74b65cd
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      src/SuperColliderEngine.cpp

+ 14
- 0
src/SuperColliderEngine.cpp View File

@@ -161,6 +161,20 @@ void SC_VcvPrototypeClient::evaluateProcessBlock(ProcessBlock* block) noexcept {
// END TIMING
}

int SC_VcvPrototypeClient::getResultAsInt(const char* text) noexcept {
interpret(text);

auto* resultSlot = &scGlobals()->result;
if (IsInt(resultSlot)) {
auto intResult = slotRawInt(resultSlot);
printf("%s: %d\n", text, intResult);
return intResult;
}

FAIL(std::string("Result of '") + text + "' was not int as expected");
return -1;
}

__attribute__((constructor(1000)))
static void constructor() {
addScriptEngine<SuperColliderEngine>("sc");


Loading…
Cancel
Save