Audacity  3.0.3
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
ODTask Class Referenceabstract

A class representing a modular task to be used with the On-Demand structures. More...

#include <ODTask.h>

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

Public Types

enum  {
  eODNone = 0x00000000, eODFLAC = 0x00000001, eODMP3 = 0x00000002, eODFFMPEG = 0x00000004,
  eODPCMSummary = 0x00001000, eODOTHER = 0x10000000
}
 

Public Member Functions

 ODTask ()
 Constructs an ODTask. More...
 
virtual ~ODTask ()
 
virtual std::unique_ptr< ODTaskClone () const =0
 
virtual unsigned int GetODType ()
 Subclasses should override to return respective type. More...
 
void DoSome (float amountWork=0.0)
 
void DoAll ()
 Call DoSome until PercentComplete >= 1.0. More...
 
virtual float PercentComplete ()
 return the amount of the task that has been completed. 0.0 to 1.0 More...
 
virtual bool UsesCustomWorkUntilPercentage ()
 
virtual float ComputeNextWorkUntilPercentageComplete ()
 
virtual bool CanMergeWith (ODTask *otherTask)
 
virtual void StopUsingWaveTrack (WaveTrack *track)
 
virtual void ReplaceWaveTrack (Track *oldTrack, const std::shared_ptr< Track > &newTrack)
 Replaces all instances to a wavetrack with a NEW one, effectively transferring the task. More...
 
void AddWaveTrack (const std::shared_ptr< WaveTrack > &track)
 Adds a WaveTrack to do the task for. More...
 
virtual int GetNumWaveTracks ()
 
virtual std::shared_ptr< WaveTrackGetWaveTrack (int i)
 
virtual void DemandTrackUpdate (WaveTrack *track, double seconds)
 changes the tasks associated with this Waveform to process the task from a different point in the track More...
 
bool IsComplete ()
 return More...
 
void TerminateAndBlock ()
 
virtual void Terminate ()
 releases memory that the ODTask owns. Subclasses should override. More...
 
virtual const char * GetTaskName ()
 
virtual sampleCount GetDemandSample () const
 
virtual void SetDemandSample (sampleCount sample)
 
virtual void RecalculatePercentComplete ()
 does an od update and then recalculates the data. More...
 
int GetTaskNumber ()
 returns the number of tasks created before this instance. More...
 
void SetNeedsODUpdate ()
 
bool GetNeedsODUpdate ()
 
void ResetNeedsODUpdate ()
 
virtual TranslatableString GetTip ()=0
 
virtual bool IsTaskAssociatedWithProject (AudacityProject *proj)
 returns true if the task is associated with the project. More...
 
bool IsRunning ()
 

Public Attributes

enum ODTask:: { ... }  ODTypeEnum
 

Protected Member Functions

virtual void CalculatePercentComplete ()=0
 calculates the percentage complete from existing data. More...
 
virtual void DoSomeInternal ()=0
 
virtual void Update ()
 virtual method called before DoSomeInternal is used from DoSome. More...
 
virtual void ODUpdate ()
 
void SetIsRunning (bool value)
 

Protected Attributes

int mTaskNumber
 
volatile float mPercentComplete
 
ODLock mPercentCompleteMutex
 
volatile bool mDoingTask
 
volatile bool mTaskStarted
 
volatile bool mTerminate
 
ODLock mTerminateMutex
 
ODLock mBlockUntilTerminateMutex
 
std::vector< std::weak_ptr< WaveTrack > > mWaveTracks
 
ODLock mWaveTrackMutex
 
sampleCount mDemandSample
 
ODLock mDemandSampleMutex
 
volatile bool mIsRunning
 
ODLock mIsRunningMutex
 

Private Attributes

volatile bool mNeedsODUpdate
 
ODLock mNeedsODUpdateMutex
 

Detailed Description

A class representing a modular task to be used with the On-Demand structures.

ODTask is an abstract class that outlines the methods that will be used to support On-Demand background loading of files. These ODTasks are generally meant to be run in a background thread.

