Audacity  3.0.3
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
EffectPaulstretch Class Referencefinal

An Extreme Time Stretch and Time Smear effect. More...

#include <Paulstretch.h>

Inheritance diagram for EffectPaulstretch:
[legend]
Collaboration diagram for EffectPaulstretch:
[legend]

Public Member Functions

 EffectPaulstretch ()
 
virtual ~EffectPaulstretch ()
 
ComponentInterfaceSymbol GetSymbol () override
 
TranslatableString GetDescription () override
 
wxString ManualPage () override
 
EffectType GetType () override
 
bool DefineParams (ShuttleParams &S) override
 
bool GetAutomationParameters (CommandParameters &parms) override
 
bool SetAutomationParameters (CommandParameters &parms) override
 
double CalcPreviewInputLength (double previewLength) override
 
bool Process () override
 
void PopulateOrExchange (ShuttleGui &S) override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
EffectFamilySymbol GetFamily () override
 
bool IsInteractive () override
 
bool IsDefault () override
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 
bool SupportsAutomation () override
 
bool SetHost (EffectHostInterface *host) override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () 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
 
size_t GetBlockSize () const override
 
bool IsReady () override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 
bool ProcessFinalize () override
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) 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, const EffectDialogFactory &factory, bool forceModal=false) override
 
bool LoadUserPreset (const RegistryPath &name) override
 
bool SaveUserPreset (const RegistryPath &name) override
 
RegistryPaths GetFactoryPresets () override
 
bool LoadFactoryPreset (int id) override
 
bool LoadFactoryDefaults () override
 
void SetHostUI (EffectUIHostInterface *host) override
 
bool PopulateUI (ShuttleGui &S) final
 
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
 
NumericFormatSymbol GetDurationFormat () override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
void SetDuration (double duration) override
 
RegistryPath GetUserPresetsGroup (const RegistryPath &name) override
 
RegistryPath GetCurrentSettingsGroup () override
 
RegistryPath GetFactoryDefaultsGroup () override
 
virtual wxString GetSavedStateGroup ()
 
bool HasSharedConfigGroup (const RegistryPath &group) override
 
bool GetSharedConfigSubgroups (const RegistryPath &group, RegistryPaths &subgroups) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, wxString &value, const wxString &defval={}) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, int &value, int defval=0) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, bool &value, bool defval=false) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, float &value, float defval=0.0) override
 
bool GetSharedConfig (const RegistryPath &group, const RegistryPath &key, double &value, double defval=0.0) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const wxString &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const int &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const bool &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const float &value) override
 
bool SetSharedConfig (const RegistryPath &group, const RegistryPath &key, const double &value) override
 
bool RemoveSharedConfigSubgroup (const RegistryPath &group) override
 
bool RemoveSharedConfig (const RegistryPath &group, const RegistryPath &key) override
 
bool HasPrivateConfigGroup (const RegistryPath &group) override
 
bool GetPrivateConfigSubgroups (const RegistryPath &group, RegistryPaths &paths) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, wxString &value, const wxString &defval={}) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, int &value, int defval=0) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, bool &value, bool defval=false) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, float &value, float defval=0.0) override
 
bool GetPrivateConfig (const RegistryPath &group, const RegistryPath &key, double &value, double defval=0.0) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const wxString &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const int &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const bool &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const float &value) override
 
bool SetPrivateConfig (const RegistryPath &group, const RegistryPath &key, const double &value) override
 
bool RemovePrivateConfigSubgroup (const RegistryPath &group) override
 
bool RemovePrivateConfig (const RegistryPath &group, const RegistryPath &key) override
 
virtual PluginID GetID ()
 
virtual bool Startup (EffectClientInterface *client)
 
virtual bool Startup ()
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
virtual RegistryPaths GetUserPresets ()
 
virtual bool HasCurrentSettings ()
 
virtual bool HasFactoryDefaults ()
 
virtual wxString HelpPage ()
 
virtual void SetUIFlags (unsigned flags)
 
