21#include <wx/checkbox.h>
23#include <wx/spinctrl.h>
27#include "../widgets/valnum.h"
52 {
XO(
"Acoustic"), { 50, 10, 75, 100, 21, 100, -14, 0, 80,
false } },
54 {
XO(
"Ambience"), { 100, 55, 100, 50, 53, 38, 0, -10, 100,
false } },
56 {
XO(
"Artificial"), { 81, 99, 23, 62, 16, 19, -4, 0, 100,
false } },
58 {
XO(
"Clean"), { 50, 10, 75, 100, 55, 100, -18, 0, 75,
false } },
60 {
XO(
"Modern"), { 50, 10, 75, 100, 55, 100, -15, 0, 75,
false } },
63 {
XO(
"Vocal I" ), { 70, 20, 40, 99, 100, 50, -12, 0, 70,
false } },
65 {
XO(
"Vocal II"), { 50, 0, 50, 99, 50, 100, -1, -1, 70,
false } },
67 {
XO(
"Dance Vocal"), { 90, 2, 60, 77, 30, 51, -10, 0, 100,
false } },
69 {
XO(
"Modern Vocal"), { 66, 27, 77, 8, 0, 51, -10, 0, 68,
false } },
71 {
XO(
"Voice Tail"), { 66, 27, 100, 8, 0, 51, -6, 0, 68,
false } },
74 {
XO(
"Bathroom"), { 16, 8, 80, 0, 0, 100, -6, 0, 100,
false } },
76 {
XO(
"Small Room Bright"), { 30, 10, 50, 50, 50, 100, -1, -1, 100,
false } },
78 {
XO(
"Small Room Dark"), { 30, 10, 50, 50, 100, 0, -1, -1, 100,
false } },
80 {
XO(
"Medium Room"), { 75, 10, 40, 50, 100, 70, -1, -1, 70,
false } },
82 {
XO(
"Large Room"), { 85, 10, 40, 50, 100, 80, 0, -6, 90,
false } },
84 {
XO(
"Church Hall"), { 90, 32, 60, 50, 100, 50, 0, -12, 100,
false } },
86 {
XO(
"Cathedral"), { 90, 16, 90, 50, 100, 0, 0, -20, 100,
false } },
88 {
XO(
"Big Cave"), { 100, 55, 100, 50, 53, 38, 5, -3, 100,
false } },
110 std::unique_ptr<Reverb_priv_ex[]>
mP{};
143#define SpinSlider(n) \
144 wxSpinCtrl *m ## n ## T; \
145 wxSlider *m ## n ## S;
159 wxCheckBox* mWetOnlyC;
162#define SpinSliderHandlers(n) \
163 void On ## n ## Slider(wxCommandEvent & evt); \
164 void On ## n ## Text(wxCommandEvent & evt);
176#undef SpinSliderHandlers
178 void OnCheckbox(wxCommandEvent &evt);
188 rs.mPreDelay = mPreDelayS->GetValue();
189 rs.mReverberance = mReverberanceS->GetValue();
190 rs.mHfDamping = mHfDampingS->GetValue();
191 rs.mToneLow = mToneLowS->GetValue();
192 rs.mToneHigh = mToneHighS->GetValue();
193 rs.mWetGain = mWetGainS->GetValue();
194 rs.mDryGain = mDryGainS->GetValue();
195 rs.mStereoWidth = mStereoWidthS->GetValue();
196 rs.mWetOnly = mWetOnlyC->GetValue();
225 const float*
const* inBlock,
float*
const* outBlock,
size_t blockLen)
override;
243 unsigned numChannels,
float sampleRate)
override
251 slave.
mState,
nullptr, (numChannels == 2));
253 mSlaves.push_back( std::move(slave) );
264 const float*
const* inbuf,
float*
const* outbuf,
size_t numSamples)
override
274 for (
unsigned int i = 0; i < slave.mState.mNumChans; i++)
276 auto& reverbCore = slave.mState.mP[i].reverb;
277 const auto& is = incomingSettings;
282 is.mWetGain, is.mReverberance, is.mHfDamping, is.mToneLow, is.mToneHigh);
288 is.mWetGain, is.mRoomSize, is.mReverberance, is.mHfDamping,
289 is.mPreDelay, is.mStereoWidth, is.mToneLow, is.mToneHigh );
308 for (
unsigned int i = 0; i < slave.mState.mNumChans; i++)
332 const float*
const* inBlock,
float*
const* outBlock,
size_t blockLen);
345std::shared_ptr<EffectInstance>
348 return std::make_shared<Instance>(*
this);
370 return XO(
"Adds ambience or a \"hall effect\"");
397 mChannels = rs.mStereoWidth ? 2 : 1;
410 bool isStereo =
false;
419 state.
mP = std::make_unique<Reverb_priv_ex[]>(state.
mNumChans);
421 for (
unsigned int i = 0; i < state.
mNumChans; i++)
430 rs.mStereoWidth * (isStereo ? 1 : 0),
446 const float*
const* inBlock,
float*
const* outBlock,
size_t blockLen)
448 return InstanceProcess(
settings,
mState, inBlock, outBlock, blockLen);
452 const float*
const* inBlock,
float*
const* outBlock,
size_t blockLen)
456 const float *ichans[2] = {NULL, NULL};
457 float *ochans[2] = {NULL, NULL};
459 for (
unsigned int c = 0; c < state.
mNumChans; c++)
461 ichans[c] = inBlock[c];
462 ochans[c] = outBlock[c];
465 float const dryMult = rs.mWetOnly ? 0 :
dB_to_linear(rs.mDryGain);
467 auto remaining = blockLen;
472 for (
unsigned int c = 0; c < state.
mNumChans; c++)
476 state.
mP[c].dry = (
float *)
fifo_write(&state.
mP[c].reverb.input_fifo, len, ichans[c]);
482 for (
decltype(len) i = 0; i < len; i++)
484 for (
int w = 0; w < 2; w++)
486 ochans[w][i] = dryMult *
489 (state.
mP[0].wet[w][i] + state.
mP[1].wet[w][i]);
495 for (
decltype(len) i = 0; i < len; i++)
497 ochans[0][i] = dryMult *
499 state.
mP[0].wet[0][i];
505 for (
unsigned int c = 0; c < state.
mNumChans; c++)
549 auto result = std::make_unique<Editor>(*
this, access, myEffSettings);
550 result->PopulateOrExchange(
S);
559 S.StartMultiColumn(3, wxEXPAND);
563#define SpinSlider(n, p) \
564 m ## n ## T = S.AddSpinCtrl( p, n.def, n.max, n.min); \
565 BindTo(*m ## n ## T, wxEVT_SPINCTRL, &Editor::On ## n ## Text);\
567 m ## n ## S = S.Style(wxSL_HORIZONTAL).AddSlider( {}, n.def, n.max, n.min); \
568 BindTo(*m ## n ## S, wxEVT_SLIDER, &Editor::On ## n ## Slider);
585 S.StartHorizontalLay(wxCENTER,
false);
589 BindTo(*mWetOnlyC, wxEVT_CHECKBOX, &Editor::OnCheckbox);
591 S.EndHorizontalLay();
600 auto& rs = mSettings;
602#define SetSpinSlider(n) \
603 m ## n ## S->SetValue((int) rs.m ## n); \
604 m ## n ## T->SetValue(wxString::Format(wxT("%d"), (int) rs.m ## n));
618 mWetOnlyC->SetValue((
int) rs.mWetOnly);
624#define SpinSliderHandlers(n) \
625 void EffectReverb::Editor::On ## n ## Slider(wxCommandEvent & evt) \
627 if (mProcessingEvent) return; \
628 mProcessingEvent = true; \
629 m ## n ## T->SetValue(wxString::Format(wxT("%d"), evt.GetInt())); \
630 mProcessingEvent = false; \
632 Publish(EffectSettingChanged{}); \
634 void EffectReverb::Editor::On ## n ## Text(wxCommandEvent & evt) \
636 if (mProcessingEvent) return; \
637 mProcessingEvent = true; \
638 m ## n ## S->SetValue(std::clamp<long>(evt.GetInt(), n.min, n.max)); \
639 mProcessingEvent = false; \
641 Publish(EffectSettingChanged{}); \
654void EffectReverb::Editor::OnCheckbox(wxCommandEvent &evt)
660#undef SpinSliderHandlers
684 const bool oneSimpleParameterChanged =
693 const bool allNonSimpleParametersStayedTheSame =
699 return oneSimpleParameterChanged && allNonSimpleParametersStayedTheSame;
std::optional< std::unique_ptr< EffectSettingsAccess::Message > > OptionalMessage
XXO("&Cut/Copy/Paste Toolbar")
std::vector< RegistryPath > RegistryPaths
static const struct @29 FactoryPresets[]
#define SpinSliderHandlers(n)
EffectReverbSettings preset
bool operator==(const EffectReverbSettings &a, const EffectReverbSettings &b)
bool OnlySimpleParametersChanged(const EffectReverbSettings &a, const EffectReverbSettings &b)
const TranslatableString name
static void reverb_init(reverb_t *p, double sample_rate_Hz, double wet_gain_dB, double room_scale, double reverberance, double hf_damping, double pre_delay_ms, double stereo_depth, double tone_low, double tone_high)
static void reverb_set_simple_params(reverb_t *p, double sample_rate_Hz, double wet_gain_dB, double reverberance, double hf_damping, double tone_low, double tone_high)
static void reverb_process(reverb_t *p, size_t length)
static void reverb_delete(reverb_t *p)
static void reverb_clear(reverb_t *p)
static void reverb_create(reverb_t *p, double sample_rate_Hz, double wet_gain_dB, double room_scale, double reverberance, double hf_damping, double pre_delay_ms, double stereo_depth, double tone_low, double tone_high, size_t buffer_size, float **out)
static void * fifo_write(fifo_t *f, FIFO_SIZE_T n, void const *data)
static Settings & settings()
bool ValidateUI(const EffectPlugin &context, EffectSettings &) const override
Generates EffectParameterMethods overrides from variadic template arguments.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
void SetLinearEffectFlag(bool linearEffectFlag)
RealtimeSince
In which versions of Audacity was an effect realtime capable?
EffectSettingsAccess & mAccess
Performs effect computation.
Inherit to add a state variable to an EffectInstance subclass.
size_t SetBlockSize(size_t maxBlockSize) override
Hold values to send to effect output meters.
Interface for manipulations of an Effect's settings.
const EffectParameterMethods & Parameters() const override
RealtimeSince RealtimeSupport() const override
Since which version of Audacity has the effect supported realtime?
OptionalMessage LoadFactoryPreset(int id, EffectSettings &settings) const override
EffectType GetType() const override
Type determines how it behaves.
static constexpr EffectParameter ToneLow
static constexpr EffectParameter PreDelay
std::unique_ptr< EffectEditor > MakeEditor(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const override
Called only from PopulateUI, to add controls to effect panel.
static constexpr EffectParameter RoomSize
ComponentInterfaceSymbol GetSymbol() const override
static constexpr EffectParameter StereoWidth
static const ComponentInterfaceSymbol Symbol
static constexpr EffectParameter Reverberance
static constexpr EffectParameter WetGain
static constexpr EffectParameter HfDamping
static constexpr EffectParameter ToneHigh
static constexpr EffectParameter WetOnly
TranslatableString GetDescription() const override
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
static constexpr EffectParameter DryGain
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
RegistryPaths GetFactoryPresets() const override
Report names of factory presets.
void ModifySettings(Function &&function)
Do a correct read-modify-write of settings.
virtual const EffectSettings & Get()=0
static EffectReverbSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
const PerTrackEffect & mProcessor
Base class for many of the effects in Audacity.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
constexpr auto sampleRate
BuiltinEffectsModule::Registration< EffectReverb > reg
const Type def
Default value.
SpinSlider(RoomSize) SpinSlider(PreDelay) SpinSlider(Reverberance) SpinSlider(HfDamping) SpinSlider(ToneLow) SpinSlider(ToneHigh) SpinSlider(WetGain) SpinSlider(DryGain) SpinSlider(StereoWidth) wxCheckBox *mWetOnlyC
bool UpdateUI() override
Update appearance of the panel for changes in settings.
EffectReverbSettings mSettings
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
Editor(const EffectUIServices &services, EffectSettingsAccess &access, const EffectReverbSettings &settings)
SpinSliderHandlers(RoomSize) SpinSliderHandlers(PreDelay) SpinSliderHandlers(Reverberance) SpinSliderHandlers(HfDamping) SpinSliderHandlers(ToneLow) SpinSliderHandlers(ToneHigh) SpinSliderHandlers(WetGain) SpinSliderHandlers(DryGain) SpinSliderHandlers(StereoWidth) void OnCheckbox(wxCommandEvent &evt)
void PopulateOrExchange(ShuttleGui &S)
virtual ~Editor()=default
unsigned GetAudioOutCount() const override
How many output buffers to allocate at once.
bool ProcessInitialize(EffectSettings &settings, double sampleRate, ChannelNames chanMap) override
size_t RealtimeProcess(size_t group, EffectSettings &settings, const float *const *inbuf, float *const *outbuf, size_t numSamples) override
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
EffectReverbSettings mLastAppliedSettings
bool InstanceInit(EffectSettings &settings, double sampleRate, EffectReverbState &data, ChannelNames chanMap, bool forceStereo)
size_t ProcessBlock(EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
Called for destructive effect computation.
size_t InstanceProcess(EffectSettings &settings, EffectReverbState &data, const float *const *inBlock, float *const *outBlock, size_t blockLen)
std::vector< EffectReverb::Instance > mSlaves
bool RealtimeSuspend() override
bool RealtimeInitialize(EffectSettings &settings, double sampleRate) override
Instance(const PerTrackEffect &effect)
bool RealtimeAddProcessor(EffectSettings &settings, EffectOutputs *, unsigned numChannels, float sampleRate) override
bool RealtimeFinalize(EffectSettings &settings) noexcept override
bool ProcessFinalize(void) noexcept override
std::unique_ptr< Reverb_priv_ex[]> mP
Message sent by EffectEditor when a setting is changed by the user.
Externalized state of a plug-in.