Audacity 3.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
EffectTwoPassSimpleMono Class Reference

An Effect base class that implements a two pass process by using EffectSimpleMono. More...

#include <TwoPassSimpleMono.h>

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

Public Member Functions

bool Process (EffectInstance &instance, EffectSettings &settings) override
 Actually do the effect here. More...
 
- Public Member Functions inherited from StatefulEffect
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from StatefulEffectBase
virtual bool Init ()
 Call once to set up state for whole list of tracks to be processed. More...
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 Actually do the effect here. More...
 
virtual bool RealtimeInitialize (EffectSettings &settings, double sampleRate)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (EffectSettings &settings)
 settings are possibly changed, since last call, by an asynchronous dialog More...
 
virtual size_t RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 settings can be updated to let a dialog change appearance at idle More...
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t SetBlockSize (size_t maxBlockSize)
 
virtual size_t GetBlockSize () const
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () const override
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
bool LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 Change settings to a user-named preset. More...
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
bool LoadFactoryPreset (int id, EffectSettings &settings) const override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool LoadFactoryDefaults (EffectSettings &settings) const override
 Change settings back to "factory default". More...
 
unsigned GetAudioInCount () const override
 How many input buffers to allocate at once. More...
 
unsigned GetAudioOutCount () const override
 How many output buffers to allocate at once. More...
 
virtual const EffectParameterMethodsParameters () const
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal) override
 
std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) override
 Adds controls to a panel that is given as the parent window of S More...
 
bool IsGraphicalUI () override
 
bool ValidateUI (EffectSettings &) override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets (const EffectSettings &settings) const override
 
void ImportPresets (EffectSettings &settings) override
 
bool HasOptions () override
 
void ShowOptions () override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false) override
 Usually applies factory to self and given access. More...
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
bool LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
bool TransferDataFromWindow (EffectSettings &settings) override
 Update the given settings from controls. More...
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings)
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
 
bool EnableApply (bool enable=true)
 
wxWindow * GetUIParent ()
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
virtual int ShowClientInterface (wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal=false)=0
 
virtual bool IsGraphicalUI ()=0
 
virtual std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)=0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual bool CanExportPresets ()=0
 
virtual void ExportPresets (const EffectSettings &settings) const =0
 
virtual void ImportPresets (EffectSettings &settings)=0
 
virtual bool HasOptions ()=0
 
virtual void ShowOptions ()=0
 
virtual bool ValidateUI (EffectSettings &settings)=0
 
virtual bool CloseUI ()=0
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)=0
 Usually applies factory to self and given access. More...
 
virtual void Preview (EffectSettingsAccess &access, bool dryOnly)=0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual bool LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={}, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 Unfortunately complicated dual-use function. More...
 
virtual bool TransferDataToWindow (const EffectSettings &settings)=0
 Update controls for the settings. More...
 
virtual bool TransferDataFromWindow (EffectSettings &settings)=0
 Update the given settings from controls. More...
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
virtual unsigned GetAudioInCount () const =0
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const =0
 How many output buffers to allocate at once. More...
 
virtual int GetMidiInCount () const
 Function that has not yet found a use. More...
 
virtual int GetMidiOutCount () const
 Function that has not yet found a use. More...
 
- Public Member Functions inherited from EffectSettingsManager
virtual ~EffectSettingsManager ()
 
virtual bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings)
 
virtual bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const
 
virtual EffectSettings MakeSettings () const
 
virtual bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst, SettingsCopyDirection copyDirection) const
 Update one settings object from another. More...
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetType () const =0
 Type determines how it behaves. More...
 
virtual EffectType GetClassification () const
 Determines which menu it appears in; default same as GetType(). More...
 
virtual EffectFamilySymbol GetFamily () const =0
 Report identifier and user-visible name of the effect protocol. More...
 
virtual bool IsInteractive () const =0
 Whether the effect needs a dialog for entry of settings. More...
 
virtual bool IsDefault () const =0
 Whether the effect sorts "above the line" in the menus. More...
 
virtual RealtimeSince RealtimeSupport () const =0
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsRealtime () const
 
virtual bool SupportsAutomation () const =0
 Whether the effect has any automatable controls. More...
 
virtual bool EnablesDebug () const
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage () const
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage () const
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus () const
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

Protected Member Functions

virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual bool NewTrackPass1 ()
 
virtual bool NewTrackPass2 ()
 
virtual bool ProcessPass1 (float *WXUNUSED(buffer), size_t WXUNUSED(len))
 
