Update of /cvsroot/audacity/audacity-src/src/blockfile
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv24482/blockfile

Modified Files:
      Tag: AUDACITY_1_2
        PCMAliasBlockFile.cpp 
Log Message:
Allow fallback of looking for the file name, located in the data directory.

Index: PCMAliasBlockFile.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/blockfile/PCMAliasBlockFile.cpp,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -d -r1.4.2.1 -r1.4.2.2
--- PCMAliasBlockFile.cpp       21 Apr 2004 23:33:54 -0000      1.4.2.1
+++ PCMAliasBlockFile.cpp       5 Dec 2006 03:36:08 -0000       1.4.2.2
@@ -38,6 +38,8 @@
 {
 }
 
+wxString gProjDir = ""; // Needs to be set in BuildFromXML, so just use a 
global instead of a member.
+
 /// Reads the specified data from the aliased file, using libsndfile,
 /// and converts it to the given sample format.
 ///
@@ -51,9 +53,14 @@
    SF_INFO info;
 
    memset(&info, 0, sizeof(info));
-   SNDFILE *sf = sf_open(FILENAME(mAliasedFileName.GetFullPath()),
-                         SFM_READ, &info);
 
+   wxString strFullPath = mAliasedFileName.GetFullPath();
+   SNDFILE *sf = sf_open(FILENAME(strFullPath), SFM_READ, &info);
+   if (!sf) {
+      // Allow fallback of looking for the file name, located in the data 
directory.
+      strFullPath = gProjDir + "\\" + mAliasedFileName.GetFullName(); 
+      sf = sf_open(FILENAME(strFullPath), SFM_READ, &info);
+   }
    if (!sf)
       return 0;
 
@@ -128,6 +135,8 @@
 
 BlockFile *PCMAliasBlockFile::BuildFromXML(wxString projDir, const char 
**attrs)
 {
+   gProjDir = projDir;
+
    wxFileName summaryFileName;
    wxFileName aliasFileName;
    int aliasStart=0, aliasLen=0, aliasChannel=0;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to