Audacity  2.2.2
Public Member Functions | Protected Member Functions | List of all members
Generator Class Referenceabstract

#include <Generator.h>

Inheritance diagram for Generator:
Effect EffectClientInterface EffectUIClientInterface EffectHostInterface EffectDefinitionInterface ConfigClientInterface IdentInterface ParamsInterface BlockGenerator EffectSilence

Public Member Functions

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

Protected Member Functions

virtual bool GenerateTrack (WaveTrack *tmp, const WaveTrack &track, int ntrack)=0
 
bool Init () override
 
virtual void BeforeGenerate ()
 
virtual void BeforeTrack (const WaveTrack &WXUNUSED(track))
 
virtual void Success ()
 
virtual void Failure ()
 
bool Process () override
 
- Protected Member Functions inherited from Effect
virtual bool PromptUser (wxWindow *parent)
 
virtual bool CheckWhetherSkipEffect ()
 
virtual bool ProcessPass ()
 
virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual int GetPass ()
 
virtual void End ()
 
virtual double CalcPreviewInputLength (double previewLength)
 
virtual void Preview (bool dryOnly)
 
virtual void PopulateOrExchange (ShuttleGui &S)
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
virtual bool EnableApply (bool enable=true)
 
virtual bool EnablePreview (bool enable=true)
 
virtual void EnableDebug (bool enable=true)
 
bool TotalProgress (double frac)
 
bool TrackProgress (int whichTrack, double frac, const wxString &=wxEmptyString)
 
bool TrackGroupProgress (int whichGroup, double frac, const wxString &=wxEmptyString)
 
int GetNumWaveTracks ()
 
int GetNumWaveGroups ()
 
void GetSamples (const WaveTrack *track, sampleCount *start, sampleCount *len)
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing ()
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void CopyInputTracks ()
 
void CopyInputTracks (int trackType)
 
std::shared_ptr
< AddedAnalysisTrack
AddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
TrackAddToOutputTracks (std::unique_ptr< Track > &&t)
 
TrackListinputTracks () const
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Protected Attributes inherited from Effect
ProgressDialogmProgress
 
double mProjectRate
 
double mSampleRate
 
SelectedRegionmpSelectedRegion {}
 
TrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
double mF0
 
double mF1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 
sampleCount mSampleCnt
 
int mOutputTracksType
 

Detailed Description

Definition at line 24 of file Generator.h.

Constructor & Destructor Documentation

Generator::Generator ( )
inline

Definition at line 27 of file Generator.h.

27 { }

Member Function Documentation

virtual void Generator::BeforeGenerate ( )
inlineprotectedvirtual

Definition at line 41 of file Generator.h.

Referenced by Process().

41 { };
virtual void Generator::BeforeTrack ( const WaveTrack WXUNUSEDtrack)
inlineprotectedvirtual

Definition at line 42 of file Generator.h.

Referenced by Process().

42 { };
virtual void Generator::Failure ( )
inlineprotectedvirtual

Definition at line 47 of file Generator.h.

Referenced by Process().

47 {};
virtual bool Generator::GenerateTrack ( WaveTrack tmp,
const WaveTrack track,
int  ntrack 
)
protectedpure virtual

Implemented in BlockGenerator, and EffectSilence.

Referenced by Process().

bool Generator::Init ( )
inlineoverrideprotectedvirtual

Reimplemented from Effect.

Definition at line 37 of file Generator.h.

37 { return true; }
bool Generator::Process ( )
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 28 of file Generator.cpp.

References _(), Track::All, BeforeGenerate(), BeforeTrack(), WaveTrack::Clear(), WaveTrack::ClearAndPaste(), Effect::CopyInputTracks(), Failure(), GenerateTrack(), GetActiveProject(), Effect::GetDuration(), AudacityPrefs::GetEditClipsCanMove(), WaveTrack::GetRate(), WaveTrack::GetSampleFormat(), AudacityProject::GetSel0(), AudacityProject::GetSel1(), gPrefs, WaveTrack::IsEmpty(), Effect::MessageBox(), Effect::mFactory, Effect::mOutputTracks, Effect::mT0, Effect::mT1, TrackFactory::NewWaveTrack(), Effect::ReplaceProcessedTracks(), Success(), and Track::Wave.

