Audacity  2.2.2
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
EffectReverb Class Referencefinal

A reverberation effect. More...

#include <Reverb.h>

Inheritance diagram for EffectReverb:
Effect EffectClientInterface EffectUIClientInterface EffectHostInterface EffectDefinitionInterface ConfigClientInterface IdentInterface ParamsInterface

Classes

struct  Params
 

Public Member Functions

 EffectReverb ()
 
virtual ~EffectReverb ()
 
IdentInterfaceSymbol GetSymbol () override
 
wxString GetDescription () override
 
wxString ManualPage () override
 
EffectType GetType () override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 
bool ProcessFinalize () override
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 
bool DefineParams (ShuttleParams &S) override
 
bool GetAutomationParameters (CommandParameters &parms) override
 
bool SetAutomationParameters (CommandParameters &parms) override
 
wxArrayString GetFactoryPresets () override
 
bool LoadFactoryPreset (int id) override
 
bool Startup () override
 
void PopulateOrExchange (ShuttleGui &S) override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
wxString GetPath () override
 
IdentInterfaceSymbol GetVendor () override
 
wxString GetVersion () override
 
IdentInterfaceSymbol GetFamilyId () override
 
bool IsInteractive () override
 
bool IsDefault () override
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 
bool SupportsAutomation () override
 
bool SetHost (EffectHostInterface *host) override
 
int GetMidiInCount () override
 
int GetMidiOutCount () override
 
sampleCount GetLatency () override
 
size_t GetTailSize () override
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
bool IsReady () override
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () override
 
bool RealtimeProcessStart () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd () override
 
bool ShowInterface (wxWindow *parent, bool forceModal=false) override
 
bool LoadUserPreset (const wxString &name) override
 
bool SaveUserPreset (const wxString &name) override
 
bool LoadFactoryDefaults () override
 
void SetHostUI (EffectUIHostInterface *host) override
 
bool PopulateUI (wxWindow *parent) override
 
bool IsGraphicalUI () override
 
bool ValidateUI () override
 
bool HideUI () override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets () override
 
void ImportPresets () override
 
bool HasOptions () override
 
void ShowOptions () override
 
double GetDefaultDuration () override
 
double GetDuration () override
 
NumericFormatId GetDurationFormat () override
 
virtual NumericFormatId GetSelectionFormat ()
 
void SetDuration (double duration) override
 
bool Apply () override
 
void Preview () override
 
wxDialog * CreateUI (wxWindow *parent, EffectUIClientInterface *client) override
 
wxString GetUserPresetsGroup (const wxString &name) override
 
wxString GetCurrentSettingsGroup () override
 
wxString GetFactoryDefaultsGroup () override
 
virtual wxString GetSavedStateGroup ()
 
bool HasSharedConfigGroup (const wxString &group) override
 
bool GetSharedConfigSubgroups (const wxString &group, wxArrayString &subgroups) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, int &value, int defval=0) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, bool &value, bool defval=false) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, float &value, float defval=0.0) override
 
bool GetSharedConfig (const wxString &group, const wxString &key, double &value, double defval=0.0) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const wxString &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const int &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const bool &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const float &value) override
 
bool SetSharedConfig (const wxString &group, const wxString &key, const double &value) override
 
bool RemoveSharedConfigSubgroup (const wxString &group) override
 
bool RemoveSharedConfig (const wxString &group, const wxString &key) override
 
bool HasPrivateConfigGroup (const wxString &group) override
 
bool GetPrivateConfigSubgroups (const wxString &group, wxArrayString &subgroups) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, wxString &value, const wxString &defval=wxEmptyString) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, int &value, int defval=0) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, bool &value, bool defval=false) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, float &value, float defval=0.0) override
 
bool GetPrivateConfig (const wxString &group, const wxString &key, double &value, double defval=0.0) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const wxString &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const int &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const bool &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const float &value) override
 
bool SetPrivateConfig (const wxString &group, const wxString &key, const double &value) override
 
bool RemovePrivateConfigSubgroup (const wxString &group) override
 
bool RemovePrivateConfig (const wxString &group, const wxString &key) override
 
virtual PluginID GetID ()
 
virtual bool Startup (EffectClientInterface *client)
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
virtual wxArrayString GetUserPresets ()
 
virtual bool HasCurrentSettings ()
 
virtual bool HasFactoryDefaults ()
 
virtual wxString GetPreset (wxWindow *parent, const wxString &parms)
 
