Audacity  2.2.0
ODWaveTrackTaskQueue.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ODWaveTrackTaskQueue.h
6 
7  Created by Michael Chinen (mchinen)
8  Audacity(R) is copyright (c) 1999-2008 Audacity Team.
9  License: GPL v2. See License.txt.
10 
11 ******************************************************************//*******************************************************************/
18 
19 
20 
21 
22 #ifndef __AUDACITY_ODWAVETRACKTASKQUEUE__
23 #define __AUDACITY_ODWAVETRACKTASKQUEUE__
24 
25 #include "../MemoryX.h"
26 #include <vector>
27 #include "ODTaskThread.h"
28 #include <wx/wx.h>
29 class WaveTrack;
30 class ODTask;
33 {
34  public:
35 
36  // Constructor / Destructor
37 
40 
41  virtual ~ODWaveTrackTaskQueue();
42 
43 
44 
46  void AddWaveTrack(WaveTrack* track);
49  void RemoveWaveTrack(WaveTrack* track);
50 
52  void DemandTrackUpdate(WaveTrack* track, double seconds);
53 
55  void ReplaceWaveTrack(WaveTrack* oldTrack,WaveTrack* newTrack);
56 
57  //if the wavetrack is in this queue, and is not the only wavetrack, clones the tasks and schedules it.
59 
61  bool CanMergeWith(ODWaveTrackTaskQueue* otherQueue);
62  void MergeWaveTrack(WaveTrack* track);
63 
64 
65  //returns true if the agrument is in the WaveTrack list.
66  bool ContainsWaveTrack(const WaveTrack* track);
67 
68  //returns the wavetrack at position x.
69  WaveTrack* GetWaveTrack(size_t x);
70 
72  int GetNumWaveTracks();
73 
75  void AddTask(movable_ptr<ODTask> &&mtask);
76 
77  //returns true if either tracks or tasks are empty
78  bool IsEmpty();
79 
80  //returns true if the foremost task exists and is empty.
81  bool IsFrontTaskComplete();
82 
84  void RemoveFrontTask();
85 
88 
90  int GetNumTasks();
91 
93  ODTask* GetTask(size_t x);
94 
96  void FillTipForWaveTrack( const WaveTrack * t, wxString &tip );
97 
98  protected:
99 
100  //because we need to save this around for the tool tip.
101  wxString mTipMsg;
102 
103 
105  std::vector<WaveTrack*> mTracks;
107 
109  std::vector<movable_ptr<ODTask>> mTasks;
111 
112 };
113 
114 #endif
115 
void MergeWaveTrack(WaveTrack *track)
Definition: ODWaveTrackTaskQueue.cpp:65
std::unique_ptr< T > movable_ptr
Definition: MemoryX.h:683
ODTask * GetFrontTask()
Schedules the front task for immediate execution.
Definition: ODWaveTrackTaskQueue.cpp:316
void AddWaveTrack(WaveTrack *track)
Adds a track to the associated list.
Definition: ODWaveTrackTaskQueue.cpp:94
ODLock mTasksMutex
Definition: ODWaveTrackTaskQueue.h:110
void RemoveFrontTask()
Removes and deletes the front task from the list.
Definition: ODWaveTrackTaskQueue.cpp:304
virtual ~ODWaveTrackTaskQueue()
Definition: ODWaveTrackTaskQueue.cpp:28
ODLock mTracksMutex
Definition: ODWaveTrackTaskQueue.h:106
void AddTask(movable_ptr< ODTask > &&mtask)
Add a task to the queue.
Definition: ODWaveTrackTaskQueue.cpp:104
int GetNumWaveTracks()
returns the number of wavetracks in this queue.
Definition: ODWaveTrackTaskQueue.cpp:237
std::vector< WaveTrack * > mTracks
the list of tracks associated with this queue.
Definition: ODWaveTrackTaskQueue.h:105
A class representing a modular task to be used with the On-Demand structures.
Definition: ODTask.h:39
bool ContainsWaveTrack(const WaveTrack *track)
returns true if the argument is in the WaveTrack list.
Definition: ODWaveTrackTaskQueue.cpp:79
void FillTipForWaveTrack(const WaveTrack *t, wxString &tip)
fills in the status bar message for a given track
Definition: ODWaveTrackTaskQueue.cpp:329
WaveTrack * GetWaveTrack(size_t x)
Definition: ODWaveTrackTaskQueue.cpp:226
void RemoveWaveTrack(WaveTrack *track)
Definition: ODWaveTrackTaskQueue.cpp:129
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
int GetNumTasks()
returns the number of ODTasks in this queue
Definition: ODWaveTrackTaskQueue.cpp:247
Definition: ODTaskThread.h:150
void DemandTrackUpdate(WaveTrack *track, double seconds)
changes the tasks associated with this Waveform to process the task from a different point in the tra...
Definition: ODWaveTrackTaskQueue.cpp:192
void MakeWaveTrackIndependent(WaveTrack *track)
Definition: ODWaveTrackTaskQueue.cpp:149
ODWaveTrackTaskQueue()
Constructs an ODWaveTrackTaskQueue.
Definition: ODWaveTrackTaskQueue.cpp:24
bool IsEmpty()
Definition: ODWaveTrackTaskQueue.cpp:270
ODTask * GetTask(size_t x)
returns a ODTask at position x
Definition: ODWaveTrackTaskQueue.cpp:257
A class representing a modular task to be used with the On-Demand structures.
Definition: ODWaveTrackTaskQueue.h:32
bool CanMergeWith(ODWaveTrackTaskQueue *otherQueue)
returns whether or not this queue's task list and another's can merge together, as when we make two m...
Definition: ODWaveTrackTaskQueue.cpp:42
void ReplaceWaveTrack(WaveTrack *oldTrack, WaveTrack *newTrack)
replaces all instances of a WaveTrack within this task with another.
Definition: ODWaveTrackTaskQueue.cpp:208
std::vector< movable_ptr< ODTask > > mTasks
the list of tasks associated with the tracks. This class owns these tasks.
Definition: ODWaveTrackTaskQueue.h:109
wxString mTipMsg
Definition: ODWaveTrackTaskQueue.h:101
bool IsFrontTaskComplete()
Definition: ODWaveTrackTaskQueue.cpp:285