Skip to content

Commit

Permalink
Smooth: Jump to target value on first step
Browse files Browse the repository at this point in the history
  • Loading branch information
ideoforms committed Jul 29, 2023
1 parent 93bb4f0 commit ed3fff3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion source/src/node/processors/smooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ Smooth::Smooth(NodeRef input, NodeRef smooth)

void Smooth::alloc()
{
this->values.resize(this->num_output_channels_allocated);
this->values.resize(this->num_output_channels_allocated, std::numeric_limits<float>::max());
}

void Smooth::process(Buffer &out, int num_frames)
{
/*--------------------------------------------------------------------------------
* On first step, jump immediately to value.
*-------------------------------------------------------------------------------*/
if (values[0] == std::numeric_limits<float>::max())
{
for (int channel = 0; channel < this->num_output_channels; channel++)
{
values[channel] = input->out[channel][0];
}
}

for (int channel = 0; channel < this->num_output_channels; channel++)
{
for (int frame = 0; frame < num_frames; frame++)
Expand Down

0 comments on commit ed3fff3

Please sign in to comment.