Definition at line 39 of file ODTask.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
eODNone 
eODFLAC 
eODMP3 
eODFFMPEG 
eODPCMSummary 
eODOTHER 

Definition at line 42 of file ODTask.h.

42  {
43  eODNone = 0x00000000,
44  eODFLAC = 0x00000001,
45  eODMP3 = 0x00000002,
46  eODFFMPEG = 0x00000004,
47  eODPCMSummary = 0x00001000,
48  eODOTHER = 0x10000000,
49  } ODTypeEnum;

Constructor & Destructor Documentation

◆ ODTask()

ODTask::ODTask ( )

Constructs an ODTask.

Definition at line 35 of file ODTask.cpp.

36 : mDemandSample(0)
37 {
38 
39  static int sTaskNumber=0;
41  mDoingTask=false;
42  mTerminate = false;
43  mNeedsODUpdate=false;
44  mIsRunning = false;
45 
46  mTaskNumber=sTaskNumber++;
47 }

References mDoingTask, mIsRunning, mNeedsODUpdate, mPercentComplete, mTaskNumber, and mTerminate.

◆ ~ODTask()

virtual ODTask::~ODTask ( )
inlinevirtual

Definition at line 55 of file ODTask.h.

55 {};

Member Function Documentation

◆ AddWaveTrack()

void ODTask::AddWaveTrack ( const std::shared_ptr< WaveTrack > &  track)

Adds a WaveTrack to do the task for.

Sets the wavetrack that will be analyzed for ODPCMAliasBlockFiles that will have their summaries computed and written to disk.

Definition at line 267 of file ODTask.cpp.

268 {
269  mWaveTracks.push_back(track);
270 }

References mWaveTracks.

◆ CalculatePercentComplete()

virtual void ODTask::CalculatePercentComplete ( )
protectedpure virtual

calculates the percentage complete from existing data.

Implemented in ODDecodeTask, and ODComputeSummaryTask.

Referenced by RecalculatePercentComplete().

Here is the caller graph for this function:

◆ CanMergeWith()

virtual bool ODTask::CanMergeWith ( ODTask otherTask)
inlinevirtual

returns whether or not this task and another task can merge together, as when we make two mono tracks stereo. for Loading/Summarizing, this is not an issue because the entire track is processed Effects that affect portions of a track will need to check this.

Definition at line 81 of file ODTask.h.

81 {return strcmp(GetTaskName(),otherTask->GetTaskName())==0;}

References GetTaskName().

Here is the call graph for this function:

◆ Clone()

virtual std::unique_ptr<ODTask> ODTask::Clone ( ) const
pure virtual

Implemented in ODDecodeFlacTask, and ODComputeSummaryTask.

◆ ComputeNextWorkUntilPercentageComplete()

virtual float ODTask::ComputeNextWorkUntilPercentageComplete ( )
inlinevirtual

Reimplemented in ODComputeSummaryTask.

Definition at line 76 of file ODTask.h.

76 {return 1.0;}

Referenced by DoSome().

Here is the caller graph for this function:

◆ DemandTrackUpdate()

void ODTask::DemandTrackUpdate ( WaveTrack track,
double  seconds 
)
virtual

changes the tasks associated with this Waveform to process the task from a different point in the track

changes the tasks associated with this Waveform to process the task from a different point in the track

Parameters
trackthe track to update
secondsthe point in the track from which the tasks associated with track should begin processing from.

Reimplemented in ODDecodeTask.

Definition at line 318 of file ODTask.cpp.

319 {
320  bool demandSampleChanged=false;
321  mWaveTrackMutex.Lock();
322  for(size_t i=0;i<mWaveTracks.size();i++)
323  {
324  if ( track == mWaveTracks[i].lock().get() )
325  {
326  auto newDemandSample = (sampleCount)(seconds * track->GetRate());
327  demandSampleChanged = newDemandSample != GetDemandSample();
328  SetDemandSample(newDemandSample);
329  break;
330  }
331  }
332  mWaveTrackMutex.Unlock();
333 
334  if(demandSampleChanged)
336 
337 }

