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