Update of /cvsroot/audacity/audacity-src/src
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26885

Modified Files:
        DirManager.cpp DirManager.h Sequence.cpp Sequence.h 
        WaveClip.cpp WaveClip.h WaveTrack.cpp WaveTrack.h 
Log Message:
checking in functional but incomplete on demand import of FLAC functionality.  
This feature is not enabled now.  Saving and copy/paste does not work yet.


Index: DirManager.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/DirManager.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- DirManager.h        8 Oct 2009 14:32:09 -0000       1.38
+++ DirManager.h        9 Oct 2009 14:28:48 -0000       1.39
@@ -65,7 +65,7 @@
                                  sampleCount aliasLen, int aliasChannel);
                                  
    BlockFile *NewODDecodeBlockFile( wxString aliasedFile, sampleCount 
aliasStart,
-                                 sampleCount aliasLen, int aliasChannel);
+                                 sampleCount aliasLen, int aliasChannel, int 
decodeType);
 
    // Adds one to the reference count of the block file,
    // UNLESS it is "locked", then it makes a new copy of

Index: WaveClip.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveClip.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- WaveClip.h  8 Oct 2009 14:32:09 -0000       1.39
+++ WaveClip.h  9 Oct 2009 14:28:48 -0000       1.40
@@ -151,7 +151,7 @@
                     sampleCount len, int channel,bool useOD);
                     
    bool AppendCoded(wxString fName, sampleCount start,
-                            sampleCount len, int channel);
+                            sampleCount len, int channel, int decodeType);
 
    /// This name is consistent with WaveTrack::Clear. It performs a "Cut"
    /// operation (but without putting the cutted audio to the clipboard)

Index: Sequence.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Sequence.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- Sequence.h  8 Oct 2009 14:32:09 -0000       1.23
+++ Sequence.h  9 Oct 2009 14:28:48 -0000       1.24
@@ -90,7 +90,7 @@
                     sampleCount len, int channel,bool useOD);
 
    bool AppendCoded(wxString fName, sampleCount start,
-                            sampleCount len, int channel);
+                            sampleCount len, int channel, int decodeType);
                     
    // Append a blockfile. The blockfile pointer is then "owned" by the
    // sequence. This function is used by the recording log crash recovery

Index: WaveTrack.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveTrack.h,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- WaveTrack.h 8 Oct 2009 14:32:09 -0000       1.74
+++ WaveTrack.h 9 Oct 2009 14:28:48 -0000       1.75
@@ -179,9 +179,11 @@
    bool AppendAlias(wxString fName, sampleCount start,
                     sampleCount len, int channel,bool useOD);
    
-   ///for use with On-Demand decoding of compressed files
+   ///for use with On-Demand decoding of compressed files.
+   ///decodeType should be an enum from ODDecodeTask that specifies what
+   ///Type of encoded file this is, such as eODFLAC
    bool AppendCoded(wxString fName, sampleCount start,
-                            sampleCount len, int channel);
+                            sampleCount len, int channel, int decodeType);
                     
    ///Deletes all clips' wavecaches.  Careful, This may not be threadsafe.
    void DeleteWaveCaches();

Index: WaveTrack.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveTrack.cpp,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- WaveTrack.cpp       8 Oct 2009 14:32:09 -0000       1.167
+++ WaveTrack.cpp       9 Oct 2009 14:28:48 -0000       1.168
@@ -1290,9 +1290,9 @@
 
 
 bool WaveTrack::AppendCoded(wxString fName, sampleCount start,
-                            sampleCount len, int channel)
+                            sampleCount len, int channel, int decodeType)
 {
-   return GetLastOrCreateClip()->AppendCoded(fName, start, len, channel);
+   return GetLastOrCreateClip()->AppendCoded(fName, start, len, channel, 
decodeType);
 }
 
 sampleCount WaveTrack::GetBestBlockSize(sampleCount s)

Index: DirManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/DirManager.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- DirManager.cpp      8 Oct 2009 14:32:09 -0000       1.90
+++ DirManager.cpp      9 Oct 2009 14:28:48 -0000       1.91
@@ -800,13 +800,13 @@
 
 BlockFile *DirManager::NewODDecodeBlockFile(
                                  wxString aliasedFile, sampleCount aliasStart,
-                                 sampleCount aliasLen, int aliasChannel)
+                                 sampleCount aliasLen, int aliasChannel, int 
decodeType)
 {
    wxFileName fileName = MakeBlockFileName();
 
    BlockFile *newBlockFile =
        new ODDecodeBlockFile(fileName,
-                             aliasedFile, aliasStart, aliasLen, aliasChannel);
+                             aliasedFile, aliasStart, aliasLen, aliasChannel, 
decodeType);
 
    blockFileHash[fileName.GetName()]=newBlockFile;
    aliasList.Add(aliasedFile); //OD TODO: check to see if we need to remove 