References GetDemandSample(), WaveTrack::GetRate(), mWaveTrackMutex, mWaveTracks, SetDemandSample(), and SetNeedsODUpdate().

Referenced by ODDecodeTask::DemandTrackUpdate().

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

◆ DoAll()

void ODTask::DoAll ( )

Call DoSome until PercentComplete >= 1.0.

◆ DoSome()

void ODTask::DoSome ( float  amountWork = 0.0)

Do a modular part of the task. For example, if the task is to load the entire file, load one BlockFile. Relies on DoSomeInternal(), which is the subclasses must implement.

Parameters
amountWorkthe percent amount of the total job to do. 1.0 represents the entire job. the default of 0.0 will do the smallest unit of work possible

Do a modular part of the task. For example, if the task is to load the entire file, load one BlockFile. Relies on DoSomeInternal(), which the subclasses must implement.

Parameters
amountWorkthe percent amount of the total job to do. 1.0 represents the entire job. the default of 0.0 will do the smallest unit of work possible

Definition at line 71 of file ODTask.cpp.

72 {
73  SetIsRunning(true);
75 
76 // wxPrintf("%s %i subtask starting on NEW thread with priority\n", GetTaskName(),GetTaskNumber());
77 
79 
80  float workUntil = amountWork+PercentComplete();
81 
82 
83 
84  //check periodically to see if we should exit.
85  mTerminateMutex.Lock();
86  if(mTerminate)
87  {
88  mTerminateMutex.Unlock();
89  SetIsRunning(false);
91  return;
92  }
93  mTerminateMutex.Unlock();
94 
95  Update();
96 
97 
100 
101  if(workUntil<PercentComplete())
102  workUntil = PercentComplete();
103 
104  //Do Some of the task.
105 
106  mTerminateMutex.Lock();
107  while(PercentComplete() < workUntil && PercentComplete() < 1.0 && !mTerminate)
108  {
109  wxThread::This()->Yield();
110  //release within the loop so we can cut the number of iterations short
111 
112  DoSomeInternal(); //keep the terminate mutex on so we don't remo
113  mTerminateMutex.Unlock();
114  //check to see if ondemand has been called
115  if(GetNeedsODUpdate() && PercentComplete() < 1.0)
116  ODUpdate();
117 
118 
119  //But add the mutex lock back before we check the value again.
120  mTerminateMutex.Lock();
121  }
122  mTerminateMutex.Unlock();
123  mDoingTask=false;
124 
125  mTerminateMutex.Lock();
126  //if it is not done, put it back onto the ODManager queue.
127  if(PercentComplete() < 1.0&& !mTerminate)
128  {
129  ODManager::Instance()->AddTask(this);
130 
131  //we did a bit of progress - we should allow a resave.
132  ODLocker locker{ &AllProjects::Mutex() };
133  for ( auto pProject : AllProjects{} )
134  {
135  if(IsTaskAssociatedWithProject(pProject.get()))
136  {
137  //mark the changes so that the project can be resaved.
138  UndoManager::Get( *pProject ).SetODChangesFlag();
139  break;
140  }
141  }
142 
143 
144 // wxPrintf("%s %i is %f done\n", GetTaskName(),GetTaskNumber(),PercentComplete());
145  }
146  else
147  {
148  //for profiling, uncomment and look in audacity.app/exe's folder for AudacityProfile.txt
149  //static int tempLog =0;
150  //if(++tempLog % 5==0)
151  //END_TASK_PROFILING("On Demand Drag and Drop 5 80 mb files into audacity, 5 wavs per task");
152  //END_TASK_PROFILING("On Demand open an 80 mb wav stereo file");
153 
154  wxCommandEvent event( EVT_ODTASK_COMPLETE );
155 
156  ODLocker locker{ &AllProjects::Mutex() };
157  for ( auto pProject : AllProjects{} )
158  {
159  if(IsTaskAssociatedWithProject(pProject.get()))
160  {
161  //this assumes tasks are only associated with one project.
162  pProject->wxEvtHandler::AddPendingEvent(event);
163  //mark the changes so that the project can be resaved.
164  UndoManager::Get( *pProject ).SetODChangesFlag();
165  break;
166  }
167  }
168 
169 // wxPrintf("%s %i complete\n", GetTaskName(),GetTaskNumber());
170  }
171  mTerminateMutex.Unlock();
172  SetIsRunning(false);
173  mBlockUntilTerminateMutex.Unlock();
174 }

