Skip to content

Commit

Permalink
include whether or not the root node is active in the processing bloc…
Browse files Browse the repository at this point in the history
…k context (#48)
  • Loading branch information
awood314 authored Jun 12, 2024
1 parent 070d2d5 commit 729cea8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions runtime/elem/GraphRenderSequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,16 @@ namespace elem
bufferMap.insert({{node->getId(), i}, ba.next()});
outputPtrs[i] = bufferMap.at({node->getId(), i});
}

renderOps.push_back([=, outputPtrs = std::move(outputPtrs)](HostContext<FloatType>& ctx) mutable {
renderOps.push_back([=, active = rootPtr->active(), outputPtrs = std::move(outputPtrs)](HostContext<FloatType>& ctx) mutable {
node->process(BlockContext<FloatType> {
ctx.inputData,
ctx.numInputChannels,
outputPtrs.data(),
numOuts,
ctx.numSamples,
ctx.userData,
active,
});
});
}
Expand Down Expand Up @@ -148,15 +149,16 @@ namespace elem
for (size_t j = 0; j < numChildren; ++j) {
inputPtrs[j] = bufferMap.at(children[j]);
}

renderOps.push_back([=, outputPtrs = std::move(outputPtrs), inputPtrs = std::move(inputPtrs)](HostContext<FloatType>& ctx) mutable {
renderOps.push_back([=, active = rootPtr->active(), outputPtrs = std::move(outputPtrs), inputPtrs = std::move(inputPtrs)](HostContext<FloatType>& ctx) mutable {
node->process(BlockContext<FloatType> {
const_cast<const FloatType**>(inputPtrs.data()),
numChildren,
outputPtrs.data(),
numOuts,
ctx.numSamples,
ctx.userData,
active,
});
});
}
Expand Down
1 change: 1 addition & 0 deletions runtime/elem/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ namespace elem
size_t numOutputChannels;
size_t numSamples;
void* userData;
bool active;
};

//==============================================================================
Expand Down
5 changes: 5 additions & 0 deletions runtime/elem/builtins/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ namespace elem
return targetGain.load();
}

bool active()
{
return targetGain.load() > 0.0f;
}

bool stillRunning()
{
auto const t = targetGain.load();
Expand Down

0 comments on commit 729cea8

Please sign in to comment.