Show an example filename in the main export dialog
[ardour.git] / libs / ardour / sndfilesource.cc
index 47571cead6bc9286e69b5238b9674e87df98e952..3759057dc55581e491e250fddf6a63c4ec1ed9f9 100644 (file)
@@ -144,8 +144,14 @@ SndFileSource::SndFileSource (Session& s, const string& path, const string& orig
        _info.samplerate = rate;
        _info.format = fmt;
 
-        /* do not open the file here - do that in write_unlocked() as needed
-         */
+       if (_flags & Destructive) {
+               if (open()) {
+                       throw failed_constructor();
+               }
+       } else {
+               /* normal mode: do not open the file here - do that in write_unlocked() as needed
+                */
+       }
 }
 
 void
@@ -327,7 +333,6 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
 
                if (_info.channels == 1) {
                        framecnt_t ret = sf_read_float (sf, dst, file_cnt);
-                       _read_data_count = ret * sizeof(float);
                        if (ret != file_cnt) {
                                char errbuf[256];
                                sf_error_str (0, errbuf, sizeof (errbuf) - 1);
@@ -353,8 +358,6 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
                ptr += _info.channels;
        }
 
-       _read_data_count = cnt * sizeof(float);
-
        _descriptor->release ();
        return nread;
 }
@@ -401,8 +404,6 @@ SndFileSource::nondestructive_write_unlocked (Sample *data, framecnt_t cnt)
                compute_and_write_peaks (data, frame_pos, cnt, false, true);
        }
 
-       _write_data_count = cnt;
-
        return cnt;
 }