| 1309 | } |
| 1310 | |
| 1311 | void JavascriptTimeVariantModulator::calculateBlock(int startSample, int numSamples) |
| 1312 | { |
| 1313 | if (auto n = getActiveNetwork()) |
| 1314 | { |
| 1315 | auto ptr = internalBuffer.getWritePointer(0, startSample); |
| 1316 | FloatVectorOperations::clear(ptr, numSamples); |
| 1317 | |
| 1318 | snex::Types::ProcessDataDyn d(&ptr, numSamples, 1); |
| 1319 | |
| 1320 | if (auto s = SimpleReadWriteLock::ScopedTryReadLock(n->getConnectionLock())) |
| 1321 | { |
| 1322 | if(n->getExceptionHandler().isOk()) |
| 1323 | n->getRootNode()->process(d); |
| 1324 | } |
| 1325 | |
| 1326 | FloatVectorOperations::clip(ptr, ptr, 0.0f, 1.0f, numSamples); |
| 1327 | } |
| 1328 | else if (!processBlockCallback->isSnippetEmpty() && lastResult.wasOk()) |
| 1329 | { |
| 1330 | buffer->referToData(internalBuffer.getWritePointer(0, startSample), numSamples); |
| 1331 | |
| 1332 | scriptEngine->setCallbackParameter(Callback::processBlock, 0, bufferVar); |
| 1333 | scriptEngine->executeCallback(Callback::processBlock, &lastResult); |
| 1334 | |
| 1335 | BACKEND_ONLY(if (!lastResult.wasOk()) debugError(this, lastResult.getErrorMessage())); |
| 1336 | } |
| 1337 | |
| 1338 | #if ENABLE_ALL_PEAK_METERS |
| 1339 | setOutputValue(internalBuffer.getSample(0, startSample)); |
| 1340 | #endif |
| 1341 | |
| 1342 | } |
| 1343 | |
| 1344 | JavascriptProcessor::SnippetDocument* JavascriptTimeVariantModulator::getSnippet(int c) |
| 1345 | { |
nothing calls this directly
no test coverage detected