References ODManager::AddTask(), ComputeNextWorkUntilPercentageComplete(), DoSomeInternal(), UndoManager::Get(), GetNeedsODUpdate(), ODManager::Instance, IsTaskAssociatedWithProject(), mBlockUntilTerminateMutex, mDoingTask, mTaskStarted, mTerminate, mTerminateMutex, AllProjects::Mutex(), ODUpdate(), PercentComplete(), SetIsRunning(), Update(), and UsesCustomWorkUntilPercentage().

Here is the call graph for this function:

◆ DoSomeInternal()

virtual void ODTask::DoSomeInternal ( )
protectedpure virtual

pure virtual function that does some part of the task this object represents. this function is meant to be called repeatedly until IsComplete is true. Does the smallest unit of work for this task.

Implemented in ODDecodeTask, and ODComputeSummaryTask.

Referenced by DoSome().

Here is the caller graph for this function:

◆ GetDemandSample()

sampleCount ODTask::GetDemandSample ( ) const
virtual

Definition at line 221 of file ODTask.cpp.

222 {
223  sampleCount retval;
224  mDemandSampleMutex.Lock();
225  retval = mDemandSample;
226  mDemandSampleMutex.Unlock();
227  return retval;
228 }

References mDemandSample, and mDemandSampleMutex.

Referenced by ODComputeSummaryTask::Clone(), ODDecodeFlacTask::Clone(), DemandTrackUpdate(), ODDecodeTask::OrderBlockFiles(), and ODComputeSummaryTask::OrderBlockFiles().

Here is the caller graph for this function:

◆ GetNeedsODUpdate()

bool ODTask::GetNeedsODUpdate ( )

Definition at line 289 of file ODTask.cpp.

290 {
291  bool ret;
292  mNeedsODUpdateMutex.Lock();
293  ret=mNeedsODUpdate;
294  mNeedsODUpdateMutex.Unlock();
295  return ret;
296 }

References mNeedsODUpdate, and mNeedsODUpdateMutex.

Referenced by DoSome(), and RecalculatePercentComplete().

Here is the caller graph for this function:

◆ GetNumWaveTracks()

int ODTask::GetNumWaveTracks ( )
virtual

Definition at line 273 of file ODTask.cpp.

274 {
275  int num;
276  mWaveTrackMutex.Lock();
277  num = (int)mWaveTracks.size();
278  mWaveTrackMutex.Unlock();
279  return num;
280 }

References mWaveTrackMutex, and mWaveTracks.

Referenced by ODWaveTrackTaskQueue::AddTask().

Here is the caller graph for this function:

◆ GetODType()

virtual unsigned int ODTask::GetODType ( )
inlinevirtual

Subclasses should override to return respective type.

Reimplemented in ODDecodeTask, ODDecodeFlacTask, and ODComputeSummaryTask.

Definition at line 61 of file ODTask.h.

61 {return eODNone;}

References eODNone.

◆ GetTaskName()

virtual const char* ODTask::GetTaskName ( )
inlinevirtual

Reimplemented in ODDecodeTask, and ODComputeSummaryTask.

Definition at line 104 of file ODTask.h.

104 {return "ODTask";}

Referenced by CanMergeWith().

Here is the caller graph for this function:

◆ GetTaskNumber()

int ODTask::GetTaskNumber ( )
inline

returns the number of tasks created before this instance.

Definition at line 114 of file ODTask.h.

114 {return mTaskNumber;}

References mTaskNumber.

◆ GetTip()

virtual TranslatableString ODTask::GetTip ( )
pure virtual

Implemented in ODDecodeTask, and ODComputeSummaryTask.

◆ GetWaveTrack()

std::shared_ptr< WaveTrack > ODTask::GetWaveTrack ( int  i)
virtual