virtual wxString HelpPage ()
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
bool DoEffect (wxWindow *parent, double projectRate, TrackList *list, TrackFactory *factory, SelectedRegion *selectedRegion, bool shouldPrompt=true)
 
bool Delegate (Effect &delegate, wxWindow *parent, bool shouldPrompt)
 
bool RealtimeAddProcessor (int group, unsigned chans, float rate)
 
size_t RealtimeProcess (int group, unsigned chans, float **inbuf, float **outbuf, size_t numSamples)
 
bool IsRealtimeActive ()
 
virtual bool IsHidden ()
 
int MessageBox (const wxString &message, long style=DefaultMessageBoxStyle, const wxString &titleStr=wxString{})
 
- Public Member Functions inherited from EffectClientInterface
virtual ~EffectClientInterface ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
- Public Member Functions inherited from IdentInterface
virtual ~IdentInterface ()
 
const wxString & GetTranslatedName ()
 
- Public Member Functions inherited from ParamsInterface
virtual ~ParamsInterface ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
- Public Member Functions inherited from EffectHostInterface
virtual ~EffectHostInterface ()
 
- Public Member Functions inherited from ConfigClientInterface
virtual ~ConfigClientInterface ()
 

Private Member Functions

void SetTitle (const wxString &name=wxT(""))
 
 SpinSlider (RoomSize) SpinSlider(PreDelay) SpinSlider(Reverberance) SpinSlider(HfDamping) SpinSlider(ToneLow) SpinSlider(ToneHigh) SpinSlider(WetGain) SpinSlider(DryGain) SpinSlider(StereoWidth) wxCheckBox *mWetOnlyC
 

Private Attributes

SpinSliderHandlers(RoomSize)
SpinSliderHandlers(PreDelay)
SpinSliderHandlers(Reverberance)
SpinSliderHandlers(HfDamping)
SpinSliderHandlers(ToneLow)
SpinSliderHandlers(ToneHigh)
SpinSliderHandlers(WetGain)
SpinSliderHandlers(DryGain)
SpinSliderHandlers(StereoWidth)
private Reverb_priv_t
mP
 
Params mParams
 
bool mProcessingEvent
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Protected Member Functions inherited from Effect
virtual bool Init ()
 
virtual bool PromptUser (wxWindow *parent)
 
virtual bool CheckWhetherSkipEffect ()
 
virtual bool Process ()
 
virtual bool ProcessPass ()
 
virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual int GetPass ()
 
virtual void End ()
 
virtual double CalcPreviewInputLength (double previewLength)
 
virtual void Preview (bool dryOnly)
 
virtual bool EnableApply (bool enable=true)
 
virtual bool EnablePreview (bool enable=true)
 
virtual void EnableDebug (bool enable=true)
 
bool TotalProgress (double frac)
 
bool TrackProgress (int whichTrack, double frac, const wxString &=wxEmptyString)
 
bool TrackGroupProgress (int whichGroup, double frac, const wxString &=wxEmptyString)
 
int GetNumWaveTracks ()
 
int GetNumWaveGroups ()
 
void GetSamples (const WaveTrack *track, sampleCount *start, sampleCount *len)
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing ()
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void CopyInputTracks ()
 
void CopyInputTracks (int trackType)
 
std::shared_ptr
< AddedAnalysisTrack
AddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
TrackAddToOutputTracks (std::unique_ptr< Track > &&t)
 
TrackListinputTracks () const
 
- Protected Attributes inherited from Effect
ProgressDialogmProgress
 
double mProjectRate
 
double mSampleRate
 
SelectedRegionmpSelectedRegion {}
 
TrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
double mF0
 
double mF1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 
sampleCount mSampleCnt
 
int mOutputTracksType
 

Detailed Description

A reverberation effect.

Definition at line 29 of file Reverb.h.

Constructor & Destructor Documentation

EffectReverb::EffectReverb ( )
EffectReverb::~EffectReverb ( )
virtual

Definition at line 127 of file Reverb.cpp.

128 {
129 }

Member Function Documentation

bool EffectReverb::DefineParams ( ShuttleParams S)
override

Definition at line 272 of file Reverb.cpp.

References EffectReverb::Params::mDryGain, EffectReverb::Params::mHfDamping, mParams, EffectReverb::Params::mPreDelay, EffectReverb::Params::mReverberance, EffectReverb::Params::mRoomSize, EffectReverb::Params::mStereoWidth, EffectReverb::Params::mToneHigh, EffectReverb::Params::mToneLow, EffectReverb::Params::mWetGain, and EffectReverb::Params::mWetOnly.