virtual unsigned TestUIFlags (unsigned mask)
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
bool DoEffect (double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={})
 
bool Delegate (Effect &delegate, wxWindow &parent, const EffectDialogFactory &factory)
 
virtual bool IsHidden ()
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
- Public Member Functions inherited from EffectClientInterface
virtual ~EffectClientInterface ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetClassification ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
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 ()
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Paulstretch") }
 
- Static Public Attributes inherited from Effect
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 

Private Member Functions

void OnText (wxCommandEvent &evt)
 
size_t GetBufferSize (double rate)
 
bool ProcessOne (WaveTrack *track, double t0, double t1, int count)
 

Private Attributes

float mAmount
 
float mTime_resolution
 
double m_t1
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
using VetoDialogHook = bool(*)(wxDialog *)
 
- Public Types inherited from EffectClientInterface
using EffectDialogFactory = std::function< wxDialog *(wxWindow &parent, EffectHostInterface *, EffectUIClientInterface *) >
 
- Static Public Member Functions inherited from Effect
static VetoDialogHook SetVetoDialogHook (VetoDialogHook hook)
 
static CommandID GetSquashedName (wxString name)
 
static void IncEffectCounter ()
 
- Protected Member Functions inherited from Effect
virtual bool Init ()
 
virtual bool CheckWhetherSkipEffect ()
 
virtual bool ProcessPass ()
 
virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual int GetPass ()
 
virtual void End ()
 
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, const TranslatableString &={})
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={})
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={})
 
int GetNumWaveTracks ()
 
int GetNumWaveGroups ()
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing ()
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
- Protected Attributes inherited from Effect
ProgressDialogmProgress
 
double mProjectRate
 
double mSampleRate
 
wxWeakRef< NotifyingSelectedRegionmpSelectedRegion {}
 
WaveTrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 
unsigned mUIFlags
 
sampleCount mSampleCnt
 
- Static Protected Attributes inherited from Effect
static int nEffectsDone =0
 

Detailed Description

An Extreme Time Stretch and Time Smear effect.

Definition at line 17 of file Paulstretch.h.

Constructor & Destructor Documentation

◆ EffectPaulstretch()

EffectPaulstretch::EffectPaulstretch ( )

Definition at line 96 of file Paulstretch.cpp.

97 {
98  mAmount = DEF_Amount;
99  mTime_resolution = DEF_Time;
100 
101  SetLinearEffectFlag(true);
102 }

◆ ~EffectPaulstretch()

EffectPaulstretch::~EffectPaulstretch ( )
virtual

Definition at line 104 of file Paulstretch.cpp.

105 {
106 }

Member Function Documentation

◆ CalcPreviewInputLength()

double EffectPaulstretch::CalcPreviewInputLength ( double  previewLength)
overridevirtual

Reimplemented from Effect.

Definition at line 160 of file Paulstretch.cpp.

161 {
162  // FIXME: Preview is currently at the project rate, but should really be
163  // at the track rate (bugs 1284 and 852).
164  auto minDuration = GetBufferSize(mProjectRate) * 2 + 1;
165 
166  // Preview playback may need to be trimmed but this is the smallest selection that we can use.
167  double minLength = std::max<double>(minDuration / mProjectRate, previewLength / mAmount);
168 
169  return minLength;
170 }

References GetBufferSize(), mAmount, and Effect::mProjectRate.

Here is the call graph for this function:

◆ DefineParams()

bool EffectPaulstretch::DefineParams ( ShuttleParams S)
override

Definition at line 133 of file Paulstretch.cpp.

133  {
134  S.SHUTTLE_PARAM( mAmount, Amount );
135  S.SHUTTLE_PARAM( mTime_resolution, Time );
136  return true;
137 }

References mAmount, mTime_resolution, and Time.

◆ GetAutomationParameters()

bool EffectPaulstretch::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Reimplemented from Effect.

Definition at line 139 of file Paulstretch.cpp.