Definition at line 255 of file ODTask.cpp.

256 {
257  std::shared_ptr< WaveTrack > track;
258  mWaveTrackMutex.Lock();
259  if(i<(int)mWaveTracks.size())
260  track = mWaveTracks[i].lock();
261  mWaveTrackMutex.Unlock();
262  return track;
263 }

References mWaveTrackMutex, and mWaveTracks.

Referenced by ODManager::AddNewTask(), and ODWaveTrackTaskQueue::AddTask().

Here is the caller graph for this function:

◆ IsComplete()

bool ODTask::IsComplete ( )

return

Definition at line 249 of file ODTask.cpp.

250 {
251  return PercentComplete() >= 1.0 && !IsRunning();
252 }

References IsRunning(), and PercentComplete().

Here is the call graph for this function:

◆ IsRunning()

bool ODTask::IsRunning ( )

Definition at line 212 of file ODTask.cpp.

213 {
214  bool ret;
215  mIsRunningMutex.Lock();
216  ret= mIsRunning;
217  mIsRunningMutex.Unlock();
218  return ret;
219 }

References mIsRunning, and mIsRunningMutex.

Referenced by IsComplete().

Here is the caller graph for this function:

◆ IsTaskAssociatedWithProject()

bool ODTask::IsTaskAssociatedWithProject ( AudacityProject proj)
virtual

returns true if the task is associated with the project.

Definition at line 176 of file ODTask.cpp.

177 {
178  for (auto tr : TrackList::Get( *proj ).Any<const WaveTrack>())
179  {
180  //go over all tracks in the project
181  //look inside our task's track list for one that matches this projects one.
182  mWaveTrackMutex.Lock();
183  for(int i=0;i<(int)mWaveTracks.size();i++)
184  {
185  if ( mWaveTracks[i].lock().get() == tr )
186  {
187  //if we find one, then the project is associated with us;return true
188  mWaveTrackMutex.Unlock();
189  return true;
190  }
191  }
192  mWaveTrackMutex.Unlock();
193  }
194 
195  return false;
196 
197 }

References TrackList::Any(), TrackList::Get(), mWaveTrackMutex, and mWaveTracks.

Referenced by DoSome().

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

◆ ODUpdate()

void ODTask::ODUpdate ( )
protectedvirtual

virtual method called in DoSome everytime the user has demanded some OD function so that the ODTask can readjust its computation order. By default just calls Update(), but subclasses with special needs can override this

Definition at line 199 of file ODTask.cpp.

200 {
201  Update();
203 }

References ResetNeedsODUpdate(), and Update().

Referenced by DoSome(), and RecalculatePercentComplete().

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

◆ PercentComplete()

float ODTask::PercentComplete ( )
virtual

return the amount of the task that has been completed. 0.0 to 1.0

Definition at line 240 of file ODTask.cpp.

241 {
242  mPercentCompleteMutex.Lock();
243  float ret = mPercentComplete;
244  mPercentCompleteMutex.Unlock();
245  return ret;
246 }

References mPercentComplete, and mPercentCompleteMutex.

Referenced by DoSome(), and IsComplete().

Here is the caller graph for this function:

◆ RecalculatePercentComplete()

void ODTask::RecalculatePercentComplete ( )
virtual

does an od update and then recalculates the data.

Definition at line 306 of file ODTask.cpp.

307 {
308  if(GetNeedsODUpdate())
309  {
310  ODUpdate();
312  }
313 }

References CalculatePercentComplete(), GetNeedsODUpdate(), and ODUpdate().

Here is the call graph for this function:

◆ ReplaceWaveTrack()

void ODTask::ReplaceWaveTrack ( Track oldTrack,
const std::shared_ptr< Track > &  newTrack 
)
virtual

Replaces all instances to a wavetrack with a NEW one, effectively transferring the task.

Replaces all instances to a wavetrack with a NEW one, effectively transferring the task. ODTask has no wavetrack, so it does nothing. But subclasses that do should override this.

Definition at line 352 of file ODTask.cpp.

