Audacity  2.2.0
ODComputeSummaryTask.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ODComputeSummaryTask.h
6 
7  Created by Michael Chinen (mchinen) on 6/8/08.
8  Audacity(R) is copyright (c) 1999-2008 Audacity Team.
9  License: GPL v2. See License.txt.
10 
11 ******************************************************************//*******************************************************************/
18 
19 #ifndef __AUDACITY_ODComputeSummaryTask__
20 #define __AUDACITY_ODComputeSummaryTask__
21 
22 #include <vector>
23 #include "ODTask.h"
24 #include "ODTaskThread.h"
26 class WaveTrack;
27 
29 class ODComputeSummaryTask final : public ODTask
30 {
31  public:
32 
33  // Constructor / Destructor
34 
37  virtual ~ODComputeSummaryTask(){};
38 
39  movable_ptr<ODTask> Clone() const override;
40 
42  unsigned int GetODType() override { return eODPCMSummary; }
43 
45  const char* GetTaskName() override { return "ODComputeSummaryTask"; }
46 
47  const wxChar* GetTip() override { return _("Import complete. Calculating waveform"); }
48 
49  bool UsesCustomWorkUntilPercentage() override { return true; }
51 
53  void Terminate() override;
54 
55 protected:
57  void CalculatePercentComplete() override;
58 
60  void DoSomeInternal() override;
61 
64  void Update() override;
65 
67  void OrderBlockFiles
68  (std::vector< std::weak_ptr< ODPCMAliasBlockFile > > &unorderedBlocks);
69 
71  void MarkUpdateRan();
72  bool HasUpdateRan();
73 
74  //mBlockFiles is touched on several threads- the OD terminate thread, and the task thread, so we need to mutex it.
76  std::vector< std::weak_ptr< ODPCMAliasBlockFile > > mBlockFiles;
80 };
81 
82 #endif
83 
const char * GetTaskName() override
Return the task name.
Definition: ODComputeSummaryTask.h:45
virtual ~ODComputeSummaryTask()
Definition: ODComputeSummaryTask.h:37
bool UsesCustomWorkUntilPercentage() override
Definition: ODComputeSummaryTask.h:49
std::unique_ptr< T > movable_ptr
Definition: MemoryX.h:683
An AliasBlockFile that references uncompressed data in an existing file.
Definition: ODPCMAliasBlockFile.h:46
std::vector< std::weak_ptr< ODPCMAliasBlockFile > > mBlockFiles
Definition: ODComputeSummaryTask.h:76
void CalculatePercentComplete() override
recalculates the percentage complete.
Definition: ODComputeSummaryTask.cpp:163
int mMaxBlockFiles
Definition: ODComputeSummaryTask.h:77
Definition: ODTask.h:47
bool HasUpdateRan()
Definition: ODComputeSummaryTask.cpp:154
ODLock mHasUpdateRanMutex
Definition: ODComputeSummaryTask.h:78
float ComputeNextWorkUntilPercentageComplete() override
Definition: ODComputeSummaryTask.cpp:134
bool mHasUpdateRan
Definition: ODComputeSummaryTask.h:79
void MarkUpdateRan()
tells us whether or not Update has been run at least once.
Definition: ODComputeSummaryTask.cpp:147
movable_ptr< ODTask > Clone() const override
Definition: ODComputeSummaryTask.cpp:38
ODLock mBlockFilesMutex
Definition: ODComputeSummaryTask.h:75
A class representing a modular task to be used with the On-Demand structures.
Definition: ODTask.h:39
void OrderBlockFiles(std::vector< std::weak_ptr< ODPCMAliasBlockFile > > &unorderedBlocks)
Orders the input as either On-Demand or default layered order.
Definition: ODComputeSummaryTask.cpp:251
void Terminate() override
releases memory that the ODTask owns. Subclasses should override.
Definition: ODComputeSummaryTask.cpp:48
const wxChar * GetTip() override
Definition: ODComputeSummaryTask.h:47
void Update() override
Definition: ODComputeSummaryTask.cpp:177
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
A class representing a modular task to be used with the On-Demand structures.
Definition: ODComputeSummaryTask.h:29
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
Definition: TrackControls.cpp:137
Definition: ODTaskThread.h:150
ODComputeSummaryTask()
Constructs an ODTask.
Definition: ODComputeSummaryTask.cpp:32
unsigned int GetODType() override
Subclasses should override to return respective type.
Definition: ODComputeSummaryTask.h:42
void DoSomeInternal() override
Computes and writes the data for one BlockFile if it still has a refcount.
Definition: ODComputeSummaryTask.cpp:58