140 {
141  parms.WriteFloat(KEY_Amount, mAmount);
142  parms.WriteFloat(KEY_Time, mTime_resolution);
143 
144  return true;
145 }

References mAmount, mTime_resolution, and CommandParameters::WriteFloat().

Here is the call graph for this function:

◆ GetBufferSize()

size_t EffectPaulstretch::GetBufferSize ( double  rate)
private

Definition at line 245 of file Paulstretch.cpp.

246 {
247  // Audacity's fft requires a power of 2
248  float tmp = rate * mTime_resolution / 2.0;
249  tmp = log(tmp) / log(2.0);
250  tmp = pow(2.0, floor(tmp + 0.5));
251 
252  auto stmp = size_t(tmp);
253  if (stmp != tmp)
254  // overflow
255  return 0;
256  if (stmp >= 2 * stmp)
257  // overflow
258  return 0;
259 
260  return std::max<size_t>(stmp, 128);
261 }

References mTime_resolution.

Referenced by CalcPreviewInputLength(), and ProcessOne().

Here is the caller graph for this function:

◆ GetDescription()

TranslatableString EffectPaulstretch::GetDescription ( )
overridevirtual

Reimplemented from Effect.

Definition at line 115 of file Paulstretch.cpp.

116 {
117  return XO("Paulstretch is only for an extreme time-stretch or \"stasis\" effect");
118 }

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol EffectPaulstretch::GetSymbol ( )
overridevirtual

Reimplemented from Effect.

Definition at line 110 of file Paulstretch.cpp.

111 {
112  return Symbol;
113 }

References Symbol.

◆ GetType()

EffectType EffectPaulstretch::GetType ( )
overridevirtual

Reimplemented from Effect.

Definition at line 127 of file Paulstretch.cpp.

128 {
129  return EffectTypeProcess;
130 }

References EffectTypeProcess.

◆ ManualPage()

wxString EffectPaulstretch::ManualPage ( )
overridevirtual

Reimplemented from Effect.

Definition at line 120 of file Paulstretch.cpp.

121 {
122  return wxT("Paulstretch");
123 }

◆ OnText()

void EffectPaulstretch::OnText ( wxCommandEvent &  evt)
private

Definition at line 240 of file Paulstretch.cpp.

241 {
242  EnableApply(mUIParent->TransferDataFromWindow());
243 }

References Effect::EnableApply(), and Effect::mUIParent.

Here is the call graph for this function:

◆ PopulateOrExchange()

void EffectPaulstretch::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from Effect.

Definition at line 199 of file Paulstretch.cpp.

200 {
201  S.StartMultiColumn(2, wxALIGN_CENTER);
202  {
203  S.Validator<FloatingPointValidator<float>>(
204  1, &mAmount, NumValidatorStyle::DEFAULT, MIN_Amount)
205  /* i18n-hint: This is how many times longer the sound will be, e.g. applying
206  * the effect to a 1-second sample, with the default Stretch Factor of 10.0
207  * will give an (approximately) 10 second sound
208  */
209  .AddTextBox(XXO("&Stretch Factor:"), wxT(""), 10);
210 
211  S.Validator<FloatingPointValidator<float>>(
212  3, &mTime_resolution, NumValidatorStyle::ONE_TRAILING_ZERO, MIN_Time)
213  .AddTextBox(XXO("&Time Resolution (seconds):"), wxT(""), 10);
214  }
215  S.EndMultiColumn();
216 };

References ShuttleGuiBase::EndMultiColumn(), mAmount, mTime_resolution, ShuttleGuiBase::StartMultiColumn(), ShuttleGui::Validator(), and XXO.

Here is the call graph for this function:

◆ Process()

bool EffectPaulstretch::Process ( )
overridevirtual

Reimplemented from Effect.

Definition at line 173 of file Paulstretch.cpp.