354 {
355  mWaveTrackMutex.Lock();
356  for(size_t i=0;i<mWaveTracks.size();i++)
357  {
358  if(oldTrack == mWaveTracks[i].lock().get())
359  {
360  mWaveTracks[i] = std::static_pointer_cast<WaveTrack>( newTrack );
361  }
362  }
363  mWaveTrackMutex.Unlock();
364 }

References mWaveTrackMutex, and mWaveTracks.

◆ ResetNeedsODUpdate()

void ODTask::ResetNeedsODUpdate ( )

Definition at line 298 of file ODTask.cpp.

299 {
300  mNeedsODUpdateMutex.Lock();
301  mNeedsODUpdate=false;
302  mNeedsODUpdateMutex.Unlock();
303 }

References mNeedsODUpdate, and mNeedsODUpdateMutex.

Referenced by ODUpdate().

Here is the caller graph for this function:

◆ SetDemandSample()

void ODTask::SetDemandSample ( sampleCount  sample)
virtual

Definition at line 230 of file ODTask.cpp.

231 {
232 
233  mDemandSampleMutex.Lock();
234  mDemandSample=sample;
235  mDemandSampleMutex.Unlock();
236 }

References mDemandSample, and mDemandSampleMutex.

Referenced by DemandTrackUpdate().

Here is the caller graph for this function:

◆ SetIsRunning()

void ODTask::SetIsRunning ( bool  value)
protected

Definition at line 205 of file ODTask.cpp.

206 {
207  mIsRunningMutex.Lock();
208  mIsRunning=value;
209  mIsRunningMutex.Unlock();
210 }

References mIsRunning, and mIsRunningMutex.

Referenced by DoSome().

Here is the caller graph for this function:

◆ SetNeedsODUpdate()

void ODTask::SetNeedsODUpdate ( )

Definition at line 283 of file ODTask.cpp.

284 {
285  mNeedsODUpdateMutex.Lock();
286  mNeedsODUpdate=true;
287  mNeedsODUpdateMutex.Unlock();
288 }

References mNeedsODUpdate, and mNeedsODUpdateMutex.

Referenced by DemandTrackUpdate().

Here is the caller graph for this function:

◆ StopUsingWaveTrack()

void ODTask::StopUsingWaveTrack ( WaveTrack track)
virtual

Definition at line 340 of file ODTask.cpp.

341 {
342  mWaveTrackMutex.Lock();
343  for(size_t i=0;i<mWaveTracks.size();i++)
344  {
345  if(mWaveTracks[i].lock().get() == track)
346  mWaveTracks[i].reset();
347  }
348  mWaveTrackMutex.Unlock();
349 }

References mWaveTrackMutex, and mWaveTracks.

◆ Terminate()

virtual void ODTask::Terminate ( )
inlinevirtual

releases memory that the ODTask owns. Subclasses should override.

Reimplemented in ODComputeSummaryTask.

Definition at line 102 of file ODTask.h.

102 {}

Referenced by TerminateAndBlock().

Here is the caller graph for this function:

◆ TerminateAndBlock()

void ODTask::TerminateAndBlock ( )

Definition at line 50 of file ODTask.cpp.

51 {
52  //one mutex pair for the value of mTerminate
53  mTerminateMutex.Lock();
54  mTerminate=true;
55  //release all data the derived class may have allocated
56  mTerminateMutex.Unlock();
57 
58  //and one mutex pair for the exit of the function
60 //TODO lock mTerminate?
62 
63  //wait till we are out of doSome() to terminate.
64  Terminate();
65 }

References mBlockUntilTerminateMutex, mTerminate, mTerminateMutex, and Terminate().

Here is the call graph for this function:

◆ Update()

virtual void ODTask::Update ( )
inlineprotectedvirtual

virtual method called before DoSomeInternal is used from DoSome.

Reimplemented in ODDecodeTask, and ODComputeSummaryTask.

Definition at line 139 of file ODTask.h.

139 {}

Referenced by DoSome(), and ODUpdate().

Here is the caller graph for this function:

◆ UsesCustomWorkUntilPercentage()

virtual bool ODTask::UsesCustomWorkUntilPercentage ( )
inlinevirtual

