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

Proc interpolation #135

Merged
merged 1 commit into from
Sep 12, 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
25 changes: 20 additions & 5 deletions include/sst/voice-effects/utilities/GainMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,35 @@ template <typename VFXConfig> struct GainMatrix : core::VoiceEffectTemplateBase<
void processStereo(float *datainL, float *datainR, float *dataoutL, float *dataoutR,
float pitch)
{

llLerp.set_target(this->getFloatParam(fpLeftToLeft));
float ll alignas(16)[VFXConfig::blockSize];
llLerp.store_block(ll);

rlLerp.set_target(this->getFloatParam(fpRightToLeft));
float rl alignas(16)[VFXConfig::blockSize];
rlLerp.store_block(rl);

rrLerp.set_target(this->getFloatParam(fpRightToRight));
float rr alignas(16)[VFXConfig::blockSize];
rrLerp.store_block(rr);

lrLerp.set_target(this->getFloatParam(fpLeftToRight));
float lr alignas(16)[VFXConfig::blockSize];
lrLerp.store_block(lr);

for (int i = 0; i < VFXConfig::blockSize; i++)
{
auto sL = datainL[i];
auto sR = datainR[i];

dataoutL[i] =
sL * this->getFloatParam(fpLeftToLeft) + sR * this->getFloatParam(fpRightToLeft);
dataoutR[i] =
sR * this->getFloatParam(fpRightToRight) + sL * this->getFloatParam(fpLeftToRight);
dataoutL[i] = sL * ll[i] + sR * rl[i];
dataoutR[i] = sR * rr[i] + sL * lr[i];
}
}

protected:
sst::basic_blocks::dsp::lipol_sse<VFXConfig::blockSize, true> volLerp, leftLerp, rightLerp;
sst::basic_blocks::dsp::lipol_sse<VFXConfig::blockSize, true> llLerp, rlLerp, rrLerp, lrLerp;
};
} // namespace sst::voice_effects::utilities
#endif // SCXT_GAINMATRIX_H
37 changes: 29 additions & 8 deletions include/sst/voice-effects/utilities/StereoTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,34 @@ template <typename VFXConfig> struct StereoTool : core::VoiceEffectTemplateBase<
void processStereo(float *datainL, float *datainR, float *dataoutL, float *dataoutR,
float pitch)
{
auto rotRadians = this->getFloatParam(fpRotation) * 0.017453292; // degrees * PI/180
auto width = this->getFloatParam(fpWidth) / 2.f;
auto side = std::min(this->getFloatParam(fpMidSide) + 1, 1.f);
auto center = 1 - this->getFloatParam(fpMidSide);
auto left = -std::min(this->getFloatParam(fpLeftRight), 0.f);
auto left1 = -std::max(this->getFloatParam(fpLeftRight) - 1, -1.f);
auto right = std::max(this->getFloatParam(fpLeftRight), 0.f);
auto right1 = std::min(1 + this->getFloatParam(fpLeftRight), 1.f);

rotLerp.set_target(this->getFloatParam(fpRotation));
float rot alignas(16)[VFXConfig::blockSize];
rotLerp.store_block(rot);

widthLerp.set_target(this->getFloatParam(fpWidth));
float w alignas(16)[VFXConfig::blockSize];
widthLerp.store_block(w);

msLerp.set_target(this->getFloatParam(fpMidSide));
float ms alignas(16)[VFXConfig::blockSize];
msLerp.store_block(ms);

lrLerp.set_target(this->getFloatParam(fpLeftRight));
float lr alignas(16)[VFXConfig::blockSize];
lrLerp.store_block(lr);

for (int i = 0; i < VFXConfig::blockSize; i++)
{
auto rotRadians = rot[i] * 0.017453292; // degrees * PI/180
auto width = w[i] / 2.f;
auto side = std::min(ms[i] + 1, 1.f);
auto center = 1 - ms[i];
auto left = -std::min(lr[i], 0.f);
auto left1 = -std::max(lr[i] - 1, -1.f);
auto right = std::max(lr[i], 0.f);
auto right1 = std::min(1 + lr[i], 1.f);

auto sL = datainL[i];
auto sR = datainR[i];

Expand Down Expand Up @@ -131,6 +148,10 @@ template <typename VFXConfig> struct StereoTool : core::VoiceEffectTemplateBase<
dataoutR[i] = sR;
}
}

protected:
sst::basic_blocks::dsp::lipol_sse<VFXConfig::blockSize, true> rotLerp, widthLerp, msLerp,
lrLerp;
};
} // namespace sst::voice_effects::utilities
#endif // SCXT_STEREOTOOL_H
Loading