174 {
175  CopyInputTracks();
176  m_t1=mT1;
177  int count=0;
178  for( auto track : mOutputTracks->Selected< WaveTrack >() ) {
179  double trackStart = track->GetStartTime();
180  double trackEnd = track->GetEndTime();
181  double t0 = mT0 < trackStart? trackStart: mT0;
182  double t1 = mT1 > trackEnd? trackEnd: mT1;
183 
184  if (t1 > t0) {
185  if (!ProcessOne(track, t0,t1,count))
186  return false;
187  }
188 
189  count++;
190  }
191  mT1=m_t1;
192 
194 
195  return true;
196 }

References Effect::CopyInputTracks(), m_t1, Effect::mOutputTracks, Effect::mT0, Effect::mT1, ProcessOne(), and Effect::ReplaceProcessedTracks().

Here is the call graph for this function:

◆ ProcessOne()

bool EffectPaulstretch::ProcessOne ( WaveTrack track,
double  t0,
double  t1,
int  count 
)
private

Definition at line 263 of file Paulstretch.cpp.

264 {
265  const auto badAllocMessage =
266  XO("Requested value exceeds memory capacity.");
267 
268  const auto stretch_buf_size = GetBufferSize(track->GetRate());
269  if (stretch_buf_size == 0) {
270  ::Effect::MessageBox( badAllocMessage );
271  return false;
272  }
273 
274  double amount = this->mAmount;
275 
276  auto start = track->TimeToLongSamples(t0);
277  auto end = track->TimeToLongSamples(t1);
278  auto len = end - start;
279 
280  const auto minDuration = stretch_buf_size * 2 + 1;
281  if (minDuration < stretch_buf_size) {
282  // overflow!
283  ::Effect::MessageBox( badAllocMessage );
284  return false;
285  }
286 
287  if (len < minDuration) { //error because the selection is too short
288 
289  float maxTimeRes = log( len.as_double() ) / log(2.0);
290  maxTimeRes = pow(2.0, floor(maxTimeRes) + 0.5);
291  maxTimeRes = maxTimeRes / track->GetRate();
292 
293  if (this->IsPreviewing()) {
294  double defaultPreviewLen;
295  gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &defaultPreviewLen, 6.0);
296 
297  if ((minDuration / mProjectRate) < defaultPreviewLen) {
299  /* i18n-hint: 'Time Resolution' is the name of a control in the Paulstretch effect.*/
300  XO("Audio selection too short to preview.\n\n"
301  "Try increasing the audio selection to at least %.1f seconds,\n"
302  "or reducing the 'Time Resolution' to less than %.1f seconds.")
303  .Format(
304  (minDuration / track->GetRate()) + 0.05, // round up to 1/10 s.
305  floor(maxTimeRes * 10.0) / 10.0),
306  wxOK | wxICON_EXCLAMATION );
307  }
308  else {
310  /* i18n-hint: 'Time Resolution' is the name of a control in the Paulstretch effect.*/
311  XO("Unable to Preview.\n\n"
312  "For the current audio selection, the maximum\n"
313  "'Time Resolution' is %.1f seconds.")
314  .Format( floor(maxTimeRes * 10.0) / 10.0 ),
315  wxOK | wxICON_EXCLAMATION );
316  }
317  }
318  else {
320  /* i18n-hint: 'Time Resolution' is the name of a control in the Paulstretch effect.*/
321  XO("The 'Time Resolution' is too long for the selection.\n\n"
322  "Try increasing the audio selection to at least %.1f seconds,\n"
323  "or reducing the 'Time Resolution' to less than %.1f seconds.")
324  .Format(
325  (minDuration / track->GetRate()) + 0.05, // round up to 1/10 s.
326  floor(maxTimeRes * 10.0) / 10.0),
327  wxOK | wxICON_EXCLAMATION );
328  }
329 
330  return false;
331  }
332 
333 
334  auto dlen = len.as_double();
335  double adjust_amount = dlen /
336  (dlen - ((double)stretch_buf_size * 2.0));
337  amount = 1.0 + (amount - 1.0) * adjust_amount;
338 
339  auto outputTrack = track->EmptyCopy();
340 
341  try {
342  // This encloses all the allocations of buffers, including those in
343  // the constructor of the PaulStretch object
344 
345  PaulStretch stretch(amount, stretch_buf_size, track->GetRate());
346 
347  auto nget = stretch.get_nsamples_for_fill();
348 
349  auto bufsize = stretch.poolsize;
350  Floats buffer0{ bufsize };
351  float *bufferptr0 = buffer0.get();
352  bool first_time = true;
353 
354  const auto fade_len = std::min<size_t>(100, bufsize / 2 - 1);
355  bool cancelled = false;
356 
357  {
358  Floats fade_track_smps{ fade_len };
359  decltype(len) s=0;
360 
361  while (s < len) {
362  track->Get((samplePtr)bufferptr0, floatSample, start + s, nget);
363  stretch.process(buffer0.get(), nget);
364 
365  if (first_time) {
366  stretch.process(buffer0.get(), 0);
367  };
368 
369  s += nget;
370 
371  if (first_time){//blend the start of the selection
372  track->Get((samplePtr)fade_track_smps.get(), floatSample, start, fade_len);
373  first_time = false;
374  for (size_t i = 0; i < fade_len; i++){
375  float fi = (float)i / (float)fade_len;
376  stretch.out_buf[i] =
377  stretch.out_buf[i] * fi + (1.0 - fi) * fade_track_smps[i];
378  }
379  }
380  if (s >= len){//blend the end of the selection
381  track->Get((samplePtr)fade_track_smps.get(), floatSample, end - fade_len, fade_len);
382  for (size_t i = 0; i < fade_len; i++){
383  float fi = (float)i / (float)fade_len;
384  auto i2 = bufsize / 2 - 1 - i;
385  stretch.out_buf[i2] =
386  stretch.out_buf[i2] * fi + (1.0 - fi) *
387  fade_track_smps[fade_len - 1 - i];
388  }
389  }
390 
391  outputTrack->Append((samplePtr)stretch.out_buf.get(), floatSample, stretch.out_bufsize);
392 
393  nget = stretch.get_nsamples();
394  if (TrackProgress(count,
395  s.as_double() / len.as_double()
396  )) {
397  cancelled = true;
398  break;
399  }
400  }
401  }
402 
403  if (!cancelled){
404  outputTrack->Flush();
405 
406  track->Clear(t0,t1);
407  track->Paste(t0, outputTrack.get());
408  m_t1 = mT0 + outputTrack->GetEndTime();
409  }
410 
411  return !cancelled;
412  }
413  catch ( const std::bad_alloc& ) {
414  ::Effect::MessageBox( badAllocMessage );
415  return false;
416  }
417 };