virtual bool ProcessPass2 (float *WXUNUSED(buffer), size_t WXUNUSED(len))
 
virtual bool TwoBufferProcessPass1 (float *buffer1, size_t len1, float *WXUNUSED(buffer2), size_t WXUNUSED(len2))
 
virtual bool TwoBufferProcessPass2 (float *buffer1, size_t len1, float *WXUNUSED(buffer2), size_t WXUNUSED(len2))
 
void DisableSecondPass ()
 
- Protected Member Functions inherited from Effect
bool EnablePreview (bool enable=true)
 
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 Default implementation returns false. More...
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 Default implementation returns previewLength More...
 
virtual std::unique_ptr< EffectUIValidatorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)
 Add controls to effect panel; always succeeds. More...
 
bool TotalProgress (double frac, const TranslatableString &={}) const
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={}) const
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={}) const
 
int GetNumWaveTracks () const
 
int GetNumWaveGroups () const
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
- Protected Member Functions inherited from EffectBase
void Preview (EffectSettingsAccess &access, bool dryOnly) override
 
bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent, const EffectDialogFactory &dialogFactory, const EffectSettingsAccessPtr &pAccess) override
 Unfortunately complicated dual-use function. More...
 
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 

Protected Attributes

int mCurTrackNum
 
double mCurRate
 
double mCurT0
 
double mCurT1
 
int mCurChannel
 
int mPass
 
bool mSecondPassDisabled
 
std::shared_ptr< TrackListmWorkTracks
 
std::shared_ptr< TrackList > * mTrackLists [2]
 
- Protected Attributes inherited from Effect
wxWeakRef< wxDialog > mHostUIDialog
 This smart pointer tracks the lifetime of the dialog. More...
 
wxWindow * mUIParent {}
 
- Protected Attributes inherited from EffectBase
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0 {}
 
double mT1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 

Private Member Functions

bool ProcessOne (WaveTrack *t, WaveTrack *outTrack, sampleCount start, sampleCount end)
 
bool ProcessPass (EffectSettings &settings)
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , Since_3_2 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
static void IncEffectCounter ()
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 
- Static Public Attributes inherited from EffectPlugin
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 
- Static Protected Attributes inherited from EffectBase
static int nEffectsDone = 0
 

Detailed Description

An Effect base class that implements a two pass process by using EffectSimpleMono.

Inherit from it if your effect needs to pass twice over the data. It does the first pass on all selected tracks before going back and doing the second pass over all selected tracks.

Definition at line 20 of file TwoPassSimpleMono.h.

Member Function Documentation

◆ DisableSecondPass()

void EffectTwoPassSimpleMono::DisableSecondPass ( )
inlineprotected

Definition at line 68 of file TwoPassSimpleMono.h.

Referenced by EffectCompressor::InitPass1().

Here is the caller graph for this function:

◆ InitPass1()

bool EffectTwoPassSimpleMono::InitPass1 ( )
protectedvirtual

Reimplemented in EffectCompressor.

Definition at line 232 of file TwoPassSimpleMono.cpp.

233{
234 return true;
235}

Referenced by Process().

Here is the caller graph for this function:

◆ InitPass2()

bool EffectTwoPassSimpleMono::InitPass2 ( )
protectedvirtual

Reimplemented in EffectCompressor.

Definition at line 239 of file TwoPassSimpleMono.cpp.

240{
241 return true;
242}

Referenced by Process().

Here is the caller graph for this function:

◆ NewTrackPass1()

bool EffectTwoPassSimpleMono::NewTrackPass1 ( )
protectedvirtual

Reimplemented in EffectCompressor.

Definition at line 221 of file TwoPassSimpleMono.cpp.

222{
223 return true;
224}

Referenced by ProcessPass().

Here is the caller graph for this function:

◆ NewTrackPass2()

bool EffectTwoPassSimpleMono::NewTrackPass2 ( )
protectedvirtual

Definition at line 226 of file TwoPassSimpleMono.cpp.

227{
228 return true;
229}

Referenced by ProcessPass().

Here is the caller graph for this function:

◆ Process()

bool EffectTwoPassSimpleMono::Process ( EffectInstance instance,
EffectSettings settings 
)
overridevirtual

Actually do the effect here.

Returns
success

Implements StatefulEffectBase.

Definition at line 26 of file TwoPassSimpleMono.cpp.