Reimplemented in ODComputeSummaryTask.

Definition at line 75 of file ODTask.h.

75 {return false;}

Referenced by DoSome().

Here is the caller graph for this function:

Member Data Documentation

◆ mBlockUntilTerminateMutex

ODLock ODTask::mBlockUntilTerminateMutex
protected

Definition at line 158 of file ODTask.h.

Referenced by DoSome(), and TerminateAndBlock().

◆ mDemandSample

sampleCount ODTask::mDemandSample
protected

Definition at line 163 of file ODTask.h.

Referenced by GetDemandSample(), and SetDemandSample().

◆ mDemandSampleMutex

ODLock ODTask::mDemandSampleMutex
mutableprotected

Definition at line 164 of file ODTask.h.

Referenced by GetDemandSample(), and SetDemandSample().

◆ mDoingTask

volatile bool ODTask::mDoingTask
protected

Definition at line 153 of file ODTask.h.

Referenced by DoSome(), and ODTask().

◆ mIsRunning

volatile bool ODTask::mIsRunning
protected

Definition at line 166 of file ODTask.h.

Referenced by IsRunning(), ODTask(), and SetIsRunning().

◆ mIsRunningMutex

ODLock ODTask::mIsRunningMutex
protected

Definition at line 167 of file ODTask.h.

Referenced by IsRunning(), and SetIsRunning().

◆ mNeedsODUpdate

volatile bool ODTask::mNeedsODUpdate
private

Definition at line 172 of file ODTask.h.

Referenced by GetNeedsODUpdate(), ODTask(), ResetNeedsODUpdate(), and SetNeedsODUpdate().

◆ mNeedsODUpdateMutex

ODLock ODTask::mNeedsODUpdateMutex
private

Definition at line 173 of file ODTask.h.

Referenced by GetNeedsODUpdate(), ResetNeedsODUpdate(), and SetNeedsODUpdate().

◆ mPercentComplete

volatile float ODTask::mPercentComplete
protected

◆ mPercentCompleteMutex

ODLock ODTask::mPercentCompleteMutex
protected

◆ mTaskNumber

int ODTask::mTaskNumber
protected

Definition at line 150 of file ODTask.h.

Referenced by GetTaskNumber(), and ODTask().

◆ mTaskStarted

volatile bool ODTask::mTaskStarted
protected

Definition at line 154 of file ODTask.h.

Referenced by DoSome().

◆ mTerminate

volatile bool ODTask::mTerminate
protected

Definition at line 155 of file ODTask.h.

Referenced by DoSome(), ODTask(), and TerminateAndBlock().

◆ mTerminateMutex

ODLock ODTask::mTerminateMutex
protected

Definition at line 156 of file ODTask.h.

Referenced by DoSome(), and TerminateAndBlock().

◆ mWaveTrackMutex

ODLock ODTask::mWaveTrackMutex
protected

◆ mWaveTracks

std::vector< std::weak_ptr< WaveTrack > > ODTask::mWaveTracks
protected

◆ ODTypeEnum

enum { ... } ODTask::ODTypeEnum

