Prepare the coeffs initially in filter-based effects
This commit is contained in:
parent
1ba834a892
commit
98b44d7097
4 changed files with 20 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ namespace fx {
|
||||||
void Eq::setSampleRate(double sampleRate)
|
void Eq::setSampleRate(double sampleRate)
|
||||||
{
|
{
|
||||||
_filter.init(sampleRate);
|
_filter.init(sampleRate);
|
||||||
|
prepareFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Eq::setSamplesPerBlock(int samplesPerBlock)
|
void Eq::setSamplesPerBlock(int samplesPerBlock)
|
||||||
|
|
@ -46,6 +47,7 @@ namespace fx {
|
||||||
void Eq::clear()
|
void Eq::clear()
|
||||||
{
|
{
|
||||||
_filter.clear();
|
_filter.clear();
|
||||||
|
prepareFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Eq::process(const float* const inputs[], float* const outputs[], unsigned nframes)
|
void Eq::process(const float* const inputs[], float* const outputs[], unsigned nframes)
|
||||||
|
|
@ -93,5 +95,10 @@ namespace fx {
|
||||||
return absl::make_unique<Eq>(desc);
|
return absl::make_unique<Eq>(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Eq::prepareFilter()
|
||||||
|
{
|
||||||
|
_filter.prepare(_desc.frequency, _desc.bandwidth, _desc.gain);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace fx
|
} // namespace fx
|
||||||
} // namespace sfz
|
} // namespace sfz
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,9 @@ namespace fx {
|
||||||
*/
|
*/
|
||||||
static std::unique_ptr<Effect> makeInstance(absl::Span<const Opcode> members);
|
static std::unique_ptr<Effect> makeInstance(absl::Span<const Opcode> members);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void prepareFilter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sfz::FilterEq _filter;
|
sfz::FilterEq _filter;
|
||||||
EQDescription _desc;
|
EQDescription _desc;
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ namespace fx {
|
||||||
void Filter::setSampleRate(double sampleRate)
|
void Filter::setSampleRate(double sampleRate)
|
||||||
{
|
{
|
||||||
_filter.init(sampleRate);
|
_filter.init(sampleRate);
|
||||||
|
prepareFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Filter::setSamplesPerBlock(int samplesPerBlock)
|
void Filter::setSamplesPerBlock(int samplesPerBlock)
|
||||||
|
|
@ -48,6 +49,7 @@ namespace fx {
|
||||||
void Filter::clear()
|
void Filter::clear()
|
||||||
{
|
{
|
||||||
_filter.clear();
|
_filter.clear();
|
||||||
|
prepareFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Filter::process(const float* const inputs[], float* const outputs[], unsigned nframes)
|
void Filter::process(const float* const inputs[], float* const outputs[], unsigned nframes)
|
||||||
|
|
@ -96,5 +98,10 @@ namespace fx {
|
||||||
return absl::make_unique<Filter>(desc);
|
return absl::make_unique<Filter>(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Filter::prepareFilter()
|
||||||
|
{
|
||||||
|
_filter.prepare(_desc.cutoff, _desc.resonance, _desc.gain);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace fx
|
} // namespace fx
|
||||||
} // namespace sfz
|
} // namespace sfz
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,9 @@ namespace fx {
|
||||||
*/
|
*/
|
||||||
static std::unique_ptr<Effect> makeInstance(absl::Span<const Opcode> members);
|
static std::unique_ptr<Effect> makeInstance(absl::Span<const Opcode> members);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void prepareFilter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sfz::Filter _filter;
|
sfz::Filter _filter;
|
||||||
FilterDescription _desc;
|
FilterDescription _desc;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue