Audacity
3.0.3
|
A class representing a modular task to be used with the On-Demand structures. More...
#include <ODTask.h>
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< ODTask > | Clone () 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< WaveTrack > | GetWaveTrack (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 |
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.
anonymous enum |
ODTask::ODTask | ( | ) |
Constructs an ODTask.
Definition at line 35 of file ODTask.cpp.
References mDoingTask, mIsRunning, mNeedsODUpdate, mPercentComplete, mTaskNumber, and mTerminate.
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.
References mWaveTracks.
|
protectedpure virtual |
calculates the percentage complete from existing data.
Implemented in ODDecodeTask, and ODComputeSummaryTask.
Referenced by RecalculatePercentComplete().
|
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.
References GetTaskName().
|
pure virtual |
Implemented in ODDecodeFlacTask, and ODComputeSummaryTask.
|
inlinevirtual |
Reimplemented in ODComputeSummaryTask.
Definition at line 76 of file ODTask.h.
Referenced by DoSome().
|
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
track | the track to update |
seconds | the 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.
References GetDemandSample(), WaveTrack::GetRate(), mWaveTrackMutex, mWaveTracks, SetDemandSample(), and SetNeedsODUpdate().
Referenced by ODDecodeTask::DemandTrackUpdate().
void ODTask::DoAll | ( | ) |
Call DoSome until PercentComplete >= 1.0.
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.
amountWork | the 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.
amountWork | the 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.
References ODManager::AddTask(), ComputeNextWorkUntilPercentageComplete(), DoSomeInternal(), UndoManager::Get(), GetNeedsODUpdate(), ODManager::Instance, IsTaskAssociatedWithProject(), mBlockUntilTerminateMutex, mDoingTask, mTaskStarted, mTerminate, mTerminateMutex, AllProjects::Mutex(), ODUpdate(), PercentComplete(), SetIsRunning(), Update(), and UsesCustomWorkUntilPercentage().
|
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().
|
virtual |
Definition at line 221 of file ODTask.cpp.
References mDemandSample, and mDemandSampleMutex.
Referenced by ODComputeSummaryTask::Clone(), ODDecodeFlacTask::Clone(), DemandTrackUpdate(), ODDecodeTask::OrderBlockFiles(), and ODComputeSummaryTask::OrderBlockFiles().
bool ODTask::GetNeedsODUpdate | ( | ) |
Definition at line 289 of file ODTask.cpp.
References mNeedsODUpdate, and mNeedsODUpdateMutex.
Referenced by DoSome(), and RecalculatePercentComplete().
|
virtual |
Definition at line 273 of file ODTask.cpp.
References mWaveTrackMutex, and mWaveTracks.
Referenced by ODWaveTrackTaskQueue::AddTask().
|
inlinevirtual |
Subclasses should override to return respective type.
Reimplemented in ODDecodeTask, ODDecodeFlacTask, and ODComputeSummaryTask.
Definition at line 61 of file ODTask.h.
References eODNone.
|
inlinevirtual |
Reimplemented in ODDecodeTask, and ODComputeSummaryTask.
Definition at line 104 of file ODTask.h.
Referenced by CanMergeWith().
|
inline |
returns the number of tasks created before this instance.
Definition at line 114 of file ODTask.h.
References mTaskNumber.
|
pure virtual |
Implemented in ODDecodeTask, and ODComputeSummaryTask.
|
virtual |
Definition at line 255 of file ODTask.cpp.
References mWaveTrackMutex, and mWaveTracks.
Referenced by ODManager::AddNewTask(), and ODWaveTrackTaskQueue::AddTask().
bool ODTask::IsComplete | ( | ) |
return
Definition at line 249 of file ODTask.cpp.
References IsRunning(), and PercentComplete().
bool ODTask::IsRunning | ( | ) |
Definition at line 212 of file ODTask.cpp.
References mIsRunning, and mIsRunningMutex.
Referenced by IsComplete().
|
virtual |
returns true if the task is associated with the project.
Definition at line 176 of file ODTask.cpp.
References TrackList::Any(), TrackList::Get(), mWaveTrackMutex, and mWaveTracks.
Referenced by DoSome().
|
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.
References ResetNeedsODUpdate(), and Update().
Referenced by DoSome(), and RecalculatePercentComplete().
|
virtual |
return the amount of the task that has been completed. 0.0 to 1.0
Definition at line 240 of file ODTask.cpp.
References mPercentComplete, and mPercentCompleteMutex.
Referenced by DoSome(), and IsComplete().
|
virtual |
does an od update and then recalculates the data.
Definition at line 306 of file ODTask.cpp.
References CalculatePercentComplete(), GetNeedsODUpdate(), and ODUpdate().
|
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.
References mWaveTrackMutex, and mWaveTracks.
void ODTask::ResetNeedsODUpdate | ( | ) |
Definition at line 298 of file ODTask.cpp.
References mNeedsODUpdate, and mNeedsODUpdateMutex.
Referenced by ODUpdate().
|
virtual |
Definition at line 230 of file ODTask.cpp.
References mDemandSample, and mDemandSampleMutex.
Referenced by DemandTrackUpdate().
|
protected |
Definition at line 205 of file ODTask.cpp.
References mIsRunning, and mIsRunningMutex.
Referenced by DoSome().
void ODTask::SetNeedsODUpdate | ( | ) |
Definition at line 283 of file ODTask.cpp.
References mNeedsODUpdate, and mNeedsODUpdateMutex.
Referenced by DemandTrackUpdate().
|
virtual |
|
inlinevirtual |
releases memory that the ODTask owns. Subclasses should override.
Reimplemented in ODComputeSummaryTask.
Definition at line 102 of file ODTask.h.
Referenced by TerminateAndBlock().
void ODTask::TerminateAndBlock | ( | ) |
Definition at line 50 of file ODTask.cpp.
References mBlockUntilTerminateMutex, mTerminate, mTerminateMutex, and Terminate().
|
inlineprotectedvirtual |
virtual method called before DoSomeInternal is used from DoSome.
Reimplemented in ODDecodeTask, and ODComputeSummaryTask.
Definition at line 139 of file ODTask.h.
Referenced by DoSome(), and ODUpdate().
|
inlinevirtual |
Reimplemented in ODComputeSummaryTask.
Definition at line 75 of file ODTask.h.
Referenced by DoSome().
|
protected |
Definition at line 158 of file ODTask.h.
Referenced by DoSome(), and TerminateAndBlock().
|
protected |
Definition at line 163 of file ODTask.h.
Referenced by GetDemandSample(), and SetDemandSample().
|
mutableprotected |
Definition at line 164 of file ODTask.h.
Referenced by GetDemandSample(), and SetDemandSample().
|
protected |
|
protected |
Definition at line 166 of file ODTask.h.
Referenced by IsRunning(), ODTask(), and SetIsRunning().
|
protected |
Definition at line 167 of file ODTask.h.
Referenced by IsRunning(), and SetIsRunning().
|
private |
Definition at line 172 of file ODTask.h.
Referenced by GetNeedsODUpdate(), ODTask(), ResetNeedsODUpdate(), and SetNeedsODUpdate().
|
private |
Definition at line 173 of file ODTask.h.
Referenced by GetNeedsODUpdate(), ResetNeedsODUpdate(), and SetNeedsODUpdate().
|
protected |
Definition at line 151 of file ODTask.h.
Referenced by ODComputeSummaryTask::CalculatePercentComplete(), ODDecodeTask::CalculatePercentComplete(), ODComputeSummaryTask::ComputeNextWorkUntilPercentageComplete(), ODComputeSummaryTask::DoSomeInternal(), ODDecodeTask::DoSomeInternal(), ODTask(), and PercentComplete().
|
protected |
Definition at line 152 of file ODTask.h.
Referenced by ODComputeSummaryTask::CalculatePercentComplete(), ODDecodeTask::CalculatePercentComplete(), ODComputeSummaryTask::ComputeNextWorkUntilPercentageComplete(), ODComputeSummaryTask::DoSomeInternal(), ODDecodeTask::DoSomeInternal(), and PercentComplete().
|
protected |
Definition at line 150 of file ODTask.h.
Referenced by GetTaskNumber(), and ODTask().
|
protected |
|
protected |
Definition at line 155 of file ODTask.h.
Referenced by DoSome(), ODTask(), and TerminateAndBlock().
|
protected |
Definition at line 156 of file ODTask.h.
Referenced by DoSome(), and TerminateAndBlock().
|
protected |
Definition at line 161 of file ODTask.h.
Referenced by DemandTrackUpdate(), ODComputeSummaryTask::DoSomeInternal(), ODDecodeTask::DoSomeInternal(), GetNumWaveTracks(), GetWaveTrack(), IsTaskAssociatedWithProject(), ReplaceWaveTrack(), StopUsingWaveTrack(), ODComputeSummaryTask::Update(), and ODDecodeTask::Update().
|
protected |
Definition at line 160 of file ODTask.h.
Referenced by AddWaveTrack(), DemandTrackUpdate(), ODComputeSummaryTask::DoSomeInternal(), ODDecodeTask::DoSomeInternal(), GetNumWaveTracks(), GetWaveTrack(), IsTaskAssociatedWithProject(), ReplaceWaveTrack(), StopUsingWaveTrack(), ODComputeSummaryTask::Update(), and ODDecodeTask::Update().
enum { ... } ODTask::ODTypeEnum |