The documentation for this class was generated from the following files:
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
ODTask::SetNeedsODUpdate
void SetNeedsODUpdate()
Definition: ODTask.cpp:283
ODTask::GetTaskName
virtual const char * GetTaskName()
Definition: ODTask.h:104
ODTask::mIsRunning
volatile bool mIsRunning
Definition: ODTask.h:166
ODTask::eODMP3
@ eODMP3
Definition: ODTask.h:45
ODTask::ODTypeEnum
enum ODTask::@0 ODTypeEnum
ODTask::IsTaskAssociatedWithProject
virtual bool IsTaskAssociatedWithProject(AudacityProject *proj)
returns true if the task is associated with the project.
Definition: ODTask.cpp:176
ODTask::UsesCustomWorkUntilPercentage
virtual bool UsesCustomWorkUntilPercentage()
Definition: ODTask.h:75
ODTask::eODOTHER
@ eODOTHER
Definition: ODTask.h:48
ODTask::eODNone
@ eODNone
Definition: ODTask.h:43
ODTask::mDemandSampleMutex
ODLock mDemandSampleMutex
Definition: ODTask.h:164
ODTask::GetNeedsODUpdate
bool GetNeedsODUpdate()
Definition: ODTask.cpp:289
ODTask::eODFFMPEG
@ eODFFMPEG
Definition: ODTask.h:46
ODManager::AddTask
void AddTask(ODTask *task)
Adds a task to the running queue. Thread-safe.
Definition: ODManager.cpp:195
ODTask::IsRunning
bool IsRunning()
Definition: ODTask.cpp:212
ODTask::PercentComplete
virtual float PercentComplete()
return the amount of the task that has been completed. 0.0 to 1.0
Definition: ODTask.cpp:240
ODTask::mPercentCompleteMutex
ODLock mPercentCompleteMutex
Definition: ODTask.h:152
ODTask::mWaveTracks
std::vector< std::weak_ptr< WaveTrack > > mWaveTracks
Definition: ODTask.h:160
ODTask::ComputeNextWorkUntilPercentageComplete
virtual float ComputeNextWorkUntilPercentageComplete()
Definition: ODTask.h:76
ODTask::CalculatePercentComplete
virtual void CalculatePercentComplete()=0
calculates the percentage complete from existing data.
ODTask::mTaskStarted
volatile bool mTaskStarted
Definition: ODTask.h:154
ODTask::mWaveTrackMutex
ODLock mWaveTrackMutex
Definition: ODTask.h:161
ODTask::mTerminate
volatile bool mTerminate
Definition: ODTask.h:155
ODTask::Terminate
virtual void Terminate()
releases memory that the ODTask owns. Subclasses should override.
Definition: ODTask.h:102
ODLocker
Definition: ODTaskThread.h:120
ODTask::mNeedsODUpdate
volatile bool mNeedsODUpdate
Definition: ODTask.h:172
ODTask::mTerminateMutex
ODLock mTerminateMutex
Definition: ODTask.h:156
ODTask::ResetNeedsODUpdate
void ResetNeedsODUpdate()
Definition: ODTask.cpp:298
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:506
ODTask::mDoingTask
volatile bool mDoingTask
Definition: ODTask.h:153
UndoManager::Get
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:57
ODTask::Update
virtual void Update()
virtual method called before DoSomeInternal is used from DoSome.
Definition: ODTask.h:139
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
AllProjects
Definition: Project.h:35
ODTask::mPercentComplete
volatile float mPercentComplete
Definition: ODTask.h:151
ODTask::eODFLAC
@ eODFLAC
Definition: ODTask.h:44
ODTask::GetDemandSample
virtual sampleCount GetDemandSample() const
Definition: ODTask.cpp:221
ODTask::mTaskNumber
int mTaskNumber
Definition: ODTask.h:150
ODTask::SetIsRunning
void SetIsRunning(bool value)
Definition: ODTask.cpp:205
AllProjects::Mutex
static std::mutex & Mutex()
Definition: Project.cpp:68
ODTask::SetDemandSample
virtual void SetDemandSample(sampleCount sample)
Definition: ODTask.cpp:230
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1371
ODTask::mIsRunningMutex
ODLock mIsRunningMutex
Definition: ODTask.h:167
ODTask::eODPCMSummary
@ eODPCMSummary
Definition: ODTask.h:47
ODManager::Instance
static ODManager *(* Instance)()
Definition: ODManager.h:51
ODTask::DoSomeInternal
virtual void DoSomeInternal()=0
ODTask::mDemandSample
sampleCount mDemandSample
Definition: ODTask.h:163
ODTask::mBlockUntilTerminateMutex
ODLock mBlockUntilTerminateMutex
Definition: ODTask.h:158
ODTask::mNeedsODUpdateMutex
ODLock mNeedsODUpdateMutex
Definition: ODTask.h:173
WaveTrack::GetRate
double GetRate() const
Definition: WaveTrack.cpp:452
ODTask::ODUpdate
virtual void ODUpdate()
Definition: ODTask.cpp:199