Audacity  2.2.0
ODComputeSummaryTask Class Referencefinal

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

#include <ODComputeSummaryTask.h>

Inheritance diagram for ODComputeSummaryTask:

Public Member Functions

 ODComputeSummaryTask ()
 Constructs an ODTask. More...
virtual ~ODComputeSummaryTask ()
movable_ptr< ODTaskClone () const override
unsigned int GetODType () override
 Subclasses should override to return respective type. More...
const char * GetTaskName () override
 Return the task name. More...
const wxChar * GetTip () override
bool UsesCustomWorkUntilPercentage () override
float ComputeNextWorkUntilPercentageComplete () override
void Terminate () override
 releases memory that the ODTask owns. Subclasses should override. More...
- Public Member Functions inherited from ODTask
 ODTask ()
 Constructs an ODTask. More...
virtual ~ODTask ()
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 CanMergeWith (ODTask *otherTask)
virtual void StopUsingWaveTrack (WaveTrack *track)
virtual void ReplaceWaveTrack (WaveTrack *oldTrack, WaveTrack *newTrack)
 Replaces all instances to a wavetrack with a NEW one, effectively transferring the task. More...
void AddWaveTrack (WaveTrack *track)
 Adds a WaveTrack to do the task for. More...
virtual int GetNumWaveTracks ()
virtual 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 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 bool IsTaskAssociatedWithProject (AudacityProject *proj)
 returns true if the task is associated with the project. More...
bool IsRunning ()

Protected Member Functions

void CalculatePercentComplete () override
 recalculates the percentage complete. More...
void DoSomeInternal () override
 Computes and writes the data for one BlockFile if it still has a refcount. More...
void Update () override
void OrderBlockFiles (std::vector< std::weak_ptr< ODPCMAliasBlockFile > > &unorderedBlocks)
 Orders the input as either On-Demand or default layered order. More...
void MarkUpdateRan ()
 tells us whether or not Update has been run at least once. More...
bool HasUpdateRan ()
- Protected Member Functions inherited from ODTask
virtual void ODUpdate ()
void SetIsRunning (bool value)

Protected Attributes

ODLock mBlockFilesMutex
std::vector< std::weak_ptr
< ODPCMAliasBlockFile > > 
int mMaxBlockFiles
ODLock mHasUpdateRanMutex
bool mHasUpdateRan
- Protected Attributes inherited from ODTask
int mTaskNumber
volatile float mPercentComplete
ODLock mPercentCompleteMutex
volatile bool mDoingTask
volatile bool mTaskStarted
volatile bool mTerminate
ODLock mTerminateMutex
ODLock mBlockUntilTerminateMutex
std::vector< WaveTrack * > mWaveTracks
ODLock mWaveTrackMutex
sampleCount mDemandSample
ODLock mDemandSampleMutex
volatile bool mIsRunning
ODLock mIsRunningMutex

Additional Inherited Members

- Public Types inherited from ODTask
enum  {
  eODNone = 0x00000000, eODFLAC = 0x00000001, eODMP3 = 0x00000002, eODFFMPEG = 0x00000004,
  eODPCMSummary = 0x00001000, eODOTHER = 0x10000000
- Public Attributes inherited from ODTask
enum ODTask:: { ... }  ODTypeEnum

Detailed Description

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

Computes the summary data for a PCM (WAV) file and writes it to disk, updating the ODPCMAliasBlockFile and the GUI of the newly available data.

Constructor & Destructor Documentation

ODComputeSummaryTask::ODComputeSummaryTask ( )

Constructs an ODTask.

Creates a NEW task that computes summaries for a wavetrack that needs to be specified through SetWaveTrack()

References mHasUpdateRan, and mMaxBlockFiles.

virtual ODComputeSummaryTask::~ODComputeSummaryTask ( )

Member Function Documentation

void ODComputeSummaryTask::CalculatePercentComplete ( )

recalculates the percentage complete.

Implements ODTask.

References HasUpdateRan(), mBlockFiles, mMaxBlockFiles, ODTask::mPercentComplete, and ODTask::mPercentCompleteMutex.

Referenced by DoSomeInternal().

movable_ptr< ODTask > ODComputeSummaryTask::Clone ( ) const

Implements ODTask.

References ODTask::GetDemandSample().

float ODComputeSummaryTask::ComputeNextWorkUntilPercentageComplete ( )

compute the next time we should take a break in terms of overall percentage. We want to do a constant number of blockfiles.

Reimplemented from ODTask.

References kNumBlockFilesPerDoSome, mMaxBlockFiles, ODTask::mPercentComplete, and ODTask::mPercentCompleteMutex.

void ODComputeSummaryTask::DoSomeInternal ( )
unsigned int ODComputeSummaryTask::GetODType ( )

Subclasses should override to return respective type.

Reimplemented from ODTask.

References ODTask::eODPCMSummary.

const char* ODComputeSummaryTask::GetTaskName ( )

Return the task name.

Reimplemented from ODTask.

const wxChar* ODComputeSummaryTask::GetTip ( )

Implements ODTask.

References _().

bool ODComputeSummaryTask::HasUpdateRan ( )
void ODComputeSummaryTask::MarkUpdateRan ( )

tells us whether or not Update has been run at least once.

References mHasUpdateRan, and mHasUpdateRanMutex.

Referenced by Update().

void ODComputeSummaryTask::OrderBlockFiles ( std::vector< std::weak_ptr< ODPCMAliasBlockFile > > &  unorderedBlocks)

Orders the input as either On-Demand or default layered order.

Computes the summary calculation queue order of the blockfiles.

Referenced by Update().

void ODComputeSummaryTask::Terminate ( )

releases memory that the ODTask owns. Subclasses should override.

Reimplemented from ODTask.

References mBlockFiles, and mBlockFilesMutex.

void ODComputeSummaryTask::Update ( )

Readjusts the blockfile order in the default manner. If we have had an ODRequest Then it updates in the OD manner.

creates the order of the wavetrack to load. by default left to right, or frome the point the user has clicked.

Reimplemented from ODTask.

References SeqBlock::f, MarkUpdateRan(), mBlockFilesMutex, ODTask::mWaveTrackMutex, ODTask::mWaveTracks, OrderBlockFiles(), ODPCMAliasBlockFile::SetStart(), and SeqBlock::start.

bool ODComputeSummaryTask::UsesCustomWorkUntilPercentage ( )

Reimplemented from ODTask.

Member Data Documentation

std::vector< std::weak_ptr< ODPCMAliasBlockFile > > ODComputeSummaryTask::mBlockFiles
ODLock ODComputeSummaryTask::mBlockFilesMutex

Referenced by DoSomeInternal(), Terminate(), and Update().

bool ODComputeSummaryTask::mHasUpdateRan
ODLock ODComputeSummaryTask::mHasUpdateRanMutex

Referenced by HasUpdateRan(), and MarkUpdateRan().

int ODComputeSummaryTask::mMaxBlockFiles

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