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

Add 'Linear' and 'ZOH' resampler options #149

Merged
merged 1 commit into from
Jan 20, 2025
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
4 changes: 3 additions & 1 deletion src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ enum ResamplerEngine
SRC_FAST,
SRC_MEDIUM,
SRC_BEST,
LANCZOS
LANCZOS,
LINTERP,
ZOH
};

} // namespace baconpaul::six_sines
Expand Down
4 changes: 3 additions & 1 deletion src/synth/patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -1146,13 +1146,15 @@ struct Patch : pats::PatchBase<Patch, Param>
.withName(name() + " Resampler Engine")
.withGroupName(name())
.withDefault(ResamplerEngine::SRC_FAST)
.withRange(ResamplerEngine::SRC_FAST, ResamplerEngine::LANCZOS)
.withRange(ResamplerEngine::SRC_FAST, ResamplerEngine::ZOH)
.withID(id(41))
.withUnorderedMapFormatting({
{ResamplerEngine::SRC_FAST, "SRC Fast (rec)"},
{ResamplerEngine::SRC_MEDIUM, "SRC Medium"},
{ResamplerEngine::SRC_BEST, "SRC Expensive"},
{ResamplerEngine::LANCZOS, "Lanczos A=4"},
{ResamplerEngine::LINTERP, "Linear Interp"},
{ResamplerEngine::ZOH, "ZOH"},
})),
ModulationMixin(name(), id(120)),
modtarget(scpu::make_array_lambda<Param, numModsPer>(
Expand Down
12 changes: 11 additions & 1 deletion src/synth/synth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,21 @@ void Synth::setSampleRate(double sampleRate)
SXSNLOG("Setting SRC Resampler - SRC_SINC_MEDIUM_QUALITY");
mode = SRC_SINC_MEDIUM_QUALITY;
}
if (resamplerEngine == SRC_BEST)
else if (resamplerEngine == SRC_BEST)
{
SXSNLOG("Setting SRC Resampler - SRC_SINC_BEST_QUALITY");
mode = SRC_SINC_BEST_QUALITY;
}
else if (resamplerEngine == LINTERP)
{
SXSNLOG("Setting SRC Resampler - SRC_LINEAR");
mode = SRC_LINEAR;
}
else if (resamplerEngine == ZOH)
{
SXSNLOG("Setting SRC Resampler - SRC_ZERO_ORDER_HOLD");
mode = SRC_ZERO_ORDER_HOLD;
}
else
{
SXSNLOG("Setting SRC Resampler - SRC_SINC_FASTEST");
Expand Down
Loading