27{
28 mPass = 0;
29 mSecondPassDisabled = false;
30
31 InitPass1();
32 this->CopyInputTracks(); // Set up mOutputTracks.
33
35 const_cast<AudacityProject*>( FindProject() ) );
36 for (auto track : mOutputTracks->Selected< WaveTrack >()) {
37 mWorkTracks->Add(track->EmptyCopy())->ConvertToSampleFormat(floatSample);
38 if( mT0 > 0 )
39 mWorkTracks->back()->InsertSilence(0, mT0);
40 }
41
44
45 bool bGoodResult = ProcessPass(settings);
46
47 if (bGoodResult && !mSecondPassDisabled)
48 {
49 mPass = 1;
50 if (InitPass2())
51 bGoodResult = ProcessPass(settings);
52 }
53
54 mWorkTracks->Clear();
55 mWorkTracks.reset();
56
57 this->ReplaceProcessedTracks(bGoodResult);
58 return bGoodResult;
59}
@ floatSample
Definition: SampleFormat.h:34
static Settings & settings()
Definition: TrackInfo.cpp:87
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
std::shared_ptr< TrackList > mOutputTracks
Definition: EffectBase.h:105
double mT0
Definition: EffectBase.h:106
void ReplaceProcessedTracks(const bool bGoodResult)
Definition: EffectBase.cpp:236
const AudacityProject * FindProject() const
Definition: EffectBase.cpp:315
void CopyInputTracks(bool allSyncLockSelected=false)
Definition: Effect.cpp:737
bool ProcessPass(EffectSettings &settings)
std::shared_ptr< TrackList > * mTrackLists[2]
std::shared_ptr< TrackList > mWorkTracks
static std::shared_ptr< TrackList > Create(AudacityProject *pOwner)
Definition: Track.cpp:502
A Track that contains audio waveform data.
Definition: WaveTrack.h:57

References Effect::CopyInputTracks(), TrackList::Create(), EffectBase::FindProject(), floatSample, InitPass1(), InitPass2(), EffectBase::mOutputTracks, mPass, mSecondPassDisabled, EffectBase::mT0, mTrackLists, mWorkTracks, ProcessPass(), EffectBase::ReplaceProcessedTracks(), and settings().

Here is the call graph for this function:

◆ ProcessOne()

bool EffectTwoPassSimpleMono::ProcessOne ( WaveTrack t,
WaveTrack outTrack,
sampleCount  start,
sampleCount  end 
)
private

Definition at line 114 of file TwoPassSimpleMono.cpp.