29 {
30  if (GetDuration() < 0.0)
31  return false;
32 
33 
34  // Set up mOutputTracks.
35  // This effect needs Track::All for sync-lock grouping.
37 
38  // Iterate over the tracks
39  bool bGoodResult = true;
40  int ntrack = 0;
41  TrackListIterator iter(mOutputTracks.get());
42  Track* t = iter.First();
43 
44  while (t != NULL)
45  {
46  if (t->GetKind() == Track::Wave && t->GetSelected()) {
47  WaveTrack* track = (WaveTrack*)t;
48 
49  bool editClipCanMove = gPrefs->GetEditClipsCanMove();
50 
51  //if we can't move clips, and we're generating into an empty space,
52  //make sure there's room.
53  if (!editClipCanMove &&
54  track->IsEmpty(mT0, mT1+1.0/track->GetRate()) &&
55  !track->IsEmpty(mT0, mT0+GetDuration()-(mT1-mT0)-1.0/track->GetRate()))
56  {
58  _("There is not enough room available to generate the audio"),
59  wxICON_STOP,
60  _("Error"));
61  Failure();
62  return false;
63  }
64 
65  if (GetDuration() > 0.0)
66  {
68  // Create a temporary track
71  track->GetRate())
72  );
73  BeforeTrack(*track);
75 
76  // Fill it with data
77  if (!GenerateTrack(&*tmp, *track, ntrack))
78  bGoodResult = false;
79  else {
80  // Transfer the data from the temporary track to the actual one
81  tmp->Flush();
82  StepTimeWarper warper{
84  track->ClearAndPaste(
85  p->GetSel0(), p->GetSel1(), &*tmp, true, false, &warper);
86  }
87 
88  if (!bGoodResult) {
89  Failure();
90  return false;
91  }
92  }
93  else
94  {
95  // If the duration is zero, there's no need to actually
96  // generate anything
97  track->Clear(mT0, mT1);
98  }
99 
100  ntrack++;
101  }
102  else if (t->IsSyncLockSelected()) {
103  t->SyncLockAdjust(mT1, mT0 + GetDuration());
104  }
105  // Move on to the next track
106  t = iter.Next();
107  }
108 
109  Success();
110 
111  this->ReplaceProcessedTracks(bGoodResult);
112 
113  mT1 = mT0 + GetDuration(); // Update selection.
114 
115  return true;
116 }
Like identity but with a jump.
Definition: TimeWarper.h:180
double mT1
Definition: Effect.h:461
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
int MessageBox(const wxString &message, long style=DefaultMessageBoxStyle, const wxString &titleStr=wxString{})
Definition: Effect.cpp:2664
double GetSel0() const
Definition: Project.h:204
virtual void BeforeGenerate()
Definition: Generator.h:41
double GetDuration() override
Definition: Effect.cpp:724
void CopyInputTracks()
Definition: Effect.cpp:2038
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: Effect.cpp:2169
void ClearAndPaste(double t0, double t1, const Track *src, bool preserve=true, bool merge=true, const TimeWarper *effectWarper=NULL)
Definition: WaveTrack.cpp:782
void Clear(double t0, double t1) override
Definition: WaveTrack.cpp:678
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
std::unique_ptr< WaveTrack > Holder
Definition: WaveTrack.h:90
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:101
virtual bool GenerateTrack(WaveTrack *tmp, const WaveTrack &track, int ntrack)=0
virtual void Success()
Definition: Generator.h:46
std::unique_ptr< WaveTrack > NewWaveTrack(sampleFormat format=(sampleFormat) 0, double rate=0)
Definition: WaveTrack.cpp:78
An iterator for a TrackList.
Definition: Track.h:401
virtual void Failure()
Definition: Generator.h:47
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
TrackFactory * mFactory
Definition: Effect.h:457
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308
sampleFormat GetSampleFormat() const
Definition: WaveTrack.h:146
double GetRate() const
Definition: WaveTrack.cpp:398
double GetSel1() const
Definition: Project.h:205
virtual void BeforeTrack(const WaveTrack &WXUNUSED(track))
Definition: Generator.h:42
bool IsEmpty(double t0, double t1) const
Returns true if there are no WaveClips in the specified region.
Definition: WaveTrack.cpp:495
std::shared_ptr< TrackList > mOutputTracks
Definition: Effect.h:459
bool GetEditClipsCanMove()
Definition: Prefs.cpp:158
double mT0
Definition: Effect.h:460
virtual void Generator::Success ( )
inlineprotectedvirtual

Definition at line 46 of file Generator.h.

Referenced by Process().

46 { };

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