272  {
273  S.SHUTTLE_PARAM( mParams.mRoomSize, RoomSize );
274  S.SHUTTLE_PARAM( mParams.mPreDelay, PreDelay );
275  S.SHUTTLE_PARAM( mParams.mReverberance, Reverberance );
276  S.SHUTTLE_PARAM( mParams.mHfDamping, HfDamping );
277  S.SHUTTLE_PARAM( mParams.mToneLow, ToneLow );
278  S.SHUTTLE_PARAM( mParams.mToneHigh, ToneHigh );
279  S.SHUTTLE_PARAM( mParams.mWetGain, WetGain );
280  S.SHUTTLE_PARAM( mParams.mDryGain, DryGain );
281  S.SHUTTLE_PARAM( mParams.mStereoWidth, StereoWidth );
282  S.SHUTTLE_PARAM( mParams.mWetOnly, WetOnly );
283  return true;
284 }
double mStereoWidth
Definition: Reverb.h:45
double mReverberance
Definition: Reverb.h:39
Params mParams
Definition: Reverb.h:104
double mPreDelay
Definition: Reverb.h:38
double mHfDamping
Definition: Reverb.h:40
double mToneHigh
Definition: Reverb.h:42
double mRoomSize
Definition: Reverb.h:37
unsigned EffectReverb::GetAudioInCount ( )
overridevirtual

Reimplemented from Effect.

Definition at line 157 of file Reverb.cpp.

References mParams, and EffectReverb::Params::mStereoWidth.

158 {
159  return mParams.mStereoWidth ? 2 : 1;
160 }
double mStereoWidth
Definition: Reverb.h:45
Params mParams
Definition: Reverb.h:104
unsigned EffectReverb::GetAudioOutCount ( )
overridevirtual

Reimplemented from Effect.

Definition at line 162 of file Reverb.cpp.

References mParams, and EffectReverb::Params::mStereoWidth.

163 {
164  return mParams.mStereoWidth ? 2 : 1;
165 }
double mStereoWidth
Definition: Reverb.h:45
Params mParams
Definition: Reverb.h:104
bool EffectReverb::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Reimplemented from Effect.

Definition at line 286 of file Reverb.cpp.

References EffectReverb::Params::mDryGain, EffectReverb::Params::mHfDamping, mParams, EffectReverb::Params::mPreDelay, EffectReverb::Params::mReverberance, EffectReverb::Params::mRoomSize, EffectReverb::Params::mStereoWidth, EffectReverb::Params::mToneHigh, EffectReverb::Params::mToneLow, EffectReverb::Params::mWetGain, and EffectReverb::Params::mWetOnly.

287 {
288  parms.Write(KEY_RoomSize, mParams.mRoomSize);
289  parms.Write(KEY_PreDelay, mParams.mPreDelay);
290  parms.Write(KEY_Reverberance, mParams.mReverberance);
291  parms.Write(KEY_HfDamping, mParams.mHfDamping);
292  parms.Write(KEY_ToneLow, mParams.mToneLow);
293  parms.Write(KEY_ToneHigh, mParams.mToneHigh);
294  parms.Write(KEY_WetGain, mParams.mWetGain);
295  parms.Write(KEY_DryGain, mParams.mDryGain);
296  parms.Write(KEY_StereoWidth, mParams.mStereoWidth);
297  parms.Write(KEY_WetOnly, mParams.mWetOnly);
298 
299  return true;
300 }
double mStereoWidth
Definition: Reverb.h:45
double mReverberance
Definition: Reverb.h:39
Params mParams
Definition: Reverb.h:104
double mPreDelay
Definition: Reverb.h:38
double mHfDamping
Definition: Reverb.h:40
double mToneHigh
Definition: Reverb.h:42
double mRoomSize
Definition: Reverb.h:37
wxString EffectReverb::GetDescription ( )
overridevirtual

Reimplemented from Effect.

Definition at line 138 of file Reverb.cpp.

References _().

139 {
140  return _("Adds ambience or a \"hall effect\"");
141 }
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxArrayString EffectReverb::GetFactoryPresets ( )
overridevirtual

Reimplemented from Effect.

Definition at line 329 of file Reverb.cpp.

References FactoryPresets, name, and names().