References WaveTrack::Clear(), WaveTrack::EmptyCopy(), floatSample, WaveTrack::Get(), PaulStretch::get_nsamples(), PaulStretch::get_nsamples_for_fill(), GetBufferSize(), WaveTrack::GetRate(), gPrefs, Effect::IsPreviewing(), m_t1, mAmount, Effect::MessageBox(), Effect::mProjectRate, Effect::mT0, PaulStretch::out_buf, PaulStretch::out_bufsize, WaveTrack::Paste(), PaulStretch::poolsize, PaulStretch::process(), WaveTrack::TimeToLongSamples(), Effect::TrackProgress(), and XO.

Referenced by Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAutomationParameters()

bool EffectPaulstretch::SetAutomationParameters ( CommandParameters parms)
overridevirtual

Reimplemented from Effect.

Definition at line 147 of file Paulstretch.cpp.

148 {
149  ReadAndVerifyFloat(Amount);
151 
152  mAmount = Amount;
154 
155  return true;
156 }

References mAmount, mTime_resolution, ReadAndVerifyFloat, and Time.

◆ TransferDataFromWindow()

bool EffectPaulstretch::TransferDataFromWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 228 of file Paulstretch.cpp.

229 {
230  if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
231  {
232  return false;
233  }
234 
235  return true;
236 }

