Update of /cvsroot/audacity/audacity-src/src/ondemand
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv7163/ondemand
Modified Files:
ODComputeSummaryTask.cpp ODManager.cpp ODManager.h ODTask.cpp
ODTask.h ODWaveTrackTaskQueue.cpp
Log Message:
Fixing Undo/Redo bug. Fixed some comments too.
Index: ODWaveTrackTaskQueue.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ondemand/ODWaveTrackTaskQueue.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ODWaveTrackTaskQueue.cpp 16 Jul 2008 21:02:50 -0000 1.6
+++ ODWaveTrackTaskQueue.cpp 25 Jul 2008 15:21:15 -0000 1.7
@@ -69,10 +69,11 @@
mTasks.push_back(task);
mTasksMutex.Unlock();
- //take all of the tracks in the task. this is not threadsafe, but I think
we are safe anyway
+ //take all of the tracks in the task.
mTracksMutex.Lock();
for(int i=0;i<task->GetNumWaveTracks();i++)
{
+ //ODTask::GetWaveTrack is not threadsafe, but I think we are safe
anyway, because the task isn't being run yet?
mTracks.push_back(task->GetWaveTrack(i));
}
Index: ODManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ondemand/ODManager.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- ODManager.cpp 16 Jul 2008 21:02:50 -0000 1.12
+++ ODManager.cpp 25 Jul 2008 15:21:14 -0000 1.13
@@ -63,6 +63,7 @@
{
//search for a task containing the lead track.
//This may be buggy when adding tracks. We may have to do an exhaustive
search instead.
+ //note that GetWaveTrack is not threadsafe, but we are assuming task is
not running on a different thread yet.
if(mQueues[i]->ContainsWaveTrack(task->GetWaveTrack(0)))
queue=mQueues[i];
}
@@ -108,6 +109,11 @@
return man;
}
+bool ODManager::IsInstanceCreated()
+{
+ return gManagerCreated;
+}
+
///Launches a thread for the manager and starts accepting Tasks.
void ODManager::Init()
{
Index: ODTask.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ondemand/ODTask.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ODTask.h 16 Jul 2008 21:02:50 -0000 1.6
+++ ODTask.h 25 Jul 2008 15:21:15 -0000 1.7
@@ -74,9 +74,9 @@
virtual const char* GetTaskName(){return "ODTask";}
- virtual sampleCount GetDemandSample(){return mDemandSample;}
+ virtual sampleCount GetDemandSample();
- virtual void SetDemandSample(sampleCount
sample){mDemandSample=sample;mDemand=true;}
+ virtual void SetDemandSample(sampleCount sample);
///returns the number of tasks created before this instance.
int GetTaskNumber(){return mTaskNumber;}
@@ -102,12 +102,16 @@
bool mTerminate;
ODLock mTerminateMutex;
- bool mDemand;
- sampleCount mDemandSample;
//for a function not a member var.
ODLock mBlockUntilTerminateMutex;
-
+
+ private:
+ sampleCount mDemandSample;
+ ODLock mDemandSampleMutex;
+
+ bool mDemand;
+ ODLock mDemandMutex;
};
#endif
Index: ODTask.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ondemand/ODTask.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ODTask.cpp 16 Jul 2008 21:02:50 -0000 1.7
+++ ODTask.cpp 25 Jul 2008 15:21:15 -0000 1.8
@@ -107,7 +107,7 @@
if(!IsComplete() && !mTerminate)
{
ODManager::Instance()->AddTask(this);
- // printf("%s %i is %f done\n",
GetTaskName(),GetTaskNumber(),PercentComplete());
+// printf("%s %i is %f done\n",
GetTaskName(),GetTaskNumber(),PercentComplete());
}
else
{
@@ -118,13 +118,35 @@
proj->AddPendingEvent( event );
AudacityProject::AllProjectsDeleteUnlock();
- // printf("%s %i complete\n", GetTaskName(),GetTaskNumber());
+// printf("%s %i complete\n", GetTaskName(),GetTaskNumber());
}
mTerminateMutex.Unlock();
mBlockUntilTerminateMutex.Unlock();
}
+sampleCount ODTask::GetDemandSample()
+{
+ sampleCount retval;
+ mDemandSampleMutex.Lock();
+ retval = mDemandSample;
+ mDemandSampleMutex.Unlock();
+ return retval;
+}
+
+void ODTask::SetDemandSample(sampleCount sample)
+{
+
+ mDemandSampleMutex.Lock();
+ mDemandSample=sample;
+ mDemandSampleMutex.Unlock();
+
+ mDemandMutex.Lock();
+ mDemand=true;
+ mDemandMutex.Unlock();
+}
+
+
///return the amount of the task that has been completed. 0.0 to 1.0
float ODTask::PercentComplete()
{
Index: ODComputeSummaryTask.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ondemand/ODComputeSummaryTask.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ODComputeSummaryTask.cpp 24 Jul 2008 03:12:19 -0000 1.9
+++ ODComputeSummaryTask.cpp 25 Jul 2008 15:21:13 -0000 1.10
@@ -129,6 +129,7 @@
if(track == mWaveTracks[i])
{
SetDemandSample((sampleCount)seconds * track->GetRate());
+ break;
}
}
mWaveTrackMutex.Unlock();
Index: ODManager.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/ondemand/ODManager.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ODManager.h 16 Jul 2008 21:02:50 -0000 1.9
+++ ODManager.h 25 Jul 2008 15:21:14 -0000 1.10
@@ -93,6 +93,9 @@
///returns a flag that is set if we have loaded some OD blockfiles from
PCM.
static bool HasLoadedODFlag();
+
+ ///returns whether or not the singleton instance was created yet
+ static bool IsInstanceCreated();
protected:
//private constructor - Singleton.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs