Remove the Gate knob from effects (#8011)

Major changes:
- Remove Gate knob from effects, effectively hard coding its value to zero
- Replace effect RMS calculations with a more efficient way of detecting silent buffers
- Only perform silent buffer detection when `ProcessStatus::ContinueIfNotQuiet` is returned from a plugin AND auto-quit is enabled

Minor changes:
- Remove gate from presets
- Remove gate from .mmp projects
- Move `Effect::processorCount()` to `LadspaEffect`
- Rename `Effect::checkGate` to `Effect::handleAutoQuit`
- Adjust silence threshold for better compatibility with old RMS calculations
- Remove some unnecessary methods from `Effect`
- Reset quiet buffer count in `stopRunning`
- Use positive name for auto-quit boolean
- Simplify `m_autoQuitEnabled` initialization
This commit is contained in:
Dalton Messmer
2025-07-22 17:01:48 -04:00
committed by GitHub
parent 71ce49d7ba
commit c86fe784c7
68 changed files with 218 additions and 236 deletions

View File

@@ -26,10 +26,12 @@
#ifndef LMMS_EFFECT_H
#define LMMS_EFFECT_H
#include "Plugin.h"
#include "Engine.h"
#include <span>
#include "AudioEngine.h"
#include "AutomatableModel.h"
#include "Engine.h"
#include "Plugin.h"
#include "TempoSyncKnobModel.h"
namespace lmms
@@ -66,16 +68,6 @@ public:
//! 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
{
return m_processors;
}
inline void setProcessorCount( ch_cnt_t _processors )
{
m_processors = _processors;
}
inline bool isOkay() const
{
return m_okay;
@@ -92,14 +84,15 @@ public:
return m_running;
}
inline void startRunning()
{
m_bufferCount = 0;
m_running = true;
void startRunning()
{
m_quietBufferCount = 0;
m_running = true;
}
inline void stopRunning()
void stopRunning()
{
m_quietBufferCount = 0;
m_running = false;
}
@@ -124,27 +117,6 @@ public:
return 1.0f - m_wetDryModel.value();
}
inline float gate() const
{
const float level = m_gateModel.value();
return level*level * m_processors;
}
inline f_cnt_t bufferCount() const
{
return m_bufferCount;
}
inline void resetBufferCount()
{
m_bufferCount = 0;
}
inline void incrementBufferCount()
{
++m_bufferCount;
}
inline bool dontRun() const
{
return m_noRun;
@@ -160,6 +132,11 @@ public:
return &m_autoQuitModel;
}
bool autoQuitEnabled() const
{
return m_autoQuitEnabled;
}
EffectChain * effectChain() const
{
return m_parent;
@@ -227,11 +204,11 @@ protected:
private:
/**
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 outSum);
* If auto-quit is enabled ("Keep effects running even without input" setting is disabled),
* after "decay" ms of the output buffer remaining below the silence threshold, the effect is
* turned off and won't be processed again until it receives new audio input.
*/
void handleAutoQuit(std::span<const SampleFrame> output);
EffectChain * m_parent;
@@ -240,19 +217,18 @@ private:
SampleFrame* _dst_buf, sample_rate_t _dst_sr,
const f_cnt_t _frames );
ch_cnt_t m_processors;
bool m_okay;
bool m_noRun;
bool m_running;
f_cnt_t m_bufferCount;
//! The number of consecutive periods where output buffers remain below the silence threshold
f_cnt_t m_quietBufferCount = 0;
BoolModel m_enabledModel;
FloatModel m_wetDryModel;
FloatModel m_gateModel;
TempoSyncKnobModel m_autoQuitModel;
bool m_autoQuitDisabled;
bool m_autoQuitEnabled = false;
SRC_DATA m_srcData[2];
SRC_STATE * m_srcState[2];

View File

@@ -92,7 +92,6 @@ private:
LedCheckBox * m_bypass;
Knob * m_wetDry;
TempoSyncKnob * m_autoQuit;
Knob * m_gate;
QMdiSubWindow * m_subWindow;
EffectControlDialog * m_controlView;