Audacity  3.2.0
Effect.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Effect.cpp
6 
7  Dominic Mazzoni
8  Vaughan Johnson
9  Martyn Shaw
10 
11 *******************************************************************//*******************************************************************/
17 
18 
19 #include "Effect.h"
20 #include "TimeWarper.h"
21 
22 #include <algorithm>
23 #include <thread>
24 
25 #include <wx/defs.h>
26 #include <wx/sizer.h>
27 
28 #include "../AudioIO.h"
30 #include "../LabelTrack.h"
31 #include "../MixAndRender.h"
32 #include "PluginManager.h"
33 #include "../ProjectAudioManager.h"
34 #include "../ProjectSettings.h"
35 #include "QualitySettings.h"
36 #include "../SelectFile.h"
37 #include "../ShuttleAutomation.h"
38 #include "../ShuttleGui.h"
39 #include "../SyncLock.h"
40 #include "TransactionScope.h"
41 #include "ViewInfo.h"
42 #include "../WaveTrack.h"
43 #include "wxFileNameWrapper.h"
44 #include "../widgets/ProgressDialog.h"
45 #include "../widgets/NumericTextCtrl.h"
46 #include "../widgets/AudacityMessageBox.h"
47 #include "../widgets/VetoDialogHook.h"
48 
49 #include <unordered_map>
50 
51 // Effect application counter
53 
54 static const int kPlayID = 20102;
55 static const int kRewindID = 20103;
56 static const int kFFwdID = 20104;
57 
58 const wxString Effect::kUserPresetIdent = wxT("User Preset:");
59 const wxString Effect::kFactoryPresetIdent = wxT("Factory Preset:");
60 const wxString Effect::kCurrentSettingsIdent = wxT("<Current Settings>");
61 const wxString Effect::kFactoryDefaultsIdent = wxT("<Factory Defaults>");
62 
63 using t2bHash = std::unordered_map< void*, bool >;
64 
66 {
67  mClient = NULL;
68 
69  mTracks = NULL;
70  mT0 = 0.0;
71  mT1 = 0.0;
72  mDuration = 0.0;
73  mIsPreview = false;
74  mIsLinearEffect = false;
76  mPreviewFullSelection = false;
77  mNumTracks = 0;
78  mNumGroups = 0;
79  mProgress = NULL;
80 
81  mUIParent = NULL;
82 
83  mNumAudioIn = 0;
84  mNumAudioOut = 0;
85 
86  mBufferSize = 0;
87  mBlockSize = 0;
88  mNumChannels = 0;
89 
90  // PRL: I think this initialization of mProjectRate doesn't matter
91  // because it is always reassigned in DoEffect before it is used
92  // STF: but can't call AudioIOBase::GetOptimalSupportedSampleRate() here.
93  // (Which is called to compute the default-default value.) (Bug 2280)
95 
96  mIsBatch = false;
97 }
98 
100 {
101  // Destroying what is usually the unique Effect object of its subclass,
102  // which lasts until the end of the session.
103  // Maybe there is a non-modal realtime dialog still open.
104  if (mHostUIDialog)
105  mHostUIDialog->Close();
106 }
107 
108 // EffectDefinitionInterface implementation
109 
111 {
112  if (mClient)
113  {
114  return mClient->GetType();
115  }
116 
117  return EffectTypeNone;
118 }
119 
121 {
122  if (mClient)
123  {
124  return mClient->GetPath();
125  }
126 
128 }
129 
131 {
132  if (mClient)
133  {
134  return mClient->GetSymbol();
135  }
136 
137  return {};
138 }
139 
141 {
142  if (mClient)
143  {
144  return mClient->GetVendor();
145  }
146 
147  return XO("Audacity");
148 }
149 
151 {
152  if (mClient)
153  {
154  return mClient->GetVersion();
155  }
156 
157  return AUDACITY_VERSION_STRING;
158 }
159 
161 {
162  if (mClient)
163  {
164  return mClient->GetDescription();
165  }
166 
167  return {};
168 }
169 
171 {
172  if (mClient)
173  {
174  return mClient->GetFamily();
175  }
176 
177  // Unusually, the internal and visible strings differ for the built-in
178  // effect family.
179  return { wxT("Audacity"), XO("Built-in") };
180 }
181 
183 {
184  if (mClient)
185  {
186  return mClient->IsInteractive();
187  }
188 
189  return true;
190 }
191 
193 {
194  if (mClient)
195  {
196  return mClient->IsDefault();
197  }
198 
199  return true;
200 }
201 
203 {
204  if (mClient)
205  {
206  return false;
207  }
208 
209  return true;
210 }
211 
213 {
214  if (mClient)
215  {
216  return mClient->SupportsRealtime();
217  }
218 
219  return false;
220 }
221 
223 {
224  if (mClient)
225  {
226  return mClient->SupportsAutomation();
227  }
228 
229  return true;
230 }
231 
232 // EffectProcessor implementation
233 
235 {
236  if (mClient)
237  {
238  return mClient->SetHost(host);
239  }
240 
241  return true;
242 }
243 
245 {
246  if (mClient)
247  {
248  return mClient->GetAudioInCount();
249  }
250 
251  return 0;
252 }
253 
255 {
256  if (mClient)
257  {
258  return mClient->GetAudioOutCount();
259  }
260 
261  return 0;
262 }
263 
265 {
266  if (mClient)
267  {
268  return mClient->GetMidiInCount();
269  }
270 
271  return 0;
272 }
273 
275 {
276  if (mClient)
277  {
278  return mClient->GetMidiOutCount();
279  }
280 
281  return 0;
282 }
283 
284 void Effect::SetSampleRate(double rate)
285 {
286  if (mClient)
287  {
288  mClient->SetSampleRate(rate);
289  }
290 
291  mSampleRate = rate;
292 }
293 
294 size_t Effect::SetBlockSize(size_t maxBlockSize)
295 {
296  if (mClient)
297  {
298  return mClient->SetBlockSize(maxBlockSize);
299  }
300 
301  mBlockSize = maxBlockSize;
302 
303  return mBlockSize;
304 }
305 
306 size_t Effect::GetBlockSize() const
307 {
308  if (mClient)
309  {
310  return mClient->GetBlockSize();
311  }
312 
313  return mBlockSize;
314 }
315 
317 {
318  if (mClient)
319  {
320  return mClient->GetLatency();
321  }
322 
323  return 0;
324 }
325 
327 {
328  if (mClient)
329  {
330  return mClient->GetTailSize();
331  }
332 
333  return 0;
334 }
335 
337 {
338  if (mClient)
339  {
340  return mClient->ProcessInitialize(totalLen, chanMap);
341  }
342 
343  return true;
344 }
345 
347 {
348  if (mClient)
349  {
350  return mClient->ProcessFinalize();
351  }
352 
353  return true;
354 }
355 
356 size_t Effect::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
357 {
358  if (mClient)
359  {
360  return mClient->ProcessBlock(inBlock, outBlock, blockLen);
361  }
362 
363  return 0;
364 }
365 
367 {
368  if (mClient)
369  {
371  return mClient->RealtimeInitialize();
372  }
373 
374  mBlockSize = 512;
375 
376  return false;
377 }
378 
379 bool Effect::RealtimeAddProcessor(unsigned numChannels, float sampleRate)
380 {
381  if (mClient)
382  {
383  return mClient->RealtimeAddProcessor(numChannels, sampleRate);
384  }
385 
386  return true;
387 }
388 
390 {
391  if (mClient)
392  {
393  return mClient->RealtimeFinalize();
394  }
395 
396  return false;
397 }
398 
400 {
401  if (mClient)
402  return mClient->RealtimeSuspend();
403 
404  return true;
405 }
406 
407 bool Effect::RealtimeResume() noexcept
408 {
409  if (mClient)
410  return mClient->RealtimeResume();
411 
412  return true;
413 }
414 
416 {
417  if (mClient)
418  {
419  return mClient->RealtimeProcessStart();
420  }
421 
422  return true;
423 }
424 
425 size_t Effect::RealtimeProcess(int group,
426  float **inbuf,
427  float **outbuf,
428  size_t numSamples)
429 {
430  if (mClient)
431  {
432  return mClient->RealtimeProcess(group, inbuf, outbuf, numSamples);
433  }
434 
435  return 0;
436 }
437 
439 {
440  if (mClient)
441  {
442  return mClient->RealtimeProcessEnd();
443  }
444 
445  return true;
446 }
447 
449  wxWindow &parent, wxDialog &dialog, bool forceModal)
450 {
451  // Remember the dialog with a weak pointer, but don't control its lifetime
452  mUIDialog = &dialog;
453  mUIDialog->Layout();
454  mUIDialog->Fit();
455  mUIDialog->SetMinSize(mUIDialog->GetSize());
456 
458  return 0;
459 
460  if( SupportsRealtime() && !forceModal )
461  {
462  mUIDialog->Show();
463  // Return false to bypass effect processing
464  return 0;
465  }
466 
467  return mUIDialog->ShowModal();
468 }
469 
470 int Effect::ShowHostInterface(wxWindow &parent,
471  const EffectDialogFactory &factory, bool forceModal)
472 {
473  if (!IsInteractive())
474  // Effect without UI just proceeds quietly to apply it destructively.
475  return wxID_APPLY;
476 
477  if (mHostUIDialog)
478  {
479  // Realtime effect has shown its nonmodal dialog, now hides it, and does
480  // nothing else.
481  if ( mHostUIDialog->Close(true) )
482  mHostUIDialog = nullptr;
483  return 0;
484  }
485 
486  // Create the dialog
487  // Host, not client, is responsible for invoking the factory and managing
488  // the lifetime of the dialog.
489  // The usual factory lets the client (which is this, when self-hosting)
490  // populate it. That factory function is called indirectly through a
491  // std::function to avoid source code dependency cycles.
492  const auto client = mClient ? mClient : this;
493  mHostUIDialog = factory(parent, *this, *client);
494  if (!mHostUIDialog)
495  return 0;
496 
497  // Let the client show the dialog and decide whether to keep it open
498  auto result = client->ShowClientInterface(parent, *mHostUIDialog, forceModal);
499  if (!mHostUIDialog->IsShown())
500  // Client didn't show it, or showed it modally and closed it
501  // So destroy it.
502  // (I think mHostUIDialog only needs to be a local variable in this
503  // function -- that it is always null when the function begins -- but
504  // that may change. PRL)
505  mHostUIDialog->Destroy();
506 
507  return result;
508 }
509 
511 {
512  if (mClient)
513  {
514  return mClient->GetAutomationParameters(parms);
515  }
516 
517  return true;
518 }
519 
521 {
522  if (mClient)
523  {
524  return mClient->SetAutomationParameters(parms);
525  }
526 
527  return true;
528 }
529 
531 {
532  if (mClient)
533  {
534  return mClient->LoadUserPreset(name);
535  }
536 
537  wxString parms;
539  name, wxT("Parameters"), parms))
540  {
541  return false;
542  }
543 
544  return SetAutomationParametersFromString(parms);
545 }
546 
548 {
549  if (mClient)
550  {
551  return mClient->SaveUserPreset(name);
552  }
553 
554  wxString parms;
556  return false;
557 
559  name, wxT("Parameters"), parms);
560 }
561 
563 {
564  if (mClient)
565  {
566  return mClient->GetFactoryPresets();
567  }
568 
569  return {};
570 }
571 
573 {
574  if (mClient)
575  {
576  return mClient->LoadFactoryPreset(id);
577  }
578 
579  return true;
580 }
581 
583 {
584  if (mClient)
585  {
586  return mClient->LoadFactoryDefaults();
587  }
588 
590 }
591 
592 // EffectUIClientInterface implementation
593 
595 {
596  auto parent = S.GetParent();
597  mUIParent = parent;
598  mUIParent->PushEventHandler(this);
599 
600 // LoadUserPreset(GetCurrentSettingsGroup());
601 
603 
604  mUIParent->SetMinSize(mUIParent->GetSizer()->GetMinSize());
605 
606  return true;
607 }
608 
610 {
611  return false;
612 }
613 
615 {
616  return mUIParent->Validate();
617 }
618 
620 {
621  return true;
622 }
623 
625 {
626  if (mUIParent)
627  mUIParent->RemoveEventHandler(this);
628 
629  mUIParent = NULL;
630  mUIDialog = NULL;
631 
632  return true;
633 }
634 
636 {
637  return true;
638 }
639 
641 {
642  static const FileNames::FileTypes result {
643  { XO("Presets"), { wxT("txt") }, true },
645  };
646  return result;
647 };
648 
650 {
651  wxString params;
653  auto commandId = GetSquashedName(GetSymbol().Internal());
654  params = commandId.GET() + ":" + params;
655 
656  auto path = SelectFile(FileNames::Operation::Presets,
657  XO("Export Effect Parameters"),
658  wxEmptyString,
659  wxEmptyString,
660  wxEmptyString,
661  PresetTypes(),
662  wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
663  nullptr);
664  if (path.empty()) {
665  return;
666  }
667 
668  // Create/Open the file
669  wxFFile f(path, wxT("wb"));
670  if (!f.IsOpened())
671  {
673  XO("Could not open file: \"%s\"").Format( path ),
674  XO("Error Saving Effect Presets"),
675  wxICON_EXCLAMATION,
676  NULL);
677  return;
678  }
679 
680  f.Write(params);
681  if (f.Error())
682  {
684  XO("Error writing to file: \"%s\"").Format( path ),
685  XO("Error Saving Effect Presets"),
686  wxICON_EXCLAMATION,
687  NULL);
688  }
689 
690  f.Close();
691 
692 
693  //SetWindowTitle();
694 
695 }
696 
698 {
699  wxString params;
700 
701  auto path = SelectFile(FileNames::Operation::Presets,
702  XO("Import Effect Parameters"),
703  wxEmptyString,
704  wxEmptyString,
705  wxEmptyString,
706  PresetTypes(),
707  wxFD_OPEN | wxRESIZE_BORDER,
708  nullptr);
709  if (path.empty()) {
710  return;
711  }
712 
713  wxFFile f(path);
714  if (f.IsOpened()) {
715  if (f.ReadAll(&params)) {
716  wxString ident = params.BeforeFirst(':');
717  params = params.AfterFirst(':');
718 
719  auto commandId = GetSquashedName(GetSymbol().Internal());
720 
721  if (ident != commandId) {
722  // effect identifiers are a sensible length!
723  // must also have some params.
724  if ((params.Length() < 2 ) || (ident.Length() < 2) || (ident.Length() > 30))
725  {
727  /* i18n-hint %s will be replaced by a file name */
728  XO("%s: is not a valid presets file.\n")
729  .Format(wxFileNameFromPath(path)));
730  }
731  else
732  {
734  /* i18n-hint %s will be replaced by a file name */
735  XO("%s: is for a different Effect, Generator or Analyzer.\n")
736  .Format(wxFileNameFromPath(path)));
737  }
738  return;
739  }
741  }
742  }
743 
744  //SetWindowTitle();
745 
746 }
747 
749 {
750  return false;
751 }
752 
754 {
755 }
756 
757 // EffectHostInterface implementation
758 
760 {
761  return mClient ? *mClient : *this;
762 }
763 
765 {
766  return 30.0;
767 }
768 
770 {
771  if (mDuration < 0.0)
772  {
773  mDuration = 0.0;
774  }
775 
776  return mDuration;
777 }
778 
780 {
781  return mDurationFormat;
782 }
783 
785 {
786  if( !IsBatchProcessing() && FindProject() )
789 }
790 
791 void Effect::SetDuration(double seconds)
792 {
793  if (seconds < 0.0)
794  {
795  seconds = 0.0;
796  }
797 
798  if (GetType() == EffectTypeGenerate)
799  {
801  GetCurrentSettingsGroup(), wxT("LastUsedDuration"), seconds);
802  }
803 
804  mDuration = seconds;
805 
806  return;
807 }
808 
810 {
811  RegistryPath group = wxT("UserPresets");
812  if (!name.empty())
813  {
814  group += wxCONFIG_PATH_SEPARATOR + name;
815  }
816 
817  return group;
818 }
819 
821 {
822  return wxT("CurrentSettings");
823 }
824 
826 {
827  return wxT("FactoryDefaults");
828 }
829 
831 {
832  return wxT("SavedState");
833 }
834 
835 // Effect implementation
836 
838 {
839  // Let destructor know we need to be shutdown
840  mClient = client;
841 
842  // Set host so client startup can use our services
843  if (!SetHost(this))
844  {
845  // Bail if the client startup fails
846  mClient = NULL;
847  return false;
848  }
849 
852 
853  bool haveDefaults;
855  wxT("Initialized"), haveDefaults, false);
856  if (!haveDefaults)
857  {
860  wxT("Initialized"), true);
861  }
863 
864  return Startup();
865 }
866 
868 {
869  return true;
870 }
871 
873 {
874  CommandParameters eap;
875 
877  {
878  return false;
879  }
880 
882  S.mpEap = &eap;
883  if( DefineParams( S ) ){
884  ;// got eap value using DefineParams.
885  }
886  // Won't be needed in future
887  else if (!GetAutomationParameters(eap))
888  {
889  return false;
890  }
891 
892  return eap.GetParameters(parms);
893 }
894 
895 bool Effect::SetAutomationParametersFromString(const wxString & parms)
896 {
897  wxString preset = parms;
898  bool success = false;
899  if (preset.StartsWith(kUserPresetIdent))
900  {
901  preset.Replace(kUserPresetIdent, wxEmptyString, false);
902  success = LoadUserPreset(GetUserPresetsGroup(preset));
903  }
904  else if (preset.StartsWith(kFactoryPresetIdent))
905  {
906  preset.Replace(kFactoryPresetIdent, wxEmptyString, false);
907  auto presets = GetFactoryPresets();
908  success = LoadFactoryPreset( make_iterator_range( presets ).index( preset ) );
909  }
910  else if (preset.StartsWith(kCurrentSettingsIdent))
911  {
912  preset.Replace(kCurrentSettingsIdent, wxEmptyString, false);
914  }
915  else if (preset.StartsWith(kFactoryDefaultsIdent))
916  {
917  preset.Replace(kFactoryDefaultsIdent, wxEmptyString, false);
919  }
920  else
921  {
922  CommandParameters eap(parms);
924  S.SetForValidating( &eap );
925  // DefineParams returns false if not defined for this effect.
926  if( !DefineParams( S ) )
927  // the old method...
928  success = SetAutomationParameters(eap);
929  else if( !S.bOK )
930  success = false;
931  else{
932  success = true;
933  S.SetForWriting( &eap );
934  DefineParams( S );
935  }
936  }
937 
938  if (!success)
939  {
941  XO("%s: Could not load settings below. Default settings will be used.\n\n%s")
942  .Format( GetName(), preset ) );
943  // We are using default settings and we still wish to continue.
944  return true;
945  //return false;
946  }
947 
948  if (!mUIDialog)
949  {
950  return true;
951  }
952 
953  return TransferDataToWindow();
954 }
955 
956 unsigned Effect::TestUIFlags(unsigned mask) {
957  return mask & mUIFlags;
958 }
959 
961 {
962  return mIsBatch;
963 }
964 
966 {
967  mIsBatch = start;
968 
969  if (start)
970  {
972  }
973  else
974  {
976  }
977 }
978 
979 bool Effect::DoEffect(double projectRate,
980  TrackList *list,
982  NotifyingSelectedRegion &selectedRegion,
983  unsigned flags,
984  wxWindow *pParent,
985  const EffectDialogFactory &dialogFactory)
986 {
987  auto cleanup0 = valueRestorer(mUIFlags, flags);
988  wxASSERT(selectedRegion.duration() >= 0.0);
989 
990  mOutputTracks.reset();
991 
992  mFactory = factory;
993  mProjectRate = projectRate;
994  mTracks = list;
995 
996  // This is for performance purposes only, no additional recovery implied
997  auto &pProject = *const_cast<AudacityProject*>(FindProject()); // how to remove this const_cast?
998  TransactionScope trans(pProject, "Effect");
999 
1000  // Update track/group counts
1001  CountWaveTracks();
1002 
1003  bool isSelection = false;
1004 
1005  mDuration = 0.0;
1006  if (GetType() == EffectTypeGenerate)
1007  {
1010  wxT("LastUsedDuration"), mDuration, GetDefaultDuration());
1011  }
1012 
1013  WaveTrack *newTrack{};
1014  bool success = false;
1015  auto oldDuration = mDuration;
1016 
1017  auto cleanup = finally( [&] {
1018  if (!success) {
1019  if (newTrack) {
1020  mTracks->Remove(newTrack);
1021  }
1022  // LastUsedDuration may have been modified by Preview.
1023  SetDuration(oldDuration);
1024  }
1025  else
1026  trans.Commit();
1027 
1028  End();
1029  ReplaceProcessedTracks( false );
1030  } );
1031 
1032  // We don't yet know the effect type for code in the Nyquist Prompt, so
1033  // assume it requires a track and handle errors when the effect runs.
1034  if ((GetType() == EffectTypeGenerate || GetPath() == NYQUIST_PROMPT_ID) && (mNumTracks == 0)) {
1035  newTrack = mTracks->Add(mFactory->NewWaveTrack());
1036  newTrack->SetSelected(true);
1037  }
1038 
1039  mT0 = selectedRegion.t0();
1040  mT1 = selectedRegion.t1();
1041  if (mT1 > mT0)
1042  {
1043  // there is a selection: let's fit in there...
1044  // MJS: note that this is just for the TTC and is independent of the track rate
1045  // but we do need to make sure we have the right number of samples at the project rate
1046  double quantMT0 = QUANTIZED_TIME(mT0, mProjectRate);
1047  double quantMT1 = QUANTIZED_TIME(mT1, mProjectRate);
1048  mDuration = quantMT1 - quantMT0;
1049  isSelection = true;
1050  mT1 = mT0 + mDuration;
1051  }
1052 
1053  mDurationFormat = isSelection
1056 
1057 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
1058  mF0 = selectedRegion.f0();
1059  mF1 = selectedRegion.f1();
1060  wxArrayString Names;
1062  Names.push_back(wxT("control-f0"));
1064  Names.push_back(wxT("control-f1"));
1065  SetPresetParameters( &Names, NULL );
1066 
1067 #endif
1068  CountWaveTracks();
1069 
1070  // Note: Init may read parameters from preferences
1071  if (!Init())
1072  {
1073  return false;
1074  }
1075 
1076  // Prompting will be bypassed when applying an effect that has already
1077  // been configured, e.g. repeating the last effect on a different selection.
1078  // Prompting may call Effect::Preview
1079  if ( pParent && dialogFactory &&
1080  IsInteractive() &&
1081  !ShowHostInterface( *pParent, dialogFactory, IsBatchProcessing() ) )
1082  {
1083  return false;
1084  }
1085 
1086  bool returnVal = true;
1087  bool skipFlag = CheckWhetherSkipEffect();
1088  if (skipFlag == false)
1089  {
1090  using namespace BasicUI;
1091  auto name = GetName();
1092  auto progress = MakeProgress(
1093  name,
1094  XO("Applying %s...").Format( name ),
1096  );
1097  auto vr = valueRestorer( mProgress, progress.get() );
1098 
1099  {
1100  returnVal = Process();
1101  }
1102  }
1103 
1104  if (returnVal && (mT1 >= mT0 ))
1105  {
1106  selectedRegion.setTimes(mT0, mT1);
1107  }
1108 
1109  success = returnVal;
1110  return returnVal;
1111 }
1112 
1114  Effect &delegate, wxWindow &parent, const EffectDialogFactory &factory )
1115 {
1116  NotifyingSelectedRegion region;
1117  region.setTimes( mT0, mT1 );
1118 
1119  return delegate.DoEffect( mProjectRate, mTracks, mFactory,
1120  region, mUIFlags, &parent, factory );
1121 }
1122 
1123 // All legacy effects should have this overridden
1125 {
1126  return true;
1127 }
1128 
1130 {
1131  return true;
1132 }
1133 
1135 {
1136  return false;
1137 }
1138 
1140 {
1141  CopyInputTracks(true);
1142  bool bGoodResult = true;
1143 
1144  // It's possible that the number of channels the effect expects changed based on
1145  // the parameters (the Audacity Reverb effect does when the stereo width is 0).
1148 
1149  mPass = 1;
1150  if (InitPass1())
1151  {
1152  bGoodResult = ProcessPass();
1153  mPass = 2;
1154  if (bGoodResult && InitPass2())
1155  {
1156  bGoodResult = ProcessPass();
1157  }
1158  }
1159 
1160  ReplaceProcessedTracks(bGoodResult);
1161 
1162  return bGoodResult;
1163 }
1164 
1166 {
1167  bool bGoodResult = true;
1168  bool isGenerator = GetType() == EffectTypeGenerate;
1169 
1170  FloatBuffers inBuffer, outBuffer;
1171  ArrayOf<float *> inBufPos, outBufPos;
1172 
1173  ChannelName map[3];
1174 
1175  mBufferSize = 0;
1176  mBlockSize = 0;
1177 
1178  int count = 0;
1179  bool clear = false;
1180 
1181  const bool multichannel = mNumAudioIn > 1;
1182  auto range = multichannel
1183  ? mOutputTracks->Leaders()
1184  : mOutputTracks->Any();
1185  range.VisitWhile( bGoodResult,
1186  [&](WaveTrack *left, const Track::Fallthrough &fallthrough) {
1187  if (!left->GetSelected())
1188  return fallthrough();
1189 
1190  sampleCount len = 0;
1191  sampleCount start = 0;
1192 
1193  mNumChannels = 0;
1194  WaveTrack *right{};
1195 
1196  // Iterate either over one track which could be any channel,
1197  // or if multichannel, then over all channels of left,
1198  // which is a leader.
1199  for (auto channel :
1200  TrackList::Channels(left).StartingWith(left)) {
1201  if (channel->GetChannel() == Track::LeftChannel)
1203  else if (channel->GetChannel() == Track::RightChannel)
1205  else
1207 
1208  ++ mNumChannels;
1210 
1211  if (! multichannel)
1212  break;
1213 
1214  if (mNumChannels == 2) {
1215  // TODO: more-than-two-channels
1216  right = channel;
1217  clear = false;
1218  // Ignore other channels
1219  break;
1220  }
1221  }
1222 
1223  if (!isGenerator)
1224  {
1225  GetBounds(*left, right, &start, &len);
1226  mSampleCnt = len;
1227  }
1228  else
1230 
1231  // Let the client know the sample rate
1232  SetSampleRate(left->GetRate());
1233 
1234  // Get the block size the client wants to use
1235  auto max = left->GetMaxBlockSize() * 2;
1236  mBlockSize = SetBlockSize(max);
1237 
1238  // Calculate the buffer size to be at least the max rounded up to the clients
1239  // selected block size.
1240  const auto prevBufferSize = mBufferSize;
1241  mBufferSize = ((max + (mBlockSize - 1)) / mBlockSize) * mBlockSize;
1242 
1243  // If the buffer size has changed, then (re)allocate the buffers
1244  if (prevBufferSize != mBufferSize)
1245  {
1246  // Always create the number of input buffers the client expects even if we don't have
1247  // the same number of channels.
1248  inBufPos.reinit( mNumAudioIn );
1249  inBuffer.reinit( mNumAudioIn, mBufferSize );
1250 
1251  // We won't be using more than the first 2 buffers, so clear the rest (if any)
1252  for (size_t i = 2; i < mNumAudioIn; i++)
1253  {
1254  for (size_t j = 0; j < mBufferSize; j++)
1255  {
1256  inBuffer[i][j] = 0.0;
1257  }
1258  }
1259 
1260  // Always create the number of output buffers the client expects even if we don't have
1261  // the same number of channels.
1262  outBufPos.reinit( mNumAudioOut );
1263  // Output buffers get an extra mBlockSize worth to give extra room if
1264  // the plugin adds latency
1265  outBuffer.reinit( mNumAudioOut, mBufferSize + mBlockSize );
1266  }
1267 
1268  // (Re)Set the input buffer positions
1269  for (size_t i = 0; i < mNumAudioIn; i++)
1270  {
1271  inBufPos[i] = inBuffer[i].get();
1272  }
1273 
1274  // (Re)Set the output buffer positions
1275  for (size_t i = 0; i < mNumAudioOut; i++)
1276  {
1277  outBufPos[i] = outBuffer[i].get();
1278  }
1279 
1280  // Clear unused input buffers
1281  if (!right && !clear && mNumAudioIn > 1)
1282  {
1283  for (size_t j = 0; j < mBufferSize; j++)
1284  {
1285  inBuffer[1][j] = 0.0;
1286  }
1287  clear = true;
1288  }
1289 
1290  // Go process the track(s)
1291  bGoodResult = ProcessTrack(
1292  count, map, left, right, start, len,
1293  inBuffer, outBuffer, inBufPos, outBufPos);
1294  if (!bGoodResult)
1295  return;
1296 
1297  count++;
1298  },
1299  [&](Track *t) {
1301  t->SyncLockAdjust(mT1, mT0 + mDuration);
1302  }
1303  );
1304 
1305  if (bGoodResult && GetType() == EffectTypeGenerate)
1306  {
1307  mT1 = mT0 + mDuration;
1308  }
1309 
1310  return bGoodResult;
1311 }
1312 
1313 bool Effect::ProcessTrack(int count,
1314  ChannelNames map,
1315  WaveTrack *left,
1316  WaveTrack *right,
1317  sampleCount start,
1318  sampleCount len,
1319  FloatBuffers &inBuffer,
1320  FloatBuffers &outBuffer,
1321  ArrayOf< float * > &inBufPos,
1322  ArrayOf< float *> &outBufPos)
1323 {
1324  bool rc = true;
1325 
1326  // Give the plugin a chance to initialize
1327  if (!ProcessInitialize(len, map))
1328  {
1329  return false;
1330  }
1331 
1332  { // Start scope for cleanup
1333  auto cleanup = finally( [&] {
1334  // Allow the plugin to cleanup
1335  if (!ProcessFinalize())
1336  {
1337  // In case of non-exceptional flow of control, set rc
1338  rc = false;
1339  }
1340  } );
1341 
1342  // For each input block of samples, we pass it to the effect along with a
1343  // variable output location. This output location is simply a pointer into a
1344  // much larger buffer. This reduces the number of calls required to add the
1345  // samples to the output track.
1346  //
1347  // Upon return from the effect, the output samples are "moved to the left" by
1348  // the number of samples in the current latency setting, effectively removing any
1349  // delay introduced by the effect.
1350  //
1351  // At the same time the total number of delayed samples are gathered and when
1352  // there is no further input data to process, the loop continues to call the
1353  // effect with an empty input buffer until the effect has had a chance to
1354  // return all of the remaining delayed samples.
1355  auto inPos = start;
1356  auto outPos = start;
1357 
1358  auto inputRemaining = len;
1359  decltype(GetLatency()) curDelay = 0, delayRemaining = 0;
1360  decltype(mBlockSize) curBlockSize = 0;
1361 
1362  decltype(mBufferSize) inputBufferCnt = 0;
1363  decltype(mBufferSize) outputBufferCnt = 0;
1364  bool cleared = false;
1365 
1366  auto chans = std::min<unsigned>(mNumAudioOut, mNumChannels);
1367 
1368  std::shared_ptr<WaveTrack> genLeft, genRight;
1369 
1370  decltype(len) genLength = 0;
1371  bool isGenerator = GetType() == EffectTypeGenerate;
1372  bool isProcessor = GetType() == EffectTypeProcess;
1373  double genDur = 0;
1374  if (isGenerator)
1375  {
1376  if (mIsPreview) {
1377  gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &genDur, 6.0);
1378  genDur = wxMin(mDuration, CalcPreviewInputLength(genDur));
1379  }
1380  else {
1381  genDur = mDuration;
1382  }
1383 
1384  genLength = sampleCount((left->GetRate() * genDur) + 0.5); // round to nearest sample
1385  delayRemaining = genLength;
1386  cleared = true;
1387 
1388  // Create temporary tracks
1389  genLeft = left->EmptyCopy();
1390 
1391  if (right)
1392  genRight = right->EmptyCopy();
1393  }
1394 
1395  // Call the effect until we run out of input or delayed samples
1396  while (inputRemaining != 0 || delayRemaining != 0)
1397  {
1398  // Still working on the input samples
1399  if (inputRemaining != 0)
1400  {
1401  // Need to refill the input buffers
1402  if (inputBufferCnt == 0)
1403  {
1404  // Calculate the number of samples to get
1405  inputBufferCnt =
1406  limitSampleBufferSize( mBufferSize, inputRemaining );
1407 
1408  // Fill the input buffers
1409  left->GetFloats(inBuffer[0].get(), inPos, inputBufferCnt);
1410  if (right)
1411  {
1412  right->GetFloats(inBuffer[1].get(), inPos, inputBufferCnt);
1413  }
1414 
1415  // Reset the input buffer positions
1416  for (size_t i = 0; i < mNumChannels; i++)
1417  {
1418  inBufPos[i] = inBuffer[i].get();
1419  }
1420  }
1421 
1422  // Calculate the number of samples to process
1423  curBlockSize = mBlockSize;
1424  if (curBlockSize > inputRemaining)
1425  {
1426  // We've reached the last block...set current block size to what's left
1427  // inputRemaining is positive and bounded by a size_t
1428  curBlockSize = inputRemaining.as_size_t();
1429  inputRemaining = 0;
1430 
1431  // Clear the remainder of the buffers so that a full block can be passed
1432  // to the effect
1433  auto cnt = mBlockSize - curBlockSize;
1434  for (size_t i = 0; i < mNumChannels; i++)
1435  {
1436  for (decltype(cnt) j = 0 ; j < cnt; j++)
1437  {
1438  inBufPos[i][j + curBlockSize] = 0.0;
1439  }
1440  }
1441 
1442  // Might be able to use up some of the delayed samples
1443  if (delayRemaining != 0)
1444  {
1445  // Don't use more than needed
1446  cnt = limitSampleBufferSize(cnt, delayRemaining);
1447  delayRemaining -= cnt;
1448  curBlockSize += cnt;
1449  }
1450  }
1451  }
1452  // We've exhausted the input samples and are now working on the delay
1453  else if (delayRemaining != 0)
1454  {
1455  // Calculate the number of samples to process
1456  curBlockSize = limitSampleBufferSize( mBlockSize, delayRemaining );
1457  delayRemaining -= curBlockSize;
1458 
1459  // From this point on, we only want to feed zeros to the plugin
1460  if (!cleared)
1461  {
1462  // Reset the input buffer positions
1463  for (size_t i = 0; i < mNumChannels; i++)
1464  {
1465  inBufPos[i] = inBuffer[i].get();
1466 
1467  // And clear
1468  for (size_t j = 0; j < mBlockSize; j++)
1469  {
1470  inBuffer[i][j] = 0.0;
1471  }
1472  }
1473  cleared = true;
1474  }
1475  }
1476 
1477  // Finally call the plugin to process the block
1478  decltype(curBlockSize) processed;
1479  try
1480  {
1481  processed = ProcessBlock(inBufPos.get(), outBufPos.get(), curBlockSize);
1482  }
1483  catch( const AudacityException & WXUNUSED(e) )
1484  {
1485  // PRL: Bug 437:
1486  // Pass this along to our application-level handler
1487  throw;
1488  }
1489  catch(...)
1490  {
1491  // PRL:
1492  // Exceptions for other reasons, maybe in third-party code...
1493  // Continue treating them as we used to, but I wonder if these
1494  // should now be treated the same way.
1495  return false;
1496  }
1497  wxASSERT(processed == curBlockSize);
1498  wxUnusedVar(processed);
1499 
1500  // Bump to next input buffer position
1501  if (inputRemaining != 0)
1502  {
1503  for (size_t i = 0; i < mNumChannels; i++)
1504  {
1505  inBufPos[i] += curBlockSize;
1506  }
1507  inputRemaining -= curBlockSize;
1508  inputBufferCnt -= curBlockSize;
1509  }
1510 
1511  // "ls" and "rs" serve as the input sample index for the left and
1512  // right channels when processing the input samples. If we flip
1513  // over to processing delayed samples, they simply become counters
1514  // for the progress display.
1515  inPos += curBlockSize;
1516 
1517  // Get the current number of delayed samples and accumulate
1518  if (isProcessor)
1519  {
1520  {
1521  auto delay = GetLatency();
1522  curDelay += delay;
1523  delayRemaining += delay;
1524  }
1525 
1526  // If the plugin has delayed the output by more samples than our current
1527  // block size, then we leave the output pointers alone. This effectively
1528  // removes those delayed samples from the output buffer.
1529  if (curDelay >= curBlockSize)
1530  {
1531  curDelay -= curBlockSize;
1532  curBlockSize = 0;
1533  }
1534  // We have some delayed samples, at the beginning of the output samples,
1535  // so overlay them by shifting the remaining output samples.
1536  else if (curDelay > 0)
1537  {
1538  // curDelay is bounded by curBlockSize:
1539  auto delay = curDelay.as_size_t();
1540  curBlockSize -= delay;
1541  for (size_t i = 0; i < chans; i++)
1542  {
1543  memmove(outBufPos[i], outBufPos[i] + delay, sizeof(float) * curBlockSize);
1544  }
1545  curDelay = 0;
1546  }
1547  }
1548 
1549  // Adjust the number of samples in the output buffers
1550  outputBufferCnt += curBlockSize;
1551 
1552  // Still have room in the output buffers
1553  if (outputBufferCnt < mBufferSize)
1554  {
1555  // Bump to next output buffer position
1556  for (size_t i = 0; i < chans; i++)
1557  {
1558  outBufPos[i] += curBlockSize;
1559  }
1560  }
1561  // Output buffers have filled
1562  else
1563  {
1564  if (isProcessor)
1565  {
1566  // Write them out
1567  left->Set((samplePtr) outBuffer[0].get(), floatSample, outPos, outputBufferCnt);
1568  if (right)
1569  {
1570  if (chans >= 2)
1571  {
1572  right->Set((samplePtr) outBuffer[1].get(), floatSample, outPos, outputBufferCnt);
1573  }
1574  else
1575  {
1576  right->Set((samplePtr) outBuffer[0].get(), floatSample, outPos, outputBufferCnt);
1577  }
1578  }
1579  }
1580  else if (isGenerator)
1581  {
1582  genLeft->Append((samplePtr) outBuffer[0].get(), floatSample, outputBufferCnt);
1583  if (genRight)
1584  {
1585  genRight->Append((samplePtr) outBuffer[1].get(), floatSample, outputBufferCnt);
1586  }
1587  }
1588 
1589  // Reset the output buffer positions
1590  for (size_t i = 0; i < chans; i++)
1591  {
1592  outBufPos[i] = outBuffer[i].get();
1593  }
1594 
1595  // Bump to the next track position
1596  outPos += outputBufferCnt;
1597  outputBufferCnt = 0;
1598  }
1599 
1600  if (mNumChannels > 1)
1601  {
1602  if (TrackGroupProgress(count,
1603  (inPos - start).as_double() /
1604  (isGenerator ? genLength : len).as_double()))
1605  {
1606  rc = false;
1607  break;
1608  }
1609  }
1610  else
1611  {
1612  if (TrackProgress(count,
1613  (inPos - start).as_double() /
1614  (isGenerator ? genLength : len).as_double()))
1615  {
1616  rc = false;
1617  break;
1618  }
1619  }
1620  }
1621 
1622  // Put any remaining output
1623  if (rc && outputBufferCnt)
1624  {
1625  if (isProcessor)
1626  {
1627  left->Set((samplePtr) outBuffer[0].get(), floatSample, outPos, outputBufferCnt);
1628  if (right)
1629  {
1630  if (chans >= 2)
1631  {
1632  right->Set((samplePtr) outBuffer[1].get(), floatSample, outPos, outputBufferCnt);
1633  }
1634  else
1635  {
1636  right->Set((samplePtr) outBuffer[0].get(), floatSample, outPos, outputBufferCnt);
1637  }
1638  }
1639  }
1640  else if (isGenerator)
1641  {
1642  genLeft->Append((samplePtr) outBuffer[0].get(), floatSample, outputBufferCnt);
1643  if (genRight)
1644  {
1645  genRight->Append((samplePtr) outBuffer[1].get(), floatSample, outputBufferCnt);
1646  }
1647  }
1648  }
1649 
1650  if (rc && isGenerator)
1651  {
1652  auto pProject = FindProject();
1653 
1654  // Transfer the data from the temporary tracks to the actual ones
1655  genLeft->Flush();
1656  // mT1 gives us the NEW selection. We want to replace up to GetSel1().
1657  auto &selectedRegion = ViewInfo::Get( *pProject ).selectedRegion;
1658  auto t1 = selectedRegion.t1();
1659  PasteTimeWarper warper{ t1, mT0 + genLeft->GetEndTime() };
1660  left->ClearAndPaste(mT0, t1, genLeft.get(), true, true,
1661  &warper);
1662 
1663  if (genRight)
1664  {
1665  genRight->Flush();
1666  right->ClearAndPaste(mT0, selectedRegion.t1(),
1667  genRight.get(), true, true, nullptr /* &warper */);
1668  }
1669  }
1670 
1671  } // End scope for cleanup
1672  return rc;
1673 }
1674 
1676 {
1677 }
1678 
1680 {
1681  return;
1682 }
1683 
1685 {
1686  return true;
1687 }
1688 
1690 {
1691  return true;
1692 }
1693 
1694 bool Effect::EnableApply(bool enable)
1695 {
1696  // May be called during initialization, so try to find the dialog
1697  wxWindow *dlg = mUIDialog;
1698  if (!dlg && mUIParent)
1699  {
1700  dlg = wxGetTopLevelParent(mUIParent);
1701  }
1702 
1703  if (dlg)
1704  {
1705  wxWindow *apply = dlg->FindWindow(wxID_APPLY);
1706 
1707  // Don't allow focus to get trapped
1708  if (!enable)
1709  {
1710  wxWindow *focus = dlg->FindFocus();
1711  if (focus == apply)
1712  {
1713  dlg->FindWindow(wxID_CLOSE)->SetFocus();
1714  }
1715  }
1716 
1717  apply->Enable(enable);
1718  }
1719 
1720  EnablePreview(enable);
1721 
1722  return enable;
1723 }
1724 
1725 bool Effect::EnablePreview(bool enable)
1726 {
1727  // May be called during initialization, so try to find the dialog
1728  wxWindow *dlg = mUIDialog;
1729  if (!dlg && mUIParent)
1730  {
1731  dlg = wxGetTopLevelParent(mUIParent);
1732  }
1733 
1734  if (dlg)
1735  {
1736  wxWindow *play = dlg->FindWindow(kPlayID);
1737  if (play)
1738  {
1739  wxWindow *rewind = dlg->FindWindow(kRewindID);
1740  wxWindow *ffwd = dlg->FindWindow(kFFwdID);
1741 
1742  // Don't allow focus to get trapped
1743  if (!enable)
1744  {
1745  wxWindow *focus = dlg->FindFocus();
1746  if (focus && (focus == play || focus == rewind || focus == ffwd))
1747  {
1748  dlg->FindWindow(wxID_CLOSE)->SetFocus();
1749  }
1750  }
1751 
1752  play->Enable(enable);
1753  if (SupportsRealtime())
1754  {
1755  rewind->Enable(enable);
1756  ffwd->Enable(enable);
1757  }
1758  }
1759  }
1760 
1761  return enable;
1762 }
1763 
1764 void Effect::SetLinearEffectFlag(bool linearEffectFlag)
1765 {
1766  mIsLinearEffect = linearEffectFlag;
1767 }
1768 
1769 void Effect::SetPreviewFullSelectionFlag(bool previewDurationFlag)
1770 {
1771  mPreviewFullSelection = previewDurationFlag;
1772 }
1773 
1774 
1775 void Effect::IncludeNotSelectedPreviewTracks(bool includeNotSelected)
1776 {
1777  mPreviewWithNotSelected = includeNotSelected;
1778 }
1779 
1780 bool Effect::TotalProgress(double frac, const TranslatableString &msg)
1781 {
1782  auto updateResult = (mProgress ?
1783  mProgress->Poll(frac * 1000, 1000, msg) :
1785  return (updateResult != ProgressResult::Success);
1786 }
1787 
1788 bool Effect::TrackProgress(int whichTrack, double frac, const TranslatableString &msg)
1789 {
1790  auto updateResult = (mProgress ?
1791  mProgress->Poll(whichTrack + frac, (double) mNumTracks, msg) :
1793  return (updateResult != ProgressResult::Success);
1794 }
1795 
1796 bool Effect::TrackGroupProgress(int whichGroup, double frac, const TranslatableString &msg)
1797 {
1798  auto updateResult = (mProgress ?
1799  mProgress->Poll(whichGroup + frac, (double) mNumGroups, msg) :
1801  return (updateResult != ProgressResult::Success);
1802 }
1803 
1805  const WaveTrack &track, const WaveTrack *pRight,
1806  sampleCount *start, sampleCount *len)
1807 {
1808  auto t0 = std::max( mT0, track.GetStartTime() );
1809  auto t1 = std::min( mT1, track.GetEndTime() );
1810 
1811  if ( pRight ) {
1812  t0 = std::min( t0, std::max( mT0, pRight->GetStartTime() ) );
1813  t1 = std::max( t1, std::min( mT1, pRight->GetEndTime() ) );
1814  }
1815 
1816  if (t1 > t0) {
1817  *start = track.TimeToLongSamples(t0);
1818  auto end = track.TimeToLongSamples(t1);
1819  *len = end - *start;
1820  }
1821  else {
1822  *start = 0;
1823  *len = 0;
1824  }
1825 }
1826 
1827 //
1828 // private methods
1829 //
1830 // Use this method to copy the input tracks to mOutputTracks, if
1831 // doing the processing on them, and replacing the originals only on success (and not cancel).
1832 // Copy the group tracks that have tracks selected
1833 // If not all sync-locked selected, then only selected wave tracks.
1834 void Effect::CopyInputTracks(bool allSyncLockSelected)
1835 {
1836  // Reset map
1837  mIMap.clear();
1838  mOMap.clear();
1839 
1841  const_cast<AudacityProject*>( FindProject() ) // how to remove this const_cast?
1842  );
1843 
1844  auto trackRange = mTracks->Any() +
1845  [&] (const Track *pTrack) {
1846  return allSyncLockSelected
1848  : track_cast<const WaveTrack*>( pTrack ) && pTrack->GetSelected();
1849  };
1850 
1851  t2bHash added;
1852 
1853  for (auto aTrack : trackRange)
1854  {
1855  Track *o = mOutputTracks->Add(aTrack->Duplicate());
1856  mIMap.push_back(aTrack);
1857  mOMap.push_back(o);
1858  }
1859 }
1860 
1861 Track *Effect::AddToOutputTracks(const std::shared_ptr<Track> &t)
1862 {
1863  mIMap.push_back(NULL);
1864  mOMap.push_back(t.get());
1865  return mOutputTracks->Add(t);
1866 }
1867 
1869  : mpEffect(pEffect)
1870 {
1871  LabelTrack::Holder pTrack{ std::make_shared<LabelTrack>() };
1872  mpTrack = pTrack.get();
1873  if (!name.empty())
1874  pTrack->SetName(name);
1875  pEffect->mTracks->Add( pTrack );
1876 }
1877 
1879 {
1880  mpEffect = that.mpEffect;
1881  mpTrack = that.mpTrack;
1882  that.Commit();
1883 }
1884 
1886 {
1887  mpEffect = nullptr;
1888 }
1889 
1891 {
1892  if (mpEffect) {
1893  // not committed -- DELETE the label track
1894  mpEffect->mTracks->Remove(mpTrack);
1895  }
1896 }
1897 
1898 auto Effect::AddAnalysisTrack(const wxString &name) -> std::shared_ptr<AddedAnalysisTrack>
1899 {
1900  return std::shared_ptr<AddedAnalysisTrack>
1901  { safenew AddedAnalysisTrack{ this, name } };
1902 }
1903 
1905  (Effect *pEffect, const LabelTrack *pOrigTrack, const wxString &name)
1906  : mpEffect(pEffect)
1907 {
1908  // copy LabelTrack here, so it can be undone on cancel
1909  auto newTrack = pOrigTrack->Copy(pOrigTrack->GetStartTime(), pOrigTrack->GetEndTime());
1910 
1911  mpTrack = static_cast<LabelTrack*>(newTrack.get());
1912 
1913  // Why doesn't LabelTrack::Copy complete the job? :
1914  mpTrack->SetOffset(pOrigTrack->GetStartTime());
1915  if (!name.empty())
1916  mpTrack->SetName(name);
1917 
1918  // mpOrigTrack came from mTracks which we own but expose as const to subclasses
1919  // So it's okay that we cast it back to const
1920  mpOrigTrack =
1921  pEffect->mTracks->Replace(const_cast<LabelTrack*>(pOrigTrack),
1922  newTrack );
1923 }
1924 
1926 {
1927  mpEffect = that.mpEffect;
1928  mpTrack = that.mpTrack;
1929  mpOrigTrack = std::move(that.mpOrigTrack);
1930  that.Commit();
1931 }
1932 
1934 {
1935  mpEffect = nullptr;
1936 }
1937 
1939 {
1940  if (mpEffect) {
1941  // not committed -- DELETE the label track
1942  // mpOrigTrack came from mTracks which we own but expose as const to subclasses
1943  // So it's okay that we cast it back to const
1944  mpEffect->mTracks->Replace(mpTrack, mpOrigTrack);
1945  }
1946 }
1947 
1949  (const LabelTrack *pOrigTrack, const wxString &name) -> ModifiedAnalysisTrack
1950 {
1951  return{ this, pOrigTrack, name };
1952 }
1953 
1954 // If bGoodResult, replace mTracks tracks with successfully processed mOutputTracks copies.
1955 // Else clear and DELETE mOutputTracks copies.
1956 void Effect::ReplaceProcessedTracks(const bool bGoodResult)
1957 {
1958  if (!bGoodResult) {
1959  // Free resources, unless already freed.
1960 
1961  // Processing failed or was cancelled so throw away the processed tracks.
1962  if ( mOutputTracks )
1963  mOutputTracks->Clear();
1964 
1965  // Reset map
1966  mIMap.clear();
1967  mOMap.clear();
1968 
1969  //TODO:undo the non-gui ODTask transfer
1970  return;
1971  }
1972 
1973  // Assume resources need to be freed.
1974  wxASSERT(mOutputTracks); // Make sure we at least did the CopyInputTracks().
1975 
1976  auto iterOut = mOutputTracks->ListOfTracks::begin(),
1977  iterEnd = mOutputTracks->ListOfTracks::end();
1978 
1979  size_t cnt = mOMap.size();
1980  size_t i = 0;
1981 
1982  for (; iterOut != iterEnd; ++i) {
1983  ListOfTracks::value_type o = *iterOut;
1984  // If tracks were removed from mOutputTracks, then there will be
1985  // tracks in the map that must be removed from mTracks.
1986  while (i < cnt && mOMap[i] != o.get()) {
1987  const auto t = mIMap[i];
1988  if (t) {
1989  mTracks->Remove(t);
1990  }
1991  i++;
1992  }
1993 
1994  // This should never happen
1995  wxASSERT(i < cnt);
1996 
1997  // Remove the track from the output list...don't DELETE it
1998  iterOut = mOutputTracks->erase(iterOut);
1999 
2000  const auto t = mIMap[i];
2001  if (t == NULL)
2002  {
2003  // This track is a NEW addition to output tracks; add it to mTracks
2004  mTracks->Add( o );
2005  }
2006  else
2007  {
2008  // Replace mTracks entry with the NEW track
2009  mTracks->Replace(t, o);
2010  }
2011  }
2012 
2013  // If tracks were removed from mOutputTracks, then there may be tracks
2014  // left at the end of the map that must be removed from mTracks.
2015  while (i < cnt) {
2016  const auto t = mIMap[i];
2017  if (t) {
2018  mTracks->Remove(t);
2019  }
2020  i++;
2021  }
2022 
2023  // Reset map
2024  mIMap.clear();
2025  mOMap.clear();
2026 
2027  // Make sure we processed everything
2028  wxASSERT(mOutputTracks->empty());
2029 
2030  // The output list is no longer needed
2031  mOutputTracks.reset();
2032  nEffectsDone++;
2033 }
2034 
2036 {
2037  if (!inputTracks())
2038  return nullptr;
2039  return inputTracks()->GetOwner();
2040 }
2041 
2043 {
2044  mNumTracks = mTracks->Selected< const WaveTrack >().size();
2046 }
2047 
2048 double Effect::CalcPreviewInputLength(double previewLength)
2049 {
2050  return previewLength;
2051 }
2052 
2053 void Effect::Preview(bool dryOnly)
2054 {
2055  if (mNumTracks == 0) { // nothing to preview
2056  return;
2057  }
2058 
2059  auto gAudioIO = AudioIO::Get();
2060  if (gAudioIO->IsBusy()) {
2061  return;
2062  }
2063 
2064  wxWindow *FocusDialog = wxWindow::FindFocus();
2065 
2066  double previewDuration;
2067  bool isNyquist = GetFamily() == NYQUISTEFFECTS_FAMILY;
2068  bool isGenerator = GetType() == EffectTypeGenerate;
2069 
2070  // Mix a few seconds of audio from all of the tracks
2071  double previewLen;
2072  gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &previewLen, 6.0);
2073 
2074  const double rate = mProjectRate;
2075 
2076  if (isNyquist && isGenerator) {
2077  previewDuration = CalcPreviewInputLength(previewLen);
2078  }
2079  else {
2080  previewDuration = wxMin(mDuration, CalcPreviewInputLength(previewLen));
2081  }
2082 
2083  double t1 = mT0 + previewDuration;
2084 
2085  if ((t1 > mT1) && !isGenerator) {
2086  t1 = mT1;
2087  }
2088 
2089  if (t1 <= mT0)
2090  return;
2091 
2092  bool success = true;
2093 
2094  auto cleanup = finally( [&] {
2095 
2096  // Effect is already inited; we will call Process, End, and then Init
2097  // again, so the state is exactly the way it was before Preview
2098  // was called.
2099  if (!dryOnly) {
2100  End();
2101  GuardedCall( [&]{ Init(); } );
2102  }
2103 
2104  // In case any dialog control depends on mT1 or mDuration:
2105  if ( mUIDialog )
2106  mUIDialog->TransferDataToWindow();
2107  } );
2108 
2109  auto vr0 = valueRestorer( mT0 );
2110  auto vr1 = valueRestorer( mT1 );
2111  // Most effects should stop at t1.
2112  if (!mPreviewFullSelection)
2113  mT1 = t1;
2114 
2115  // In case any dialog control depends on mT1 or mDuration:
2116  if ( mUIDialog ) {
2117  mUIDialog->TransferDataToWindow();
2118  }
2119 
2120  // Save the original track list
2121  TrackList *saveTracks = mTracks;
2122 
2123  auto cleanup2 = finally( [&] {
2124  mTracks = saveTracks;
2125  if (FocusDialog) {
2126  FocusDialog->SetFocus();
2127  }
2128 
2129  // In case of failed effect, be sure to free memory.
2130  ReplaceProcessedTracks( false );
2131  } );
2132 
2133  // Build NEW tracklist from rendering tracks
2134  // Set the same owning project, so FindProject() can see it within Process()
2135  const auto pProject = saveTracks->GetOwner();
2136  auto uTracks = TrackList::Create( pProject );
2137  mTracks = uTracks.get();
2138 
2139  // Linear Effect preview optimised by pre-mixing to one track.
2140  // Generators need to generate per track.
2141  if (mIsLinearEffect && !isGenerator) {
2142  WaveTrack::Holder mixLeft, mixRight;
2143  MixAndRender(saveTracks, mFactory, rate, floatSample, mT0, t1, mixLeft, mixRight);
2144  if (!mixLeft)
2145  return;
2146 
2147  mixLeft->Offset(-mixLeft->GetStartTime());
2148  mixLeft->SetSelected(true);
2149  auto pLeft = mTracks->Add( mixLeft );
2150  Track *pRight{};
2151  if (mixRight) {
2152  mixRight->Offset(-mixRight->GetStartTime());
2153  mixRight->SetSelected(true);
2154  pRight = mTracks->Add( mixRight );
2155  mTracks->MakeMultiChannelTrack(*pLeft, 2, true);
2156  }
2157  }
2158  else {
2159  for (auto src : saveTracks->Any< const WaveTrack >()) {
2160  if (src->GetSelected() || mPreviewWithNotSelected) {
2161  auto dest = src->Copy(mT0, t1);
2162  dest->SetSelected(src->GetSelected());
2163  mTracks->Add( dest );
2164  }
2165  }
2166  }
2167 
2168  // NEW tracks start at time zero.
2169  // Adjust mT0 and mT1 to be the times to process, and to
2170  // play back in these tracks
2171  mT1 -= mT0;
2172  mT0 = 0.0;
2173 
2174  // Update track/group counts
2175  CountWaveTracks();
2176 
2177  // Apply effect
2178  if (!dryOnly) {
2179  using namespace BasicUI;
2180  auto progress = MakeProgress(
2181  GetName(),
2182  XO("Preparing preview"),
2184  ); // Have only "Stop" button.
2185  auto vr = valueRestorer( mProgress, progress.get() );
2186 
2187  auto vr2 = valueRestorer( mIsPreview, true );
2188 
2189  success = Process();
2190  }
2191 
2192  if (success)
2193  {
2194  auto tracks = ProjectAudioManager::GetAllPlaybackTracks(*mTracks, true);
2195 
2196  // Some effects (Paulstretch) may need to generate more
2197  // than previewLen, so take the min.
2198  t1 = std::min(mT0 + previewLen, mT1);
2199 
2200  // Start audio playing
2201  auto options = DefaultPlayOptions(*pProject);
2202  int token = gAudioIO->StartStream(tracks, mT0, t1, t1, options);
2203 
2204  if (token) {
2205  auto previewing = ProgressResult::Success;
2206  // The progress dialog must be deleted before stopping the stream
2207  // to allow events to flow to the app during StopStream processing.
2208  // The progress dialog blocks these events.
2209  {
2210  ProgressDialog progress
2211  (GetName(), XO("Previewing"), pdlgHideCancelButton);
2212 
2213  while (gAudioIO->IsStreamActive(token) && previewing == ProgressResult::Success) {
2214  using namespace std::chrono;
2215  std::this_thread::sleep_for(100ms);
2216  previewing = progress.Update(gAudioIO->GetStreamTime() - mT0, t1 - mT0);
2217  }
2218  }
2219 
2220  gAudioIO->StopStream();
2221 
2222  while (gAudioIO->IsBusy()) {
2223  using namespace std::chrono;
2224  std::this_thread::sleep_for(100ms);
2225  }
2226  }
2227  else {
2228  using namespace BasicUI;
2230  wxWidgetsWindowPlacement{ FocusDialog }, XO("Error"),
2231  XO("Error opening sound device.\nTry changing the audio host, playback device and the project sample rate."),
2232  wxT("Error_opening_sound_device"),
2233  ErrorDialogOptions{ ErrorDialogType::ModalErrorReport } );
2234  }
2235  }
2236 }
2237 
2239  long style, const TranslatableString &titleStr)
2240 {
2241  auto title = titleStr.empty()
2242  ? GetName()
2243  : XO("%s: %s").Format( GetName(), titleStr );
2244  return AudacityMessageBox( message, title, style, mUIParent );
2245 }
2246 
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
Effect::mSampleCnt
sampleCount mSampleCnt
Definition: Effect.h:441
EffectUIClientInterface
EffectUIClientInterface is an abstract base class to populate a UI and validate UI values....
Definition: EffectInterface.h:251
Effect::AddedAnalysisTrack::AddedAnalysisTrack
AddedAnalysisTrack()
Definition: Effect.h:346
EffectProcessor::GetMidiOutCount
virtual int GetMidiOutCount()=0
Effect::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Save current settings into parms.
Definition: Effect.cpp:510
ShuttleSetAutomation
Shuttle that sets parameters to a value (from a string)
Definition: ShuttleAutomation.h:38
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
ViewInfo::Get
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
BasicUI::MakeProgress
std::unique_ptr< ProgressDialog > MakeProgress(const TranslatableString &title, const TranslatableString &message, unsigned flags=(ProgressShowStop|ProgressShowCancel), const TranslatableString &remainingLabelText={})
Create and display a progress dialog.
Definition: BasicUI.h:271
NYQUIST_PROMPT_ID
#define NYQUIST_PROMPT_ID
Definition: PluginManager.h:341
Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack
ModifiedAnalysisTrack()
TranslatableString::empty
bool empty() const
Definition: TranslatableString.h:72
EffectDefinitionInterface::LoadUserPreset
virtual bool LoadUserPreset(const RegistryPath &name)=0
Change settings to a user-named preset.
valueRestorer
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
Definition: MemoryX.h:226
Effect::mUIDialog
wxWeakRef< wxDialog > mUIDialog
This weak pointer may be the same as the above, or null.
Definition: Effect.h:437
TransactionScope.h
Effect::mNumTracks
int mNumTracks
Definition: Effect.h:483
Effect::FindProject
const AudacityProject * FindProject() const
Definition: Effect.cpp:2035
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:75
Effect::GetDuration
double GetDuration() override
Definition: Effect.cpp:769
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:56
EffectDialogFactory
std::function< wxDialog *(wxWindow &parent, EffectHostInterface &, EffectUIClientInterface &) > EffectDialogFactory
Definition: EffectHostInterface.h:55
wxFileNameWrapper.h
Effect::SetLinearEffectFlag
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:1764
Effect::AddedAnalysisTrack
Definition: Effect.h:339
Effect::GetMidiInCount
int GetMidiInCount() override
Definition: Effect.cpp:264
BasicUI::ProgressResult::Success
@ Success
make_iterator_range
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:423
EffectProcessor::RealtimeResume
virtual bool RealtimeResume() noexcept=0
EffectProcessor::RealtimeProcessStart
virtual bool RealtimeProcessStart()=0
Effect::EnableApply
bool EnableApply(bool enable=true)
Definition: Effect.cpp:1694
Effect::mClient
EffectUIClientInterface * mClient
Definition: Effect.h:487
BasicUI::ProgressDialog::Poll
virtual ProgressResult Poll(unsigned long long numerator, unsigned long long denominator, const TranslatableString &message={})=0
Update the bar and poll for clicks. Call only on the main thread.
S
#define S(N)
Definition: ToChars.cpp:64
Effect::IsInteractive
bool IsInteractive() override
Whether the effect needs a dialog for entry of settings.
Definition: Effect.cpp:182
Effect::CloseUI
bool CloseUI() override
Definition: Effect.cpp:624
Effect::GetAutomationParametersAsString
virtual bool GetAutomationParametersAsString(wxString &parms)
Definition: Effect.cpp:872
NotifyingSelectedRegion::duration
double duration() const
Definition: ViewInfo.h:40
AudacityMessageBox
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
Definition: AudacityMessageBox.cpp:17
Effect::GetSelectionFormat
virtual NumericFormatSymbol GetSelectionFormat()
Definition: Effect.cpp:784
EffectHostInterface
EffectHostInterface is a decorator of a EffectUIClientInterface. It adds virtual (abstract) functions...
Definition: EffectHostInterface.h:32
EffectDefinitionInterface::SaveUserPreset
virtual bool SaveUserPreset(const RegistryPath &name)=0
Save current settings as a user-named preset.
EffectDefinitionInterface::LoadFactoryPreset
virtual bool LoadFactoryPreset(int id)=0
Change settings to the preset whose name is GetFactoryPresets()[id]
Effect::ImportPresets
void ImportPresets() override
Definition: Effect.cpp:697
Effect.h
BasicUI::ProgressShowStop
@ ProgressShowStop
Definition: BasicUI.h:138
ComponentInterface::GetSymbol
virtual ComponentInterfaceSymbol GetSymbol()=0
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:71
Effect::GetBlockSize
size_t GetBlockSize() const override
Definition: Effect.cpp:306
EffectProcessor::GetMidiInCount
virtual int GetMidiInCount()=0
EffectProcessor::ProcessFinalize
virtual bool ProcessFinalize()=0
Called for destructive, non-realtime effect computation.
Effect::AddedAnalysisTrack::mpTrack
LabelTrack * mpTrack
Definition: Effect.h:361
Effect::MessageBox
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
Definition: Effect.cpp:2238
EffectProcessor::RealtimeProcess
virtual size_t RealtimeProcess(int group, float **inBuf, float **outBuf, size_t numSamples)=0
ProjectAudioManager::GetAllPlaybackTracks
static TransportTracks GetAllPlaybackTracks(TrackList &trackList, bool selectedOnly, bool nonWaveToo=false)
Definition: ProjectAudioManager.cpp:1190
WaveTrack::GetEndTime
double GetEndTime() const override
Get the time at which the last clip in the track ends, plus recorded stuff.
Definition: WaveTrack.cpp:2014
BasicUI::ShowErrorDialog
void ShowErrorDialog(const WindowPlacement &placement, const TranslatableString &dlogTitle, const TranslatableString &message, const ManualPageID &helpPage, const ErrorDialogOptions &options={})
Show an error dialog with a link to the manual for further help.
Definition: BasicUI.h:241
Effect::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: Effect.cpp:1684
Effect::mDuration
double mDuration
Definition: Effect.h:475
Effect::CopyInputTracks
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:1834
WaveTrack::Flush
void Flush() override
Definition: WaveTrack.cpp:1841
Effect::SupportsRealtime
bool SupportsRealtime() override
Whether the effect supports realtime previewing (while audio is playing).
Definition: Effect.cpp:212
EffectProcessor::RealtimeSuspend
virtual bool RealtimeSuspend()=0
Effect::RealtimeSuspend
bool RealtimeSuspend() override
Definition: Effect.cpp:399
ident
static CommandHandlerObject & ident(AudacityProject &project)
Definition: ModNullCallback.cpp:65
ChannelNameFrontRight
@ ChannelNameFrontRight
Definition: EffectInterface.h:166
Effect
An Effect object is at once host and client: it is self-hosting.
Definition: Effect.h:77
EffectTypeGenerate
@ EffectTypeGenerate
Definition: EffectInterface.h:55
TimeWarper.h
Contains declarations for TimeWarper, IdentityTimeWarper, ShiftTimeWarper, LinearTimeWarper,...
SelectFile
FilePath SelectFile(FileNames::Operation op, const TranslatableString &message, const FilePath &default_path, const FilePath &default_filename, const FileExtension &default_extension, const FileTypes &fileTypes, int flags, wxWindow *parent)
Definition: SelectFile.cpp:17
RegistryPaths
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
PluginPath
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
Definition: Identifier.h:214
TrackList::Channels
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1483
LabelTrack::GetStartTime
double GetStartTime() const override
Definition: LabelTrack.cpp:329
Format
Abstract base class used in importing a file.
Effect::IsLegacy
bool IsLegacy() override
Definition: Effect.cpp:202
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1288
Effect::GetAudioInCount
unsigned GetAudioInCount() override
Definition: Effect.cpp:244
EffectDefinitionInterface::GetSquashedName
static Identifier GetSquashedName(const Identifier &ident)
A utility that strips spaces and CamelCases a name.
Definition: EffectInterface.cpp:11
Effect::Effect
Effect()
Definition: Effect.cpp:65
Effect::SetPreviewFullSelectionFlag
void SetPreviewFullSelectionFlag(bool previewDurationFlag)
Definition: Effect.cpp:1769
EffectProcessor::RealtimeInitialize
virtual bool RealtimeInitialize()=0
Effect::mT1
double mT1
Definition: Effect.h:424
ArrayOf::reinit
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
Effect::LoadUserPreset
bool LoadUserPreset(const RegistryPath &name) override
Change settings to a user-named preset.
Definition: Effect.cpp:530
wxWidgetsWindowPlacement.h
Effect::~Effect
virtual ~Effect()
Definition: Effect.cpp:99
Effect::Delegate
bool Delegate(Effect &delegate, wxWindow &parent, const EffectDialogFactory &factory)
Definition: Effect.cpp:1113
BUILTIN_EFFECT_PREFIX
#define BUILTIN_EFFECT_PREFIX
Definition: Effect.h:45
EffectTypeNone
@ EffectTypeNone
Definition: EffectInterface.h:53
EffectDefinitionInterface::IsInteractive
virtual bool IsInteractive()=0
Whether the effect needs a dialog for entry of settings.
Effect::mDurationFormat
NumericFormatSymbol mDurationFormat
Definition: Effect.h:476
DefaultPlayOptions
AudioIOStartStreamOptions DefaultPlayOptions(AudacityProject &project, bool newDefault)
Definition: ProjectAudioManager.cpp:1144
Effect::RealtimeResume
bool RealtimeResume() noexcept override
Definition: Effect.cpp:407
Effect::ModifyAnalysisTrack
ModifiedAnalysisTrack ModifyAnalysisTrack(const LabelTrack *pOrigTrack, const wxString &name=wxString())
Definition: Effect.cpp:1949
XO
#define XO(s)
Definition: Internat.h:31
Effect::EnablePreview
bool EnablePreview(bool enable=true)
Definition: Effect.cpp:1725
Effect::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Change settings to those stored in parms.
Definition: Effect.cpp:520
EffectDefinitionInterface::LoadFactoryDefaults
virtual bool LoadFactoryDefaults()=0
Change settings back to "factory default".
Effect::mTracks
TrackList * mTracks
Definition: Effect.h:468
ProjectSettings::Get
static ProjectSettings & Get(AudacityProject &project)
Definition: ProjectSettings.cpp:45
Effect::ProcessFinalize
bool ProcessFinalize() override
Called for destructive, non-realtime effect computation.
Definition: Effect.cpp:346
TrackList::Add
TrackKind * Add(const std::shared_ptr< TrackKind > &t)
Definition: Track.h:1502
EffectDefinitionInterface::SetAutomationParameters
virtual bool SetAutomationParameters(CommandParameters &parms)=0
Change settings to those stored in parms.
Effect::mNumAudioIn
size_t mNumAudioIn
Definition: Effect.h:488
LabelTrack
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:89
CommandParameters::GetParameters
bool GetParameters(wxString &parms)
Definition: EffectAutomationParameters.h:258
NYQUISTEFFECTS_FAMILY
#define NYQUISTEFFECTS_FAMILY
Definition: Effect.h:65
Effect::IsBatchProcessing
virtual bool IsBatchProcessing()
Definition: Effect.cpp:960
Effect::mPass
int mPass
Definition: Effect.h:431
ChannelNameFrontLeft
@ ChannelNameFrontLeft
Definition: EffectInterface.h:165
SelectedRegion::UndefinedFrequency
static const int UndefinedFrequency
Definition: SelectedRegion.h:44
Effect::PopulateUI
bool PopulateUI(ShuttleGui &S) final
Adds controls to a panel that is given as the parent window of S
Definition: Effect.cpp:594
Effect::SetHost
bool SetHost(EffectHostInterface *host) override
Definition: Effect.cpp:234
ChannelNameEOL
@ ChannelNameEOL
Definition: EffectInterface.h:161
ChannelName
ChannelName
Definition: EffectInterface.h:159
Effect::GetUserPresetsGroup
RegistryPath GetUserPresetsGroup(const RegistryPath &name) override
Definition: Effect.cpp:809
EffectDefinitionInterface::SupportsRealtime
virtual bool SupportsRealtime()=0
Whether the effect supports realtime previewing (while audio is playing).
Effect::mPreviewFullSelection
bool mPreviewFullSelection
Definition: Effect.h:473
Effect::InitPass2
virtual bool InitPass2()
Definition: Effect.cpp:1134
EffectProcessor::GetTailSize
virtual size_t GetTailSize()=0
EffectDefinitionInterface::SupportsAutomation
virtual bool SupportsAutomation()=0
Whether the effect can be used without the UI, in a macro.
FileNames::AllFiles
FILES_API const FileType AllFiles
Definition: FileNames.h:71
Effect::AddToOutputTracks
Track * AddToOutputTracks(const std::shared_ptr< Track > &t)
Definition: Effect.cpp:1861
WaveTrack::ClearAndPaste
void ClearAndPaste(double t0, double t1, const Track *src, bool preserve=true, bool merge=true, const TimeWarper *effectWarper=NULL)
Definition: WaveTrack.cpp:917
Effect::SaveUserPreset
bool SaveUserPreset(const RegistryPath &name) override
Save current settings as a user-named preset.
Definition: Effect.cpp:547
PluginSettings::SetConfig
bool SetConfig(EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, const Value &value)
Definition: ConfigInterface.h:97
PresetTypes
static const FileNames::FileTypes & PresetTypes()
Definition: Effect.cpp:640
TrackList::SelectedLeaders
auto SelectedLeaders() -> TrackIterRange< TrackType >
Definition: Track.h:1430
Effect::TransferDataFromWindow
virtual bool TransferDataFromWindow()
Definition: Effect.cpp:1689
t2bHash
std::unordered_map< void *, bool > t2bHash
Definition: Effect.cpp:63
BasicUI::ProgressShowCancel
@ ProgressShowCancel
Definition: BasicUI.h:139
WaveTrack::EmptyCopy
Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory={}) const
Definition: WaveTrack.cpp:709
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
Effect::AddAnalysisTrack
std::shared_ptr< AddedAnalysisTrack > AddAnalysisTrack(const wxString &name=wxString())
Definition: Effect.cpp:1898
Effect::mFactory
WaveTrackFactory * mFactory
Definition: Effect.h:419
NotifyingSelectedRegion::t1
double t1() const
Definition: ViewInfo.h:35
wxWidgetsWindowPlacement
Window placement information for wxWidgetsBasicUI can be constructed from a wxWindow pointer.
Definition: wxWidgetsWindowPlacement.h:22
Effect::ProcessPass
virtual bool ProcessPass()
Definition: Effect.cpp:1165
ComponentInterface::GetVendor
virtual VendorSymbol GetVendor()=0
Effect::RealtimeProcessEnd
bool RealtimeProcessEnd() noexcept override
Definition: Effect.cpp:438
EffectProcessor::SetBlockSize
virtual size_t SetBlockSize(size_t maxBlockSize)=0
Effect::GetMidiOutCount
int GetMidiOutCount() override
Definition: Effect.cpp:274
Effect::mIsBatch
bool mIsBatch
Definition: Effect.h:470
EffectProcessor::RealtimeProcessEnd
virtual bool RealtimeProcessEnd() noexcept=0
NotifyingSelectedRegion::setTimes
bool setTimes(double t0, double t1)
Definition: ViewInfo.cpp:51
Effect::GetDefaultDuration
double GetDefaultDuration()
Definition: Effect.cpp:764
WaveTrack::Set
void Set(constSamplePtr buffer, sampleFormat format, sampleCount start, size_t len)
Definition: WaveTrack.cpp:2194
floatSample
@ floatSample
Definition: SampleFormat.h:34
Effect::HideUI
bool HideUI() override
Definition: Effect.cpp:619
NumericConverter::TimeAndSampleFormat
static NumericFormatSymbol TimeAndSampleFormat()
Definition: NumericTextCtrl.cpp:692
ArraysOf::reinit
void reinit(Integral count)
Definition: MemoryX.h:109
WaveTrack::Holder
std::shared_ptr< WaveTrack > Holder
Definition: WaveTrack.h:105
Effect::End
virtual void End()
Definition: Effect.cpp:1675
Effect::GetAudioOutCount
unsigned GetAudioOutCount() override
Definition: Effect.cpp:254
Effect::SetSampleRate
void SetSampleRate(double rate) override
Definition: Effect.cpp:284
Effect::AddedAnalysisTrack::~AddedAnalysisTrack
~AddedAnalysisTrack()
Definition: Effect.cpp:1890
Effect::ProcessBlock
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override
Called for destructive, non-realtime effect computation.
Definition: Effect.cpp:356
Effect::mProjectRate
double mProjectRate
Definition: Effect.h:416
Effect::mBufferSize
size_t mBufferSize
Definition: Effect.h:491
NumericConverter::DefaultSelectionFormat
static NumericFormatSymbol DefaultSelectionFormat()
Definition: NumericTextCtrl.cpp:690
AudacityException
Base class for exceptions specially processed by the application.
Definition: AudacityException.h:33
ViewInfo::selectedRegion
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:215
Effect::inputTracks
const TrackList * inputTracks() const
Definition: Effect.h:420
Effect::PopulateOrExchange
virtual void PopulateOrExchange(ShuttleGui &S)
Definition: Effect.cpp:1679
MixAndRender
void MixAndRender(TrackList *tracks, WaveTrackFactory *trackFactory, double rate, sampleFormat format, double startTime, double endTime, WaveTrack::Holder &uLeft, WaveTrack::Holder &uRight)
Mixes together all input tracks, applying any envelopes, amplitude gain, panning, and real-time effec...
Definition: MixAndRender.cpp:20
Effect::mT0
double mT0
Definition: Effect.h:423
factory
static RegisteredToolbarFactory factory
Definition: ControlToolBar.cpp:820
EffectProcessor::GetAudioOutCount
virtual unsigned GetAudioOutCount()=0
Track::Offset
void Offset(double t)
Definition: Track.h:441
ArraysOf< float >
ShuttleGetAutomation
Shuttle that gets parameter values into a string.
Definition: ShuttleAutomation.h:20
Effect::ValidateUI
bool ValidateUI() override
Definition: Effect.cpp:614
LabelTrack::GetEndTime
double GetEndTime() const override
Definition: LabelTrack.cpp:337
Effect::mIsLinearEffect
bool mIsLinearEffect
Definition: Effect.h:471
SyncLock::IsSyncLockSelected
static bool IsSyncLockSelected(const Track *pTrack)
Definition: SyncLock.cpp:43
Effect::GetFactoryPresets
RegistryPaths GetFactoryPresets() override
Report names of factory presets.
Definition: Effect.cpp:562
ComponentInterface::GetPath
virtual PluginPath GetPath()=0
PluginManager.h
SampleTrack::GetFloats
bool GetFloats(float *buffer, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
Retrieve samples from a track in floating-point format, regardless of the storage format.
Definition: SampleTrack.h:64
EffectProcessor::ProcessBlock
virtual size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)=0
Called for destructive, non-realtime effect computation.
LabelTrack::SetOffset
void SetOffset(double dOffset) override
Definition: LabelTrack.cpp:159
Effect::LoadFactoryDefaults
bool LoadFactoryDefaults() override
Change settings back to "factory default".
Definition: Effect.cpp:582
Effect::GetLatency
sampleCount GetLatency() override
Called for destructive, non-realtime effect computation.
Definition: Effect.cpp:316
EffectProcessor::SetSampleRate
virtual void SetSampleRate(double rate)=0
Effect::mProgress
BasicUI::ProgressDialog * mProgress
Definition: Effect.h:415
TrackList::MakeMultiChannelTrack
bool MakeMultiChannelTrack(Track &first, int nChannels, bool aligned)
Converts channels to a multichannel track.
Definition: Track.cpp:615
Effect::GetType
EffectType GetType() override
Type determines how it behaves.
Definition: Effect.cpp:110
Effect::CheckWhetherSkipEffect
virtual bool CheckWhetherSkipEffect()
Definition: Effect.h:258
Effect::SupportsAutomation
bool SupportsAutomation() override
Whether the effect can be used without the UI, in a macro.
Definition: Effect.cpp:222
Effect::kCurrentSettingsIdent
static const wxString kCurrentSettingsIdent
Definition: Effect.h:498
Effect::ReplaceProcessedTracks
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:1956
name
const TranslatableString name
Definition: Distortion.cpp:98
Effect::DoEffect
bool DoEffect(double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={})
Definition: Effect.cpp:979
PluginSettings::GetConfig
bool GetConfig(EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)
Definition: ConfigInterface.h:70
kPlayID
static const int kPlayID
Definition: Effect.cpp:54
Track::Fallthrough
Continuation<> Fallthrough
Type of arguments passed as optional second parameter to TypeSwitch<void>() cases.
Definition: Track.h:499
Track::RightChannel
@ RightChannel
Definition: Track.h:262
Effect::ExportPresets
void ExportPresets() override
Definition: Effect.cpp:649
QualitySettings::DefaultSampleRate
PROJECT_RATE_API IntSetting DefaultSampleRate
Definition: QualitySettings.cpp:15
Effect::mNumAudioOut
size_t mNumAudioOut
Definition: Effect.h:489
ProjectSettings::GetSelectionFormat
const NumericFormatSymbol & GetSelectionFormat() const
Definition: ProjectSettings.cpp:148
SyncLock::IsSelectedOrSyncLockSelected
static bool IsSelectedOrSyncLockSelected(const Track *pTrack)
Definition: SyncLock.cpp:73
Effect::kUserPresetIdent
static const wxString kUserPresetIdent
Definition: Effect.h:496
Effect::InitPass1
virtual bool InitPass1()
Definition: Effect.cpp:1129
TransactionScope
RAII for a database transaction, possibly nested.
Definition: TransactionScope.h:28
Effect::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: Effect.cpp:130
EffectDefinitionInterface::GetType
virtual EffectType GetType()=0
Type determines how it behaves.
Effect::mUIFlags
unsigned mUIFlags
Definition: Effect.h:439
Effect::CalcPreviewInputLength
virtual double CalcPreviewInputLength(double previewLength)
Definition: Effect.cpp:2048
WaveTrack::GetStartTime
double GetStartTime() const override
Get the time at which the first clip in the track starts.
Definition: WaveTrack.cpp:1994
Effect::TestUIFlags
unsigned TestUIFlags(unsigned mask)
Definition: Effect.cpp:956
NumericConverter::HoursMinsSecondsFormat
static NumericFormatSymbol HoursMinsSecondsFormat()
Definition: NumericTextCtrl.cpp:696
Effect::mNumChannels
unsigned mNumChannels
Definition: Effect.h:493
ComponentInterface::GetDescription
virtual TranslatableString GetDescription()=0
Effect::RealtimeFinalize
bool RealtimeFinalize() override
Definition: Effect.cpp:389
WaveTrack::GetMaxBlockSize
size_t GetMaxBlockSize() const override
This returns a nonnegative number of samples meant to size a memory buffer.
Definition: WaveTrack.cpp:1811
Setting::ReadWithDefault
bool ReadWithDefault(T *pVar, const T &defaultValue) const
overload of ReadWithDefault returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:133
ChannelNames
enum ChannelName * ChannelNames
Effect::GetFactoryDefaultsGroup
RegistryPath GetFactoryDefaultsGroup() override
Definition: Effect.cpp:825
Effect::mOutputTracks
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:422
ViewInfo.h
EffectProcessor::RealtimeFinalize
virtual bool RealtimeFinalize()=0
Effect::RealtimeAddProcessor
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override
Definition: Effect.cpp:379
EffectDefinitionInterface::GetFactoryPresets
virtual RegistryPaths GetFactoryPresets()=0
Report names of factory presets.
Effect::ModifiedAnalysisTrack::Commit
void Commit()
Definition: Effect.cpp:1933
BasicUI::ErrorDialogOptions
Options for variations of error dialogs; the default is for modal dialogs.
Definition: BasicUI.h:49
NotifyingSelectedRegion::f0
double f0() const
Definition: ViewInfo.h:36
Effect::ShowOptions
void ShowOptions() override
Definition: Effect.cpp:753
Effect::GetCurrentSettingsGroup
RegistryPath GetCurrentSettingsGroup() override
Definition: Effect.cpp:820
WaveTrackFactory
Used to create or clone a WaveTrack, with appropriate context from the project that will own the trac...
Definition: WaveTrack.h:609
Effect::Preview
virtual void Preview(bool dryOnly)
Definition: Effect.cpp:2053
Effect::CanExportPresets
bool CanExportPresets() override
Definition: Effect.cpp:635
RegistryPath
wxString RegistryPath
Definition: Identifier.h:218
kFFwdID
static const int kFFwdID
Definition: Effect.cpp:56
Track::GetSelected
bool GetSelected() const
Definition: Track.h:428
Effect::mBlockSize
size_t mBlockSize
Definition: Effect.h:492
Effect::HasOptions
bool HasOptions() override
Definition: Effect.cpp:748
Effect::RealtimeProcess
size_t RealtimeProcess(int group, float **inbuf, float **outbuf, size_t numSamples) override
Definition: Effect.cpp:425
samplePtr
char * samplePtr
Definition: SampleFormat.h:49
Effect::Init
virtual bool Init()
Definition: Effect.cpp:1124
Effect::GetVendor
VendorSymbol GetVendor() override
Definition: Effect.cpp:140
Effect::SetDuration
void SetDuration(double duration) override
Definition: Effect.cpp:791
TrackList::GetOwner
AudacityProject * GetOwner()
Definition: Track.h:1323
Effect::ModifiedAnalysisTrack::mpTrack
LabelTrack * mpTrack
Definition: Effect.h:392
Effect::ModifiedAnalysisTrack
Definition: Effect.h:369
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
NotifyingSelectedRegion::f1
double f1() const
Definition: ViewInfo.h:37
Effect::mIsPreview
bool mIsPreview
Definition: Effect.h:478
Effect::mSampleRate
double mSampleRate
Definition: Effect.h:418
Effect::mOMap
std::vector< Track * > mOMap
Definition: Effect.h:481
Effect::RealtimeInitialize
bool RealtimeInitialize() override
Definition: Effect.cpp:366
EffectProcessor::GetLatency
virtual sampleCount GetLatency()=0
Called for destructive, non-realtime effect computation.
BasicUI
Definition: Effect.h:47
EffectDefinitionInterface
EffectDefinitionInterface is a ComponentInterface that adds some basic read-only information about ef...
Definition: EffectInterface.h:74
title
static const auto title
Definition: NoUpdatesAvailableDialog.cpp:22
QualitySettings.h
Effect::GetFamily
EffectFamilySymbol GetFamily() override
Report identifier and user-visible name of the effect protocol.
Definition: Effect.cpp:170
EffectProcessor::RealtimeAddProcessor
virtual bool RealtimeAddProcessor(unsigned numChannels, float sampleRate)=0
Effect::SetPresetParameters
void SetPresetParameters(const wxArrayString *Names, const wxArrayString *Values)
Definition: Effect.h:195
Track::SetName
void SetName(const wxString &n)
Definition: Track.cpp:77
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:224
Effect::mUIParent
wxWindow * mUIParent
Definition: Effect.h:438
Effect::GetDescription
TranslatableString GetDescription() override
Definition: Effect.cpp:160
Effect::CountWaveTracks
void CountWaveTracks()
Definition: Effect.cpp:2042
Effect::ProcessInitialize
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap=NULL) override
Called for destructive, non-realtime effect computation.
Definition: Effect.cpp:336
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
Effect::mNumGroups
int mNumGroups
Definition: Effect.h:484
BasicUI::ProgressDialog
Abstraction of a progress dialog with well defined time-to-completion estimate.
Definition: BasicUI.h:154
Effect::GetPath
PluginPath GetPath() override
Definition: Effect.cpp:120
kRewindID
static const int kRewindID
Definition: Effect.cpp:55
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
Effect::GetBounds
void GetBounds(const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
Definition: Effect.cpp:1804
EffectProcessor::GetAudioInCount
virtual unsigned GetAudioInCount()=0
Effect::IncludeNotSelectedPreviewTracks
void IncludeNotSelectedPreviewTracks(bool includeNotSelected)
Definition: Effect.cpp:1775
Effect::IsDefault
bool IsDefault() override
Whether the effect sorts "above the line" in the menus.
Definition: Effect.cpp:192
TrackList::Replace
ListOfTracks::value_type Replace(Track *t, const ListOfTracks::value_type &with)
Definition: Track.cpp:577
Effect::IsGraphicalUI
bool IsGraphicalUI() override
Definition: Effect.cpp:609
WaveTrack::GetRate
double GetRate() const override
Definition: WaveTrack.cpp:495
Effect::ProcessTrack
bool ProcessTrack(int count, ChannelNames map, WaveTrack *left, WaveTrack *right, sampleCount start, sampleCount len, FloatBuffers &inBuffer, FloatBuffers &outBuffer, ArrayOf< float * > &inBufPos, ArrayOf< float * > &outBufPos)
Definition: Effect.cpp:1313
ComponentInterfaceSymbol::Internal
const wxString & Internal() const
Definition: ComponentInterfaceSymbol.h:55
Effect::nEffectsDone
static int nEffectsDone
Definition: Effect.h:335
EffectUIClientInterface::SetHost
virtual bool SetHost(EffectHostInterface *host)=0
ExceptionType::Internal
@ Internal
Indicates internal failure from Audacity.
TrackList::Create
static std::shared_ptr< TrackList > Create(AudacityProject *pOwner)
Definition: Track.cpp:393
Effect::TotalProgress
bool TotalProgress(double frac, const TranslatableString &={})
Definition: Effect.cpp:1780
SampleTrack::TimeToLongSamples
sampleCount TimeToLongSamples(double t0) const
Convert correctly between an (absolute) time in seconds and a number of samples.
Definition: SampleTrack.cpp:35
EffectProcessor::ProcessInitialize
virtual bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap=NULL)=0
Called for destructive, non-realtime effect computation.
Effect::RealtimeProcessStart
bool RealtimeProcessStart() override
Definition: Effect.cpp:415
WaveTrack::Append
bool Append(constSamplePtr buffer, sampleFormat format, size_t len, unsigned int stride=1) override
Definition: WaveTrack.cpp:1771
EffectDefinitionInterface::GetAutomationParameters
virtual bool GetAutomationParameters(CommandParameters &parms)=0
Save current settings into parms.
GlobalHook::Call
static result_type Call(Arguments &&...arguments)
Null check of the installed function is done for you.
Definition: GlobalVariable.h:155
Effect::GetDefinition
EffectDefinitionInterface & GetDefinition() override
Definition: Effect.cpp:759
Effect::ModifiedAnalysisTrack::~ModifiedAnalysisTrack
~ModifiedAnalysisTrack()
Definition: Effect.cpp:1938
FileNames::FileTypes
std::vector< FileType > FileTypes
Definition: FileNames.h:76
Effect::GetDurationFormat
NumericFormatSymbol GetDurationFormat() override
Definition: Effect.cpp:779
NotifyingSelectedRegion::t0
double t0() const
Definition: ViewInfo.h:34
params
EffectDistortion::Params params
Definition: Distortion.cpp:99
Effect::mHostUIDialog
wxWeakRef< wxDialog > mHostUIDialog
This smart pointer tracks the lifetime of the dialog.
Definition: Effect.h:435
Effect::GetSavedStateGroup
virtual wxString GetSavedStateGroup()
Definition: Effect.cpp:830
Effect::kFactoryDefaultsIdent
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:499
GuardedCall
R GuardedCall(const F1 &body, const F2 &handler=F2::Default(), F3 delayedHandler=DefaultDelayedHandlerAction) noexcept(noexcept(handler(std::declval< AudacityException * >())) &&noexcept(handler(nullptr)) &&noexcept(std::function< void(AudacityException *)>{std::move(delayedHandler)}))
Execute some code on any thread; catch any AudacityException; enqueue error report on the main thread...
Definition: AudacityException.h:207
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1379
TrackList::Remove
TrackNodePointer Remove(Track *t)
Remove the Track and return an iterator to what followed it.
Definition: Track.cpp:651
Effect::Startup
virtual bool Startup()
Definition: Effect.cpp:867
ComponentInterface::GetName
TranslatableString GetName()
Definition: PluginManager.cpp:1838
Effect::SetAutomationParametersFromString
virtual bool SetAutomationParametersFromString(const wxString &parms)
Definition: Effect.cpp:895
TransactionScope::Commit
bool Commit()
Commit the transaction.
Definition: TransactionScope.cpp:48
ChannelNameMono
@ ChannelNameMono
Definition: EffectInterface.h:163
Effect::ShowHostInterface
int ShowHostInterface(wxWindow &parent, const EffectDialogFactory &factory, bool forceModal=false) override
Definition: Effect.cpp:470
ComponentInterface::GetVersion
virtual wxString GetVersion()=0
AudioIO::Get
static AudioIO * Get()
Definition: AudioIO.cpp:140
EffectType
EffectType
Definition: EffectInterface.h:52
safenew
#define safenew
Definition: MemoryX.h:10
QUANTIZED_TIME
#define QUANTIZED_TIME(time, rate)
Definition: MemoryX.h:500
Effect::kFactoryPresetIdent
static const wxString kFactoryPresetIdent
Definition: Effect.h:497
LabelTrack::Copy
Track::Holder Copy(double t0, double t1, bool forClipboard=true) const override
Definition: LabelTrack.cpp:695
limitSampleBufferSize
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:23
Effect::ModifiedAnalysisTrack::mpOrigTrack
std::shared_ptr< Track > mpOrigTrack
Definition: Effect.h:393
ComponentInterface::DefineParams
virtual bool DefineParams(ShuttleParams &WXUNUSED(S))
Definition: ComponentInterface.h:85
EffectDefinitionInterface::GetFamily
virtual EffectFamilySymbol GetFamily()=0
Report identifier and user-visible name of the effect protocol.
Effect::TrackGroupProgress
bool TrackGroupProgress(int whichGroup, double frac, const TranslatableString &={})
Definition: Effect.cpp:1796
PasteTimeWarper
Unit slope but with either a jump (pasting more) or a flat interval (pasting less)
Definition: TimeWarper.h:181
Effect::SetBlockSize
size_t SetBlockSize(size_t maxBlockSize) override
Definition: Effect.cpp:294
Track::LeftChannel
@ LeftChannel
Definition: Track.h:261
Effect::mIMap
std::vector< Track * > mIMap
Definition: Effect.h:480
EffectProcessor::GetBlockSize
virtual size_t GetBlockSize() const =0
TrackList::Selected
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1396
WaveTrackFactory::NewWaveTrack
std::shared_ptr< WaveTrack > NewWaveTrack(sampleFormat format=(sampleFormat) 0, double rate=0)
Definition: WaveTrack.cpp:126
Effect::TrackProgress
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={})
Definition: Effect.cpp:1788
ArrayOf
Memory.h template class for making an array of float, bool, etc.
Definition: MemoryX.h:27
Effect::GetVersion
wxString GetVersion() override
Definition: Effect.cpp:150
Effect::Process
virtual bool Process()
Definition: Effect.cpp:1139
Effect::mPreviewWithNotSelected
bool mPreviewWithNotSelected
Definition: Effect.h:472
pdlgHideCancelButton
@ pdlgHideCancelButton
Definition: ProgressDialog.h:39
Effect::ShowClientInterface
int ShowClientInterface(wxWindow &parent, wxDialog &dialog, bool forceModal=false) override
Definition: Effect.cpp:448
PluginSettings::Private
@ Private
Definition: PluginInterface.h:56
EffectDefinitionInterface::IsDefault
virtual bool IsDefault()=0
Whether the effect sorts "above the line" in the menus.
Effect::GetTailSize
size_t GetTailSize() override
Definition: Effect.cpp:326
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
LabelTrack::Holder
std::shared_ptr< LabelTrack > Holder
Definition: LabelTrack.h:109
Effect::LoadFactoryPreset
bool LoadFactoryPreset(int id) override
Change settings to the preset whose name is GetFactoryPresets()[id]
Definition: Effect.cpp:572
Effect::AddedAnalysisTrack::Commit
void Commit()
Definition: Effect.cpp:1885
Effect::SetBatchProcessing
virtual void SetBatchProcessing(bool start)
Definition: Effect.cpp:965
NotifyingSelectedRegion
Definition: ViewInfo.h:31