330 {
331  wxArrayString names;
332 
333  for (size_t i = 0; i < WXSIZEOF(FactoryPresets); i++)
334  {
335  names.Add(wxGetTranslation(FactoryPresets[i].name));
336  }
337 
338  return names;
339 }
static wxArrayString names()
Definition: Tags.cpp:697
static const struct @35 FactoryPresets[]
const wxChar * name
Definition: Reverb.cpp:60
IdentInterfaceSymbol EffectReverb::GetSymbol ( )
overridevirtual

Reimplemented from Effect.

Definition at line 133 of file Reverb.cpp.

References REVERB_PLUGIN_SYMBOL.

134 {
135  return REVERB_PLUGIN_SYMBOL;
136 }
#define REVERB_PLUGIN_SYMBOL
Definition: Reverb.h:25
EffectType EffectReverb::GetType ( )
overridevirtual

Reimplemented from Effect.

Definition at line 150 of file Reverb.cpp.

References EffectTypeProcess.

151 {
152  return EffectTypeProcess;
153 }
bool EffectReverb::LoadFactoryPreset ( int  id)
overridevirtual

Reimplemented from Effect.

Definition at line 341 of file Reverb.cpp.

References FactoryPresets, mParams, Effect::mUIDialog, and TransferDataToWindow().

342 {
343  if (id < 0 || id >= (int) WXSIZEOF(FactoryPresets))
344  {
345  return false;
346  }
347 
348  mParams = FactoryPresets[id].params;
349 
350  if (mUIDialog)
351  {
353  }
354 
355  return true;
356 }
bool TransferDataToWindow() override
Definition: Reverb.cpp:468
static const struct @35 FactoryPresets[]
Params mParams
Definition: Reverb.h:104
wxDialog * mUIDialog
Definition: Effect.h:471
wxString EffectReverb::ManualPage ( )
overridevirtual

Reimplemented from Effect.

Definition at line 143 of file Reverb.cpp.

144 {
145  return wxT("Reverb");
146 }
void EffectReverb::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from Effect.

Definition at line 428 of file Reverb.cpp.

References _(), ShuttleGui::AddSpace(), ShuttleGuiBase::EndHorizontalLay(), ShuttleGuiBase::EndMultiColumn(), ShuttleGui::Id(), ID_WetOnly, ShuttleGuiBase::SetStretchyCol(), SpinSlider(), ShuttleGuiBase::StartHorizontalLay(), and ShuttleGuiBase::StartMultiColumn().