this when done decoding.
@@ -1159,6 +1159,19 @@
          //ODBlocks access the aliased file on another thread, so we need to 
pause them before this continues.
          ab->LockRead();
       }
+      
+      //now for encoded OD blocks  (e.g. flac)
+      // don't worry, we don't rely on this cast unless ISDataAvailable is 
false
+      // which means that it still needs to access the file.
+      ODDecodeBlockFile *db = (ODDecodeBlockFile*)b;
+      if (!b->IsDataAvailable() && db->GetEncodedAudioFilename() == fName) {
+         needToRename = true;
+         //wxPrintf(_("Changing block %s\n"), 
b->GetFileName().GetFullName().c_str());
+         //ab->ChangeAliasedFile(renamedFile);
+         
+         //ODBlocks access the aliased file on another thread, so we need to 
pause them before this continues.
+         db->LockRead();
+      }
 
       it++;
    }
@@ -1178,11 +1191,16 @@
          while(it != blockFileHash.end()) {
             BlockFile *b = it->second;
             AliasBlockFile *ab = (AliasBlockFile*)b;
+            ODDecodeBlockFile *db = (ODDecodeBlockFile*)b;
+
 
             if (b->IsAlias() && ab->GetAliasedFile() == fName)
             {
                ab->UnlockRead();
             }
+            if (!b->IsDataAvailable() && db->GetEncodedAudioFilename() == 
fName) {
+               db->UnlockRead();
+            }
             it++;
          }
 
@@ -1199,6 +1217,7 @@
          while(it != blockFileHash.end()) {
             BlockFile *b = it->second;
             AliasBlockFile *ab = (AliasBlockFile*)b;
+            ODDecodeBlockFile *db = (ODDecodeBlockFile*)b;
 
             if (b->IsAlias() && ab->GetAliasedFile() == fName)
             {
@@ -1207,6 +1226,10 @@
                wxPrintf(_("Changed block %s to new alias name\n"), 
b->GetFileName().GetFullName().c_str());
                
             }
+            if (!b->IsDataAvailable() && db->GetEncodedAudioFilename() == 
fName) {
+               db->ChangeAudioFile(renamedFile);
+               db->UnlockRead();
+            }
             it++;
          }
 

Index: Sequence.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Sequence.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- Sequence.cpp        8 Oct 2009 14:32:09 -0000       1.58
+++ Sequence.cpp        9 Oct 2009 14:28:48 -0000       1.59
@@ -629,7 +629,7 @@
 }
 
 bool Sequence::AppendCoded(wxString fName, sampleCount start,
-                            sampleCount len, int channel)
+                            sampleCount len, int channel, int decodeType)
 {
    // Quick check to make sure that it doesn't overflow
    if (((double)mNumSamples) + ((double)len) > wxLL(9223372036854775807))
@@ -638,7 +638,7 @@
    SeqBlock *newBlock = new SeqBlock();
 
    newBlock->start = mNumSamples;
-   newBlock->f = mDirManager->NewODDecodeBlockFile(fName, start, len, channel);
+   newBlock->f = mDirManager->NewODDecodeBlockFile(fName, start, len, channel, 
decodeType);
    mBlock->Add(newBlock);
    mNumSamples += newBlock->f->GetLength();
 

Index: WaveClip.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveClip.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- WaveClip.cpp        8 Oct 2009 14:32:09 -0000       1.56
+++ WaveClip.cpp        9 Oct 2009 14:28:48 -0000       1.57
@@ -1075,9 +1075,9 @@
 }
 
 bool WaveClip::AppendCoded(wxString fName, sampleCount start,
-                            sampleCount len, int channel)
+                            sampleCount len, int channel, int decodeType)
 {
-   bool result = mSequence->AppendCoded(fName, start, len, channel);
+   bool result = mSequence->AppendCoded(fName, start, len, channel, 
decodeType);
    if (result)
    {
       UpdateEnvelopeTrackLen();


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to