116{
117 bool ret;
118
119 //Get the length of the buffer (as double). len is
120 //used simple to calculate a progress meter, so it is easier
121 //to make it a double now than it is to do it later
122 auto len = (end - start).as_double();
123 auto maxblock = track->GetMaxBlockSize();
124
125 //Initiate a processing buffer. This buffer will (most likely)
126 //be shorter than the length of the track being processed.
127 Floats buffer1{ maxblock };
128 Floats buffer2{ maxblock };
129 auto samples1 = limitSampleBufferSize(
130 std::min( maxblock, track->GetBestBlockSize(start) ), end - start );
131
132 //Get the samples from the track and put them in the buffer
133 track->GetFloats(buffer1.get(), start, samples1);
134
135 // Process the first buffer with a NULL previous buffer
136 if (mPass == 0)
137 ret = TwoBufferProcessPass1(NULL, 0, buffer1.get(), samples1);
138 else
139 ret = TwoBufferProcessPass2(NULL, 0, buffer1.get(), samples1);
140 if (!ret)
141 //Return false because the effect failed.
142 return false;
143
144 //Go through the track one buffer at a time. s counts which
145 //sample the current buffer starts at.
146 auto s = start + samples1;
147 while (s < end) {
148 //Get a block of samples (smaller than the size of the buffer)
149 //Adjust the block size if it is the final block in the track
150 auto samples2 = limitSampleBufferSize(
151 std::min( track->GetBestBlockSize(s), maxblock ), end - s
152 );
153
154 //Get the samples from the track and put them in the buffer
155 track->GetFloats(buffer2.get(), s, samples2);
156
157 //Process the buffer. If it fails, clean up and exit.
158 if (mPass == 0)
159 ret = TwoBufferProcessPass1(buffer1.get(), samples1, buffer2.get(), samples2);
160 else
161 ret = TwoBufferProcessPass2(buffer1.get(), samples1, buffer2.get(), samples2);
162 if (!ret)
163 //Return false because the effect failed.
164 return false;
165
166 //Processing succeeded. copy the newly-changed samples back
167 //onto the track.
168 if (mSecondPassDisabled || mPass != 0) {
169 outTrack->Set((samplePtr)buffer1.get(), floatSample, s - samples1, samples1);
170 }
171 else {
172 outTrack->Append((samplePtr)buffer1.get(), floatSample, samples1);
173 }
174
175 //Increment s one blockfull of samples
176 s += samples2;
177
178 //Update the Progress meter
180 ret = TotalProgress(
181 (mCurTrackNum + (s-start).as_double()/len) /
183 else
184 ret = TotalProgress(
185 (mCurTrackNum + (s-start).as_double()/len + GetNumWaveTracks()*mPass) /
186 (GetNumWaveTracks()*2));
187 if (ret)
188 //Return false because the effect failed.
189 return false;
190
191 // Rotate the buffers
192 buffer1.swap(buffer2);
193
194 std::swap(samples1, samples2);
195 }
196
197 // Send the last buffer with a NULL pointer for the current buffer
198 if (mPass == 0)
199 ret = TwoBufferProcessPass1(buffer1.get(), samples1, NULL, 0);
200 else
201 ret = TwoBufferProcessPass2(buffer1.get(), samples1, NULL, 0);
202
203 if (!ret)
204 //Return false because the effect failed.
205 return false;
206
207 //Processing succeeded. copy the newly-changed samples back
208 //onto the track.
209 if (mSecondPassDisabled || mPass != 0) {
210 outTrack->Set((samplePtr)buffer1.get(), floatSample, s - samples1, samples1);
211 }
212 else {
213 outTrack->Append((samplePtr)buffer1.get(), floatSample, samples1);
214 outTrack->Flush();
215 }
216
217 //Return true because the effect processing succeeded.
218 return true;
219}
int min(int a, int b)
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:22
char * samplePtr
Definition: SampleFormat.h:49
bool TotalProgress(double frac, const TranslatableString &={}) const
Definition: Effect.cpp:681
int GetNumWaveTracks() const
Definition: Effect.h:219
virtual bool TwoBufferProcessPass1(float *buffer1, size_t len1, float *WXUNUSED(buffer2), size_t WXUNUSED(len2))
virtual bool TwoBufferProcessPass2(float *buffer1, size_t len1, float *WXUNUSED(buffer2), size_t WXUNUSED(len2))
void Flush() override
Definition: WaveTrack.cpp:1836
void Set(constSamplePtr buffer, sampleFormat format, sampleCount start, size_t len)
Definition: WaveTrack.cpp:2195
bool Append(constSamplePtr buffer, sampleFormat format, size_t len, unsigned int stride=1) override
Definition: WaveTrack.cpp:1766
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:753

References WaveTrack::Append(), PackedArray::end(), floatSample, WaveTrack::Flush(), WaveTrack::GetBestBlockSize(), SampleTrack::GetFloats(), WaveTrack::GetMaxBlockSize(), Effect::GetNumWaveTracks(), limitSampleBufferSize(), mCurTrackNum, min(), mPass, mSecondPassDisabled, WaveTrack::Set(), anonymous_namespace{NoteTrack.cpp}::swap(), Effect::TotalProgress(), TwoBufferProcessPass1(), and TwoBufferProcessPass2().

Referenced by ProcessPass().

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

◆ ProcessPass()

bool EffectTwoPassSimpleMono::ProcessPass ( EffectSettings settings)
private

Definition at line 61 of file TwoPassSimpleMono.cpp.

62{
63 //Iterate over each track
64 mCurTrackNum = 0;
65
66 auto outTracks = (*mTrackLists[1 - mPass])->Selected< WaveTrack >().begin();
67 for( auto track : (*mTrackLists[mPass])->Selected< WaveTrack >() ) {
68 auto outTrack = *outTracks;
69
70 //Get start and end times from track
71 double trackStart = track->GetStartTime();
72 double trackEnd = track->GetEndTime();
73
74 //Set the current bounds to whichever left marker is
75 //greater and whichever right marker is less:
76 mCurT0 = mT0 < trackStart? trackStart: mT0;
77 mCurT1 = mT1 > trackEnd? trackEnd: mT1;
78
79 // Process only if the right marker is to the right of the left marker
80 if (mCurT1 > mCurT0) {
81
82 //Transform the marker timepoints to samples
83 auto start = track->TimeToLongSamples(mCurT0);
84 auto end = track->TimeToLongSamples(mCurT1);
85
86 //Get the track rate and samples
87 mCurRate = track->GetRate();
88 mCurChannel = track->GetChannel();
89
90 //NewTrackPass1/2() returns true by default
91 bool ret;
92 if (mPass == 0)
93 ret = NewTrackPass1();
94 else
95 ret = NewTrackPass2();
96 if (!ret)
97 return false;
98
99 //ProcessOne() (implemented below) processes a single track
100 if (!ProcessOne(track, outTrack, start, end))
101 return false;
102 }
103
104 mCurTrackNum++;
105 outTracks++;
106 }
107
108 return true;
109}
double mT1
Definition: EffectBase.h:107
bool ProcessOne(WaveTrack *t, WaveTrack *outTrack, sampleCount start, sampleCount end)

References PackedArray::end(), mCurChannel, mCurRate, mCurT0, mCurT1, mCurTrackNum, mPass, EffectBase::mT0, EffectBase::mT1, mTrackLists, NewTrackPass1(), NewTrackPass2(), and ProcessOne().

Referenced by Process().

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

◆ ProcessPass1()

virtual bool EffectTwoPassSimpleMono::ProcessPass1 ( float *  WXUNUSEDbuffer,
size_t   WXUNUSEDlen 
)
inlineprotectedvirtual

Definition at line 45 of file TwoPassSimpleMono.h.

47 { return false; }

◆ ProcessPass2()

virtual bool EffectTwoPassSimpleMono::ProcessPass2 ( float *  WXUNUSEDbuffer,
size_t   WXUNUSEDlen 
)
inlineprotectedvirtual

Definition at line 49 of file TwoPassSimpleMono.h.

51 { return false; }

◆ TwoBufferProcessPass1()

virtual bool EffectTwoPassSimpleMono::TwoBufferProcessPass1 ( float *  buffer1,
size_t  len1,
float *  WXUNUSEDbuffer2,
size_t   WXUNUSEDlen2 
)
inlineprotectedvirtual

Definition at line 57 of file TwoPassSimpleMono.h.

59 { if(buffer1 != NULL) return ProcessPass1(buffer1, len1); else return true; }
virtual bool ProcessPass1(float *WXUNUSED(buffer), size_t WXUNUSED(len))

Referenced by ProcessOne().

Here is the caller graph for this function:

◆ TwoBufferProcessPass2()

virtual bool EffectTwoPassSimpleMono::TwoBufferProcessPass2 ( float *  buffer1,
size_t  len1,
float *  WXUNUSEDbuffer2,
size_t   WXUNUSEDlen2 
)
inlineprotectedvirtual

Definition at line 60 of file TwoPassSimpleMono.h.

62 { if(buffer1 != NULL) return ProcessPass2(buffer1, len1); else return true; }
virtual bool ProcessPass2(float *WXUNUSED(buffer), size_t WXUNUSED(len))

Referenced by ProcessOne().

Here is the caller graph for this function:

Member Data Documentation

◆ mCurChannel

int EffectTwoPassSimpleMono::mCurChannel
protected

Definition at line 75 of file TwoPassSimpleMono.h.

Referenced by ProcessPass().

◆ mCurRate

double EffectTwoPassSimpleMono::mCurRate
protected

Definition at line 72 of file TwoPassSimpleMono.h.

Referenced by EffectCompressor::NewTrackPass1(), and ProcessPass().

◆ mCurT0

double EffectTwoPassSimpleMono::mCurT0
protected

Definition at line 73 of file TwoPassSimpleMono.h.

Referenced by ProcessPass().

◆ mCurT1

double EffectTwoPassSimpleMono::mCurT1
protected

Definition at line 74 of file TwoPassSimpleMono.h.

Referenced by ProcessPass().

◆ mCurTrackNum

int EffectTwoPassSimpleMono::mCurTrackNum
protected

Definition at line 71 of file TwoPassSimpleMono.h.

Referenced by ProcessOne(), and ProcessPass().

◆ mPass

int EffectTwoPassSimpleMono::mPass
protected

Definition at line 76 of file TwoPassSimpleMono.h.

Referenced by Process(), ProcessOne(), and ProcessPass().

◆ mSecondPassDisabled

bool EffectTwoPassSimpleMono::mSecondPassDisabled
protected

Definition at line 77 of file TwoPassSimpleMono.h.

Referenced by Process(), and ProcessOne().

◆ mTrackLists

std::shared_ptr<TrackList>* EffectTwoPassSimpleMono::mTrackLists[2]
protected

Definition at line 80 of file TwoPassSimpleMono.h.

Referenced by Process(), and ProcessPass().

◆ mWorkTracks

std::shared_ptr<TrackList> EffectTwoPassSimpleMono::mWorkTracks
protected

Definition at line 79 of file TwoPassSimpleMono.h.

Referenced by Process().


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