429 {
430  S.AddSpace(0, 5);
431 
432  S.StartMultiColumn(3, wxEXPAND);
433  {
434  S.SetStretchyCol(2);
435 
436 #define SpinSlider(n, p) \
437  m ## n ## T = S.Id(ID_ ## n). \
438  AddSpinCtrl( p, DEF_ ## n, MAX_ ## n, MIN_ ## n); \
439  S.SetStyle(wxSL_HORIZONTAL); \
440  m ## n ## S = S.Id(ID_ ## n). \
441  AddSlider( {}, DEF_ ## n, MAX_ ## n, MIN_ ## n);
442 
443  SpinSlider(RoomSize, _("&Room Size (%):"))
444  SpinSlider(PreDelay, _("&Pre-delay (ms):"))
445  SpinSlider(Reverberance, _("Rever&berance (%):"))
446  SpinSlider(HfDamping, _("Da&mping (%):"))
447  SpinSlider(ToneLow, _("Tone &Low (%):"))
448  SpinSlider(ToneHigh, _("Tone &High (%):"))
449  SpinSlider(WetGain, _("Wet &Gain (dB):"))
450  SpinSlider(DryGain, _("Dr&y Gain (dB):"))
451  SpinSlider(StereoWidth, _("Stereo Wid&th (%):"))
452 
453 #undef SpinSlider
454 
455  }
456  S.EndMultiColumn();
457 
458  S.StartHorizontalLay(wxCENTER, false);
459  {
460  mWetOnlyC = S.Id(ID_WetOnly).
461  AddCheckBox(_("Wet O&nly"), DEF_WetOnly ? wxT("true") : wxT("false"));
462  }
463  S.EndHorizontalLay();
464 
465  return;
466 }
void EndMultiColumn()
SpinSlider(RoomSize) SpinSlider(PreDelay) SpinSlider(Reverberance) SpinSlider(HfDamping) SpinSlider(ToneLow) SpinSlider(ToneHigh) SpinSlider(WetGain) SpinSlider(DryGain) SpinSlider(StereoWidth) wxCheckBox *mWetOnlyC
void EndHorizontalLay()
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
ShuttleGui & Id(int id)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxSizerItem * AddSpace(int width, int height)
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:203
size_t EffectReverb::ProcessBlock ( float **  inBlock,
float **  outBlock,
size_t  blockLen 
)
overridevirtual

Reimplemented from Effect.

Definition at line 212 of file Reverb.cpp.

References dB_to_linear, Reverb_priv_t::dry, fifo_write(), EffectReverb::Params::mDryGain, min(), mP, mParams, EffectReverb::Params::mWetOnly, reverb_process(), and Reverb_priv_t::wet.

213 {
214  float *ichans[2] = {NULL, NULL};
215  float *ochans[2] = {NULL, NULL};
216 
217  for (unsigned int c = 0; c < mNumChans; c++)
218  {
219  ichans[c] = inBlock[c];
220  ochans[c] = outBlock[c];
221  }
222 
223  float const dryMult = mParams.mWetOnly ? 0 : dB_to_linear(mParams.mDryGain);
224 
225  auto remaining = blockLen;
226 
227  while (remaining)
228  {
229  auto len = std::min(remaining, decltype(remaining)(BLOCK));
230  for (unsigned int c = 0; c < mNumChans; c++)
231  {
232  // Write the input samples to the reverb fifo. Returned value is the address of the
233  // fifo buffer which contains a copy of the input samples.
234  mP[c].dry = (float *) fifo_write(&mP[c].reverb.input_fifo, len, ichans[c]);
235  reverb_process(&mP[c].reverb, len);
236  }
237 
238  if (mNumChans == 2)
239  {
240  for (decltype(len) i = 0; i < len; i++)
241  {
242  for (int w = 0; w < 2; w++)
243  {
244  ochans[w][i] = dryMult *
245  mP[w].dry[i] +
246  0.5 *
247  (mP[0].wet[w][i] + mP[1].wet[w][i]);
248  }
249  }
250  }
251  else
252  {
253  for (decltype(len) i = 0; i < len; i++)
254  {
255  ochans[0][i] = dryMult *
256  mP[0].dry[i] +
257  mP[0].wet[0][i];
258  }
259  }
260 
261  remaining -= len;
262 
263  for (unsigned int c = 0; c < mNumChans; c++)
264  {
265  ichans[c] += len;
266  ochans[c] += len;
267  }
268  }
269 
270  return blockLen;
271 }
float * dry
Definition: Reverb.cpp:81
static void reverb_process(reverb_t *p, size_t length)
#define dB_to_linear(x)
Definition: Reverb_libSoX.h:27
int min(int a, int b)
Params mParams
Definition: Reverb.h:104
SpinSliderHandlers(RoomSize) SpinSliderHandlers(PreDelay) SpinSliderHandlers(Reverberance) SpinSliderHandlers(HfDamping) SpinSliderHandlers(ToneLow) SpinSliderHandlers(ToneHigh) SpinSliderHandlers(WetGain) SpinSliderHandlers(DryGain) SpinSliderHandlers(StereoWidth) private Reverb_priv_t * mP
Definition: Reverb.h:88
float * wet[2]
Definition: Reverb.cpp:82
static void * fifo_write(fifo_t *f, FIFO_SIZE_T n, void const *data)
Definition: Reverb_libSoX.h:74
static size_t BLOCK
Definition: Reverb.cpp:167
bool EffectReverb::ProcessFinalize ( )
overridevirtual

Reimplemented from Effect.

Definition at line 200 of file Reverb.cpp.

References mP, and reverb_delete().

201 {
202  for (unsigned int i = 0; i < mNumChans; i++)
203  {
204  reverb_delete(&mP[i].reverb);
205  }
206 
207  free(mP);
208 
209  return true;
210 }
static void reverb_delete(reverb_t *p)
SpinSliderHandlers(RoomSize) SpinSliderHandlers(PreDelay) SpinSliderHandlers(Reverberance) SpinSliderHandlers(HfDamping) SpinSliderHandlers(ToneLow) SpinSliderHandlers(ToneHigh) SpinSliderHandlers(WetGain) SpinSliderHandlers(DryGain) SpinSliderHandlers(StereoWidth) private Reverb_priv_t * mP
Definition: Reverb.h:88
bool EffectReverb::ProcessInitialize ( sampleCount  totalLen,
ChannelNames  chanMap = NULL 
)
overridevirtual

Reimplemented from Effect.

Definition at line 169 of file Reverb.cpp.

References ChannelNameEOL, ChannelNameFrontRight, EffectReverb::Params::mHfDamping, mP, mParams, EffectReverb::Params::mPreDelay, EffectReverb::Params::mReverberance, EffectReverb::Params::mRoomSize, Effect::mSampleRate, EffectReverb::Params::mStereoWidth, EffectReverb::Params::mToneHigh, EffectReverb::Params::mToneLow, EffectReverb::Params::mWetGain, reverb_create(), and Reverb_priv_t::wet.

170 {
171  bool isStereo = false;
172  mNumChans = 1;
173  if (chanMap && chanMap[0] != ChannelNameEOL && chanMap[1] == ChannelNameFrontRight)
174  {
175  isStereo = true;
176  mNumChans = 2;
177  }
178 
179  mP = (Reverb_priv_t *) calloc(sizeof(*mP), mNumChans);
180 
181  for (unsigned int i = 0; i < mNumChans; i++)
182  {
183  reverb_create(&mP[i].reverb,
184  mSampleRate,
190  mParams.mStereoWidth * (isStereo ? 1 : 0),
193  BLOCK,
194  mP[i].wet);
195  }
196 
197  return true;
198 }
double mSampleRate
Definition: Effect.h:455
double mStereoWidth
Definition: Reverb.h:45
double mReverberance
Definition: Reverb.h:39
Params mParams
Definition: Reverb.h:104
double mPreDelay
Definition: Reverb.h:38
double mHfDamping
Definition: Reverb.h:40
SpinSliderHandlers(RoomSize) SpinSliderHandlers(PreDelay) SpinSliderHandlers(Reverberance) SpinSliderHandlers(HfDamping) SpinSliderHandlers(ToneLow) SpinSliderHandlers(ToneHigh) SpinSliderHandlers(WetGain) SpinSliderHandlers(DryGain) SpinSliderHandlers(StereoWidth) private Reverb_priv_t * mP
Definition: Reverb.h:88
double mToneHigh
Definition: Reverb.h:42
float * wet[2]
Definition: Reverb.cpp:82
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)
double mRoomSize
Definition: Reverb.h:37
static size_t BLOCK
Definition: Reverb.cpp:167
bool EffectReverb::SetAutomationParameters ( CommandParameters parms)
overridevirtual

Reimplemented from Effect.

Definition at line 302 of file Reverb.cpp.

References EffectReverb::Params::mDryGain, EffectReverb::Params::mHfDamping, mParams, EffectReverb::Params::mPreDelay, EffectReverb::Params::mReverberance, EffectReverb::Params::mRoomSize, EffectReverb::Params::mStereoWidth, EffectReverb::Params::mToneHigh, EffectReverb::Params::mToneLow, EffectReverb::Params::mWetGain, EffectReverb::Params::mWetOnly, ReadAndVerifyBool, and ReadAndVerifyDouble.

303 {
304  ReadAndVerifyDouble(RoomSize);
305  ReadAndVerifyDouble(PreDelay);
306  ReadAndVerifyDouble(Reverberance);
307  ReadAndVerifyDouble(HfDamping);
308  ReadAndVerifyDouble(ToneLow);
309  ReadAndVerifyDouble(ToneHigh);
310  ReadAndVerifyDouble(WetGain);
311  ReadAndVerifyDouble(DryGain);
312  ReadAndVerifyDouble(StereoWidth);
313  ReadAndVerifyBool(WetOnly);
314 
315  mParams.mRoomSize = RoomSize;
316  mParams.mPreDelay = PreDelay;
317  mParams.mReverberance = Reverberance;
318  mParams.mHfDamping = HfDamping;
319  mParams.mToneLow = ToneLow;
320  mParams.mToneHigh = ToneHigh;
321  mParams.mWetGain = WetGain;
322  mParams.mDryGain = DryGain;
323  mParams.mStereoWidth = StereoWidth;
324  mParams.mWetOnly = WetOnly;
325 
326  return true;
327 }
#define ReadAndVerifyDouble(name)
Definition: Effect.h:798
double mStereoWidth
Definition: Reverb.h:45
double mReverberance
Definition: Reverb.h:39
Params mParams
Definition: Reverb.h:104
double mPreDelay
Definition: Reverb.h:38
double mHfDamping
Definition: Reverb.h:40
double mToneHigh
Definition: Reverb.h:42
#define ReadAndVerifyBool(name)
Definition: Effect.h:800
double mRoomSize
Definition: Reverb.h:37
void EffectReverb::SetTitle ( const wxString &  name = wxT(""))
private
EffectReverb::SpinSlider ( RoomSize  )
private

Referenced by PopulateOrExchange().

bool EffectReverb::Startup ( )
overridevirtual

Reimplemented from Effect.

Definition at line 360 of file Reverb.cpp.

References Effect::GetCurrentSettingsGroup(), Effect::GetUserPresetsGroup(), gPrefs, EffectReverb::Params::mDryGain, EffectReverb::Params::mHfDamping, mParams, EffectReverb::Params::mPreDelay, EffectReverb::Params::mReverberance, EffectReverb::Params::mRoomSize, EffectReverb::Params::mStereoWidth, EffectReverb::Params::mToneHigh, EffectReverb::Params::mToneLow, EffectReverb::Params::mWetGain, EffectReverb::Params::mWetOnly, name, and Effect::SaveUserPreset().

361 {
362  wxString base = wxT("/Effects/Reverb/");
363 
364  // Migrate settings from 2.1.0 or before
365 
366  // Already migrated, so bail
367  if (gPrefs->Exists(base + wxT("Migrated")))
368  {
369  return true;
370  }
371 
372  // Load the old "current" settings
373  if (gPrefs->Exists(base))
374  {
375  gPrefs->Read(base + wxT("RoomSize"), &mParams.mRoomSize, DEF_RoomSize);
376  gPrefs->Read(base + wxT("Delay"), &mParams.mPreDelay, DEF_PreDelay);
377  gPrefs->Read(base + wxT("Reverberance"), &mParams.mReverberance, DEF_Reverberance);
378  gPrefs->Read(base + wxT("HfDamping"), &mParams.mHfDamping, DEF_HfDamping);
379  gPrefs->Read(base + wxT("ToneLow"), &mParams.mToneLow, DEF_ToneLow);
380  gPrefs->Read(base + wxT("ToneHigh"), &mParams.mToneHigh, DEF_ToneHigh);
381  gPrefs->Read(base + wxT("WetGain"), &mParams.mWetGain, DEF_WetGain);
382  gPrefs->Read(base + wxT("DryGain"), &mParams.mDryGain, DEF_DryGain);
383  gPrefs->Read(base + wxT("StereoWidth"), &mParams.mStereoWidth, DEF_StereoWidth);
384  gPrefs->Read(base + wxT("WetOnly"), &mParams.mWetOnly, DEF_WetOnly);
385 
387 
388  // Do not migrate again
389  gPrefs->Write(base + wxT("Migrated"), true);
390  }
391 
392  // Load the previous user presets
393  for (int i = 0; i < 10; i++)
394  {
395  wxString path = base + wxString::Format(wxT("%d/"), i);
396  if (gPrefs->Exists(path))
397  {
398  Params save = mParams;
399  wxString name;
400 
401  gPrefs->Read(path + wxT("RoomSize"), &mParams.mRoomSize, DEF_RoomSize);
402  gPrefs->Read(path + wxT("Delay"), &mParams.mPreDelay, DEF_PreDelay);
403  gPrefs->Read(path + wxT("Reverberance"), &mParams.mReverberance, DEF_Reverberance);
404  gPrefs->Read(path + wxT("HfDamping"), &mParams.mHfDamping, DEF_HfDamping);
405  gPrefs->Read(path + wxT("ToneLow"), &mParams.mToneLow, DEF_ToneLow);
406  gPrefs->Read(path + wxT("ToneHigh"), &mParams.mToneHigh, DEF_ToneHigh);
407  gPrefs->Read(path + wxT("WetGain"), &mParams.mWetGain, DEF_WetGain);
408  gPrefs->Read(path + wxT("DryGain"), &mParams.mDryGain, DEF_DryGain);
409  gPrefs->Read(path + wxT("StereoWidth"), &mParams.mStereoWidth, DEF_StereoWidth);
410  gPrefs->Read(path + wxT("WetOnly"), &mParams.mWetOnly, DEF_WetOnly);
411  gPrefs->Read(path + wxT("name"), &name, wxEmptyString);
412 
413  if (!name.IsEmpty())
414  {
415  name.Prepend(wxT(" - "));
416  }
417  name.Prepend(wxString::Format(wxT("Settings%d"), i));
418 
420 
421  mParams = save;
422  }
423  }
424 
425  return true;
426 }
wxString GetUserPresetsGroup(const wxString &name) override
Definition: Effect.cpp:790
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
bool SaveUserPreset(const wxString &name) override
Definition: Effect.cpp:600
wxString GetCurrentSettingsGroup() override
Definition: Effect.cpp:801
double mStereoWidth
Definition: Reverb.h:45
double mReverberance
Definition: Reverb.h:39
Params mParams
Definition: Reverb.h:104
double mPreDelay
Definition: Reverb.h:38
double mHfDamping
Definition: Reverb.h:40
double mToneHigh
Definition: Reverb.h:42
const wxChar * name
Definition: Reverb.cpp:60
double mRoomSize
Definition: Reverb.h:37
bool EffectReverb::TransferDataFromWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 491 of file Reverb.cpp.

References EffectReverb::Params::mDryGain, EffectReverb::Params::mHfDamping, mParams, EffectReverb::Params::mPreDelay, EffectReverb::Params::mReverberance, EffectReverb::Params::mRoomSize, EffectReverb::Params::mStereoWidth, EffectReverb::Params::mToneHigh, EffectReverb::Params::mToneLow, Effect::mUIParent, EffectReverb::Params::mWetGain, and EffectReverb::Params::mWetOnly.

492 {
493  if (!mUIParent->Validate())
494  {
495  return false;
496  }
497 
498  mParams.mRoomSize = mRoomSizeS->GetValue();
499  mParams.mPreDelay = mPreDelayS->GetValue();
500  mParams.mReverberance = mReverberanceS->GetValue();
501  mParams.mHfDamping = mHfDampingS->GetValue();
502  mParams.mToneLow = mToneLowS->GetValue();
503  mParams.mToneHigh = mToneHighS->GetValue();
504  mParams.mWetGain = mWetGainS->GetValue();
505  mParams.mDryGain = mDryGainS->GetValue();
506  mParams.mStereoWidth = mStereoWidthS->GetValue();
507  mParams.mWetOnly = mWetOnlyC->GetValue();
508 
509  return true;
510 }
double mStereoWidth
Definition: Reverb.h:45
double mReverberance
Definition: Reverb.h:39
wxWindow * mUIParent
Definition: Effect.h:472
Params mParams
Definition: Reverb.h:104
double mPreDelay
Definition: Reverb.h:38
double mHfDamping
Definition: Reverb.h:40
double mToneHigh
Definition: Reverb.h:42
double mRoomSize
Definition: Reverb.h:37
bool EffectReverb::TransferDataToWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 468 of file Reverb.cpp.

References mParams, EffectReverb::Params::mWetOnly, and SetSpinSlider.

Referenced by LoadFactoryPreset().

469 {
470 #define SetSpinSlider(n) \
471  m ## n ## S->SetValue((int) mParams.m ## n); \
472  m ## n ## T->SetValue(wxString::Format(wxT("%d"), (int) mParams.m ## n));
473 
474  SetSpinSlider(RoomSize);
475  SetSpinSlider(PreDelay);
476  SetSpinSlider(Reverberance);
477  SetSpinSlider(HfDamping);
478  SetSpinSlider(ToneLow);
479  SetSpinSlider(ToneHigh);
480  SetSpinSlider(WetGain);
481  SetSpinSlider(DryGain);
482  SetSpinSlider(StereoWidth);
483 
484 #undef SetSpinSlider
485 
486  mWetOnlyC->SetValue((int) mParams.mWetOnly);
487 
488  return true;
489 }
#define SetSpinSlider(n)
Params mParams
Definition: Reverb.h:104

Member Data Documentation

SpinSliderHandlers (RoomSize) SpinSliderHandlers(PreDelay) SpinSliderHandlers(Reverberance) SpinSliderHandlers(HfDamping) SpinSliderHandlers(ToneLow) SpinSliderHandlers(ToneHigh) SpinSliderHandlers(WetGain) SpinSliderHandlers(DryGain) SpinSliderHandlers(StereoWidth) private Reverb_priv_t* EffectReverb::mP
private

Definition at line 88 of file Reverb.h.

Referenced by ProcessBlock(), ProcessFinalize(), and ProcessInitialize().

Params EffectReverb::mParams
private
bool EffectReverb::mProcessingEvent
private

Definition at line 106 of file Reverb.h.


The documentation for this class was generated from the following files: