Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Int and Power on Runnign Voices and Groups for procs #1320

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/dsp/processor/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ struct Processor : MoveableOnly<Processor>, SampleRateSupport
const ProcessorStorage &ps, float *fp, int *ip, bool needsMetadata);

public:
bool bypassAnyway{false};

size_t preReserveSize[16]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
size_t preReserveSingleInstanceSize[16]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

Expand Down
3 changes: 3 additions & 0 deletions src/dsp/processor/routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ inline void runSingleProcessor(int i, float fpitch, Processor *processors[engine
Mix &outLev, Endpoints *endpoints, bool &chainIsMono,
float input[2][N], float output[2][N])
{
if (processors[i]->bypassAnyway)
return;

namespace mech = sst::basic_blocks::mechanics;

float tempbuf alignas(16)[2][N];
Expand Down
9 changes: 9 additions & 0 deletions src/engine/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ template <bool OS> void Group::processWithOS(scxt::engine::Engine &e)

if (processors[0] || processors[1] || processors[2] || processors[3])
{
for (int i = 0; i < processorsPerZoneAndGroup; ++i)
{
if (processors[i])
{
memcpy(&processorIntParams[i][0], processorStorage[i].intParams.data(),
sizeof(processorIntParams[i]));
processors[i]->bypassAnyway = !processorStorage[i].isActive;
}
}

#define CALL_ROUTE(FNN) \
if constexpr (OS) \
Expand Down
47 changes: 46 additions & 1 deletion src/voice/voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,51 @@ template <bool OS> bool Voice::processWithOS()
} \
}

if (processors[0] || processors[1] || processors[2] || processors[3])
/*
* This is all voice time type reset logic basically.
*/
bool hasProcs{false};
for (int i = 0; i < processorsPerZoneAndGroup; ++i)
{
auto proct = processors[i] ? processors[i]->getType() : dsp::processor::proct_none;
if (zone->processorStorage[i].type != proct)
{
if (processors[i])
dsp::processor::unspawnProcessor(processors[i]);
processors[i] = nullptr;
proct = zone->processorStorage[i].type;
}

if (!processors[i] && zone->processorStorage[i].isActive &&
zone->processorStorage[i].type != dsp::processor::proct_none)
{
processorType[i] = proct;
// this is copied below in the init.
processors[i] = dsp::processor::spawnProcessorInPlace(
processorType[i], zone->getEngine()->getMemoryPool().get(),
processorPlacementStorage[i], dsp::processor::processorMemoryBufferSize,
zone->processorStorage[i], endpoints->processorTarget[i].fp, processorIntParams[i],
forceOversample, false);

processors[i]->setSampleRate(sampleRate * (forceOversample ? 2 : 1));
processors[i]->setTempoPointer(&(zone->getEngine()->transport.tempo));

processors[i]->init();
processors[i]->setKeytrack(zone->processorStorage[i].isKeytracked);

processorConsumesMono[i] = monoGenerator && processors[i]->canProcessMono();
}
if (processors[i])
{
memcpy(&processorIntParams[i][0], zone->processorStorage[i].intParams.data(),
sizeof(processorIntParams[i]));
processors[i]->bypassAnyway = !zone->processorStorage[i].isActive;
}

hasProcs = hasProcs || processors[i];
}

if (hasProcs)
{
switch (zone->outputInfo.procRouting)
{
Expand Down Expand Up @@ -689,6 +733,7 @@ void Voice::initializeProcessors()
if ((processorIsActive[i] && processorType[i] != dsp::processor::proct_none) ||
(processorType[i] == dsp::processor::proct_none && !processorIsActive[i]))
{
// this init code is partly copied above in the voice state toggle
processors[i] = dsp::processor::spawnProcessorInPlace(
processorType[i], zone->getEngine()->getMemoryPool().get(),
processorPlacementStorage[i], dsp::processor::processorMemoryBufferSize,
Expand Down
Loading