Move common effect processing code to wrapper method

- Introduce `processImpl` and `sleepImpl` methods, and adapt each effect
plugin to use them
- Use double for RMS out sum in Compressor and LOMM
- Run `checkGate` for GranularPitchShifterEffect
- Minor changes to LadspaEffect
- Remove dynamic allocations and VLAs from VstEffect's process method
- Some minor style/formatting fixes
This commit is contained in:
Dalton Messmer
2024-09-01 20:01:11 -04:00
parent 35f350eeff
commit a7e8af69b7
51 changed files with 263 additions and 354 deletions

View File

@@ -98,6 +98,7 @@ public:
m_originalPluginData( originalPluginData )
{
setName();
setDontRun(true);
}
~DummyEffect() override = default;
@@ -107,9 +108,9 @@ public:
return &m_controls;
}
bool processAudioBuffer( SampleFrame*, const fpp_t ) override
double processImpl(SampleFrame*, const fpp_t) override
{
return false;
return -1.0;
}
const QDomElement& originalPluginData() const

View File

@@ -63,9 +63,8 @@ public:
return "effect";
}
virtual bool processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames ) = 0;
//! Returns true if audio was processed and should continue being processed
bool processAudioBuffer(SampleFrame* buf, const fpp_t frames);
inline ch_cnt_t processorCount() const
{
@@ -175,13 +174,19 @@ public:
protected:
/**
Effects should call this at the end of audio processing
* The main audio processing method that runs when plugin is not asleep
*
* Returns the RMS output sum for use by `checkGate`,
* or -1.0 if `checkGate` should not be called
*/
virtual double processImpl(SampleFrame* buf, const fpp_t frames) = 0;
/**
* Optional method that runs when plugin is sleeping (not enabled,
* not running, not in the Okay state, or in the Don't Run state)
*/
virtual void sleepImpl() {}
If the setting "Keep effects running even without input" is disabled,
after "decay" ms of a signal below "gate", the effect is turned off
and won't be processed again until it receives new audio input
*/
void checkGate( double _out_sum );
gui::PluginView* instantiateView( QWidget * ) override;
@@ -212,6 +217,16 @@ protected:
private:
/**
Effects should call this at the end of audio processing
If the setting "Keep effects running even without input" is disabled,
after "decay" ms of a signal below "gate", the effect is turned off
and won't be processed again until it receives new audio input
*/
void checkGate( double _out_sum );
EffectChain * m_parent;
void resample( int _i, const SampleFrame* _src_buf,
sample_rate_t _src_sr,