References Effect::mUIParent.

◆ TransferDataToWindow()

bool EffectPaulstretch::TransferDataToWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 218 of file Paulstretch.cpp.

219 {
220  if (!mUIParent->TransferDataToWindow())
221  {
222  return false;
223  }
224 
225  return true;
226 }

References Effect::mUIParent.

Member Data Documentation

◆ m_t1

double EffectPaulstretch::m_t1
private

Definition at line 60 of file Paulstretch.h.

Referenced by Process(), and ProcessOne().

◆ mAmount

float EffectPaulstretch::mAmount
private

◆ mTime_resolution

float EffectPaulstretch::mTime_resolution
private

◆ Symbol

const ComponentInterfaceSymbol EffectPaulstretch::Symbol { XO("Paulstretch") }
static

Definition at line 20 of file Paulstretch.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files:
Effect::IsPreviewing
bool IsPreviewing()
Definition: Effect.h:362
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:68
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:59
Effect::SetLinearEffectFlag
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:2000
Effect::EnableApply
virtual bool EnableApply(bool enable=true)
Definition: Effect.cpp:1925
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:67
EffectPaulstretch::ProcessOne
bool ProcessOne(WaveTrack *track, double t0, double t1, int count)
Definition: Paulstretch.cpp:263
Effect::MessageBox
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
Definition: Effect.cpp:2478
Effect::CopyInputTracks
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:2070
Format
Abstract base class used in importing a file.
Effect::mT1
double mT1
Definition: Effect.h:466
XO
#define XO(s)
Definition: Internat.h:32
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1212
floatSample
@ floatSample
Definition: Types.h:722
EffectPaulstretch::mAmount
float mAmount
Definition: Paulstretch.h:58
EffectPaulstretch::mTime_resolution
float mTime_resolution
Definition: Paulstretch.h:59
CommandParameters::WriteFloat
bool WriteFloat(const wxString &key, float f)
Definition: EffectAutomationParameters.h:156
EffectPaulstretch::GetBufferSize
size_t GetBufferSize(double rate)
Definition: Paulstretch.cpp:245
WaveTrack::EmptyCopy
Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory={}) const
Definition: WaveTrack.cpp:574
WaveTrack::Get
bool Get(samplePtr buffer, sampleFormat format, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
Definition: WaveTrack.cpp:1895
Effect::mProjectRate
double mProjectRate
Definition: Effect.h:457
samplePtr
char * samplePtr
Definition: Types.h:737
XXO
#define XXO(s)
Definition: Internat.h:45
WaveTrack::Clear
void Clear(double t0, double t1) override
Definition: WaveTrack.cpp:654
TrackKind::Time
@ Time
Effect::mT0
double mT0
Definition: Effect.h:465
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1203
Effect::ReplaceProcessedTracks
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:2192
WaveTrack::Paste
void Paste(double t0, const Track *src) override
Definition: WaveTrack.cpp:1171
ShuttleGui::Validator
ShuttleGui & Validator(const Factory &f)
Definition: ShuttleGui.h:685
Effect::mOutputTracks
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:464
WaveTrack::TimeToLongSamples
sampleCount TimeToLongSamples(double t0) const
Convert correctly between an (absolute) time in seconds and a number of samples.
Definition: WaveTrack.cpp:1767
Effect::mUIParent
wxWindow * mUIParent
Definition: Effect.h:477
EffectPaulstretch::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: Paulstretch.h:20
Effect::TrackProgress
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={})
Definition: Effect.cpp:2024
ArrayOf< float >
ReadAndVerifyFloat
#define ReadAndVerifyFloat(name)
Definition: Effect.h:633
EffectPaulstretch::m_t1
double m_t1
Definition: Paulstretch.h:60
PaulStretch
Class that helps EffectPaulStretch. It does the FFTs and inner loop of the effect.
Definition: Paulstretch.cpp:47
WaveTrack::GetRate
double GetRate() const
Definition: WaveTrack.cpp:360