winamp/Src/external_dependencies/openmpt-trunk/soundlib/plugins/dmo/Gargle.h
2024-09-24 14:54:57 +02:00

91 lines
2.5 KiB
C++

/*
* Gargle.h
* --------
* Purpose: Implementation of the DMO Gargle DSP (for non-Windows platforms)
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#ifndef NO_PLUGINS
#include "../PlugInterface.h"
OPENMPT_NAMESPACE_BEGIN
namespace DMO
{
class Gargle final : public IMixPlugin
{
protected:
enum Parameters
{
kGargleRate = 0,
kGargleWaveShape,
kGargleNumParameters
};
std::array<float, kGargleNumParameters> m_param;
uint32 m_period, m_periodHalf, m_counter; // In frames
public:
static IMixPlugin* Create(VSTPluginLib &factory, CSoundFile &sndFile, SNDMIXPLUGIN *mixStruct);
Gargle(VSTPluginLib &factory, CSoundFile &sndFile, SNDMIXPLUGIN *mixStruct);
void Release() override { delete this; }
int32 GetUID() const override { return 0xDAFD8210; }
int32 GetVersion() const override { return 0; }
void Idle() override { }
uint32 GetLatency() const override { return 0; }
void Process(float *pOutL, float *pOutR, uint32 numFrames) override;
float RenderSilence(uint32) override { return 0.0f; }
int32 GetNumPrograms() const override { return 0; }
int32 GetCurrentProgram() override { return 0; }
void SetCurrentProgram(int32) override { }
PlugParamIndex GetNumParameters() const override { return kGargleNumParameters; }
PlugParamValue GetParameter(PlugParamIndex index) override;
void SetParameter(PlugParamIndex index, PlugParamValue value) override;
void Resume() override;
void Suspend() override { m_isResumed = false; }
void PositionChanged() override { m_counter = 0; }
bool IsInstrument() const override { return false; }
bool CanRecieveMidiEvents() override { return false; }
bool ShouldProcessSilence() override { return true; }
#ifdef MODPLUG_TRACKER
CString GetDefaultEffectName() override { return _T("Gargle"); }
CString GetParamName(PlugParamIndex param) override;
CString GetParamLabel(PlugParamIndex) override;
CString GetParamDisplay(PlugParamIndex param) override;
CString GetCurrentProgramName() override { return CString(); }
void SetCurrentProgramName(const CString &) override { }
CString GetProgramName(int32) override { return CString(); }
bool HasEditor() const override { return false; }
#endif
int GetNumInputChannels() const override { return 2; }
int GetNumOutputChannels() const override { return 2; }
protected:
uint32 RateInHertz() const;
void RecalculateGargleParams();
};
} // namespace DMO
OPENMPT_NAMESPACE_END
#endif // !NO_PLUGINS