Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv4140
Modified Files:
BlockFile.cpp BlockFile.h DirManager.cpp Project.cpp
Sequence.cpp Sequence.h UndoManager.cpp UndoManager.h
WaveClip.cpp WaveClip.h WaveTrack.cpp WaveTrack.h
Log Message:
Support for save for OD. mutex issues fixes. tentative exportffmpeg mac
compile fix.
Index: BlockFile.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/BlockFile.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- BlockFile.cpp 3 Dec 2007 03:46:20 -0000 1.43
+++ BlockFile.cpp 10 Aug 2008 02:30:58 -0000 1.44
@@ -120,6 +120,13 @@
return mFileName;
}
+///sets the file name the summary info will be saved in. threadsafe.
+void BlockFile::SetFileName(wxFileName &name)
+{
+ mFileName=name;
+}
+
+
/// Marks this BlockFile as "locked." A locked BlockFile may not
/// be moved or deleted, only copied. Locking a BlockFile prevents
/// it from disappearing if the project is saved in a different location.
Index: WaveClip.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveClip.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- WaveClip.h 27 Jul 2008 15:37:10 -0000 1.31
+++ WaveClip.h 10 Aug 2008 02:31:02 -0000 1.32
@@ -185,7 +185,7 @@
/// Lock all blockfiles
void Lock();
-
+ void CloseLock(); //similar to Lock but should be called when the project
closes.
/// Unlock all blockfiles
void Unlock();
@@ -198,7 +198,7 @@
//
// XMLTagHandler callback methods for loading and saving
//
-
+
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs);
virtual void HandleXMLEndTag(const wxChar *tag);
virtual XMLTagHandler *HandleXMLChild(const wxChar *tag);
Index: BlockFile.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/BlockFile.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- BlockFile.h 13 Jun 2008 03:04:26 -0000 1.24
+++ BlockFile.h 10 Aug 2008 02:30:59 -0000 1.25
@@ -78,6 +78,8 @@
/// Gets the filename of the disk file associated with this BlockFile
virtual wxFileName GetFileName();
+ virtual void SetFileName(wxFileName &name);
+
virtual sampleCount GetLength() { return mLen; }
/// Locks this BlockFile, to prevent it from being moved
@@ -122,6 +124,9 @@
//be able to tell the logging to shut up from outside too.
void SilenceLog() { mSilentLog = TRUE; }
+ ///when the project closes, it locks the blockfiles.
+ ///Override this in case it needs special treatment
+ virtual void CloseLock(){Lock();}
private:
Index: Sequence.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Sequence.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- Sequence.h 27 Jul 2008 15:37:09 -0000 1.19
+++ Sequence.h 10 Aug 2008 02:31:01 -0000 1.20
@@ -121,6 +121,7 @@
//
bool Lock();
+ bool CloseLock();//similar to Lock but should be called upon project close.
bool Unlock();
//
Index: UndoManager.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/UndoManager.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- UndoManager.h 23 May 2008 05:54:00 -0000 1.8
+++ UndoManager.h 10 Aug 2008 02:31:01 -0000 1.9
@@ -50,6 +50,7 @@
#include <wx/dynarray.h>
#include <wx/string.h>
+#include "ondemand/ODTaskThread.h"
class Track;
class TrackList;
@@ -95,6 +96,11 @@
void Debug();
+ ///to mark as unsaved changes without changing the state/tracks.
+ void SetODChangesFlag();
+ bool HasODChangesFlag();
+ void ResetODChangesFlag();
+
private:
int current;
int saved;
@@ -103,6 +109,9 @@
wxString lastAction;
int consolidationCount;
+ bool mODChanges;
+ ODLock mODChangesMutex;//mODChanges is accessed from many threads.
+
};
#endif
Index: WaveTrack.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveTrack.h,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- WaveTrack.h 27 Jul 2008 15:37:10 -0000 1.60
+++ WaveTrack.h 10 Aug 2008 02:31:07 -0000 1.61
@@ -229,6 +229,7 @@
//
bool Lock();
+ bool CloseLock(); //similar to Lock but should be called when the project
closes.
bool Unlock();
// Utility functions to convert between times in seconds
Index: WaveTrack.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveTrack.cpp,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- WaveTrack.cpp 29 Jul 2008 15:41:25 -0000 1.132
+++ WaveTrack.cpp 10 Aug 2008 02:31:07 -0000 1.133
@@ -1508,6 +1508,15 @@
return true;
}
+bool WaveTrack::CloseLock()
+{
+ for (WaveClipList::Node* it=GetClipIterator(); it; it=it->GetNext())
+ it->GetData()->CloseLock();
+
+ return true;
+}
+
+
bool WaveTrack::Unlock()
{
for (WaveClipList::Node* it=GetClipIterator(); it; it=it->GetNext())
Index: UndoManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/UndoManager.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- UndoManager.cpp 4 Nov 2006 19:55:20 -0000 1.21
+++ UndoManager.cpp 10 Aug 2008 02:31:01 -0000 1.22
@@ -36,6 +36,7 @@
current = -1;
saved = -1;
consolidationCount = 0;
+ ResetODChangesFlag();
}
UndoManager::~UndoManager()
@@ -291,12 +292,13 @@
bool UndoManager::UnsavedChanges()
{
- return (saved != current);
+ return (saved != current) || HasODChangesFlag();
}
void UndoManager::StateSaved()
{
saved = current;
+ ResetODChangesFlag();
}
void UndoManager::Debug()
@@ -310,6 +312,31 @@
}
}
+///to mark as unsaved changes without changing the state/tracks.
+void UndoManager::SetODChangesFlag()
+{
+ mODChangesMutex.Lock();
+ mODChanges=true;
+ mODChangesMutex.Unlock();
+}
+bool UndoManager::HasODChangesFlag()
+{
+ bool ret;
+ mODChangesMutex.Lock();
+ ret=mODChanges;
+ mODChangesMutex.Unlock();
+ return ret;
+}
+
+void UndoManager::ResetODChangesFlag()
+{
+ mODChangesMutex.Lock();
+ mODChanges=false;
+ mODChangesMutex.Unlock();
+}
+
+
+
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
Index: Sequence.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Sequence.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- Sequence.cpp 28 Jul 2008 20:19:32 -0000 1.51
+++ Sequence.cpp 10 Aug 2008 02:31:00 -0000 1.52
@@ -110,6 +110,14 @@
return true;
}
+bool Sequence::CloseLock()
+{
+ for (unsigned int i = 0; i < mBlock->Count(); i++)
+ mBlock->Item(i)->f->CloseLock();
+
+ return true;
+}
+
bool Sequence::Unlock()
{
for (unsigned int i = 0; i < mBlock->Count(); i++)
Index: Project.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Project.cpp,v
retrieving revision 1.375
retrieving revision 1.376
diff -u -d -r1.375 -r1.376
--- Project.cpp 7 Aug 2008 00:06:40 -0000 1.375
+++ Project.cpp 10 Aug 2008 02:31:00 -0000 1.376
@@ -1585,7 +1585,7 @@
Track *t = iter.First();
while (t) {
if (t->GetKind() == Track::Wave)
- ((WaveTrack *) t)->Lock();
+ ((WaveTrack *) t)->CloseLock();
t = iter.Next();
}
@@ -2004,41 +2004,6 @@
t = iter.Next();
}
-
-#ifdef EXPERIMENTAL_ONDEMAND
- //check the ODManager to see if we should add the tracks to the
ODManager.
- //this flag would have been set in the HandleXML calls from above, if
there were
- //OD***Blocks.
- if(ODManager::HasLoadedODFlag())
- {
- Track *tr;
- TrackListIterator triter(mTracks);
- mLastSavedTracks = new TrackList();
-
- tr = triter.First();
-
- ODComputeSummaryTask* computeTask;
- bool odUsed = false;
- while (tr) {
- if (tr->GetKind() == Track::Wave)
- {
- if(!odUsed)
- {
- computeTask=new ODComputeSummaryTask;
- odUsed=true;
- }
- computeTask->AddWaveTrack((WaveTrack*)tr);
- }
- tr = triter.Next();
- }
- if(odUsed)
- ODManager::Instance()->AddNewTask(computeTask);
-
- //release the flag.
- ODManager::UnmarkLoadedODFlag();
- }
-#endif
-
InitialState();
mTrackPanel->SetFocusedTrack(iter.First());
HandleResize();
@@ -2111,6 +2076,41 @@
}
GetDirManager()->FillBlockfilesCache();
+
+
+
+#ifdef EXPERIMENTAL_ONDEMAND
+ //check the ODManager to see if we should add the tracks to the
ODManager.
+ //this flag would have been set in the HandleXML calls from above, if
there were
+ //OD***Blocks.
+ if(ODManager::HasLoadedODFlag())
+ {
+ Track *tr;
+ TrackListIterator triter(mTracks);
+ tr = triter.First();
+
+ ODComputeSummaryTask* computeTask;
+ bool odUsed = false;
+ while (tr) {
+ if (tr->GetKind() == Track::Wave)
+ {
+ if(!odUsed)
+ {
+ computeTask=new ODComputeSummaryTask;
+ odUsed=true;
+ }
+ computeTask->AddWaveTrack((WaveTrack*)tr);
+ }
+ tr = triter.Next();
+ }
+ if(odUsed)
+ ODManager::Instance()->AddNewTask(computeTask);
+
+ //release the flag.
+ ODManager::UnmarkLoadedODFlag();
+ }
+#endif
+
}
bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
@@ -2485,7 +2485,8 @@
// We are about to move files from the current directory to
// the new directory. We need to make sure files that belonged
- // to the last saved project don't get erased, so we "lock" them.
+ // to the last saved project don't get erased, so we "lock" them, so
that
+ // SetProject() copies instead of moves the files.
// (Otherwise the new project would be fine, but the old one would
// be empty of all of its files.)
@@ -2500,7 +2501,7 @@
}
}
// This renames the project directory, and moves or copies
- // all of our block files over
+ // all of our block files over.
bool success = mDirManager->SetProject(projPath, projName, !overwrite);
// Unlock all blocks in all tracks of the last saved version
@@ -2545,6 +2546,7 @@
saveFile.Close();
+
// Now that we have saved the file, we can delete the auto-saved version
DeleteCurrentAutoSaveFile();
@@ -2588,8 +2590,16 @@
TrackListIterator iter(mTracks);
Track *t = iter.First();
+ Track *dupT;
while (t) {
- mLastSavedTracks->Add(t->Duplicate());
+ dupT = t->Duplicate();
+ mLastSavedTracks->Add(dupT);
+
+ //only after the xml has been saved we can mark it saved.
+ //thus is because the OD blockfiles change on background thread while
this is going on.
+// if(dupT->GetKind() == Track::Wave)
+ // ((WaveTrack*)dupT)->MarkSaved();
+
t = iter.Next();
}
Index: WaveClip.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveClip.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- WaveClip.cpp 27 Jul 2008 15:37:10 -0000 1.44
+++ WaveClip.cpp 10 Aug 2008 02:31:02 -0000 1.45
@@ -1310,6 +1310,13 @@
it->GetData()->Lock();
}
+void WaveClip::CloseLock()
+{
+ GetSequence()->CloseLock();
+ for (WaveClipList::Node* it = mCutLines.GetFirst(); it; it=it->GetNext())
+ it->GetData()->Lock();
+}
+
void WaveClip::Unlock()
{
GetSequence()->Unlock();
Index: DirManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/DirManager.cpp,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- DirManager.cpp 28 Jul 2008 20:17:15 -0000 1.80
+++ DirManager.cpp 10 Aug 2008 02:31:00 -0000 1.81
@@ -317,6 +317,10 @@
chmod(OSFILENAME(projFull), 0775);
#endif
+ #ifdef __WXMAC__
+ chmod(OSFILENAME(projFull), 0775);
+ #endif
+
} else {
#ifndef __WXMAC__
if (!wxDirExists(projFull))
@@ -398,7 +402,9 @@
wxArrayString dirlist;
count=rm_dash_rf_enumerate(cleanupLoc1,dirlist,wxEmptyString,0,1);
- count+=rm_dash_rf_enumerate(cleanupLoc2,dirlist,wxEmptyString,0,1);
+//This destroys the empty dirs of the OD block files, which are yet to come.
com
+//Dont know if this will make the project dirty, but I doubt it. (mchinen)
+// count+=rm_dash_rf_enumerate(cleanupLoc2,dirlist,wxEmptyString,0,1);
if(count)
rm_dash_rf_execute(dirlist,count,0,1,_("Cleaning up cache
directories"));
@@ -456,10 +462,18 @@
wxString topdir=value.Mid(0,3);
wxString middir=wxT("d");
middir.Append(value.Mid(3,2));
-
- dir.AppendDir(topdir);
+
+ dir.AppendDir(topdir);
dir.AppendDir(middir);
- if(!dir.DirExists())dir.Mkdir(0777,wxPATH_MKDIR_FULL);
+
+ if(!dir.DirExists())
+ {
+ if(!dir.Mkdir(0777,wxPATH_MKDIR_FULL))
+ {
+ printf("mkdir in dirman failed\n");
+ }
+ }
+
}
return dir;
}
@@ -915,27 +929,29 @@
bool DirManager::MoveToNewProjectDirectory(BlockFile *f)
{
wxFileName newFileName;
- wxFileName oldFileName=f->mFileName;
- AssignFile(newFileName,f->mFileName.GetFullName(),FALSE);
+ wxFileName oldFileName=f->GetFileName();
+ AssignFile(newFileName,f->GetFileName().GetFullName(),FALSE);
- if ( !(newFileName == f->mFileName) ) {
- bool ok = f->IsSummaryAvailable() &&
wxRenameFile(f->mFileName.GetFullPath(),
+ if ( !(newFileName == f->GetFileName()) ) {
+ bool ok = f->IsSummaryAvailable() &&
wxRenameFile(f->GetFileName().GetFullPath(),
newFileName.GetFullPath());
if (ok)
- f->mFileName = newFileName;
+ f->SetFileName(newFileName);
else {
//check to see that summary exists before we copy.
bool summaryExisted = f->IsSummaryAvailable();
if( summaryExisted)
{
- if(!wxCopyFile(f->mFileName.GetFullPath(),
- newFileName.GetFullPath()))
+ if(!wxRenameFile(f->GetFileName().GetFullPath(),
+ newFileName.GetFullPath()))
+ /*wxCopyFile(f->GetFileName().GetFullPath(),
+ newFileName.GetFullPath()))*/
return false;
- wxRemoveFile(f->mFileName.GetFullPath());
+// wxRemoveFile(f->GetFileName().GetFullPath());
}
- f->mFileName = newFileName;
+ f->SetFileName(newFileName);
//there is a small chance that the summary has begun to be computed
on a different thread with the
//original filename. we need to catch this case by waiting for it to
finish and then copy.
@@ -953,7 +969,7 @@
ok = wxCopyFile(oldFileName.GetFullPath(),
newFileName.GetFullPath());
if(ok)
- wxRemoveFile(f->mFileName.GetFullPath());
+ wxRemoveFile(f->GetFileName().GetFullPath());
}
}
}
@@ -965,19 +981,19 @@
bool DirManager::CopyToNewProjectDirectory(BlockFile *f)
{
wxFileName newFileName;
- wxFileName oldFileName=f->mFileName;
- AssignFile(newFileName,f->mFileName.GetFullName(),FALSE);
+ wxFileName oldFileName=f->GetFileName();
+ AssignFile(newFileName,f->GetFileName().GetFullName(),FALSE);
//mchinen:5/31/08:adding OD support
//But also I'm also wondering if we need to delete the copied file here,
while i'm reimplementing.
//see original code below - I don't see where that file will ever get
delted or used again.
- if ( !(newFileName == f->mFileName) ) {
+ if ( !(newFileName == f->GetFileName()) ) {
bool ok=true;
bool summaryExisted = f->IsSummaryAvailable();
if( summaryExisted)
{
- if(!wxCopyFile(f->mFileName.GetFullPath(),
+ if(!wxCopyFile(f->GetFileName().GetFullPath(),
newFileName.GetFullPath()))
return false;
//TODO:make sure we shouldn't delete
@@ -985,7 +1001,7 @@
}
- f->mFileName = newFileName;
+ f->SetFileName(newFileName);
//there is a small chance that the summary has begun to be computed on a
different thread with the
//original filename. we need to catch this case by waiting for it to
finish and then copy.
-------------------------------------------------------------------------
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