fix LTC slave latency compensation typo
[ardour.git] / libs / ardour / sndfilesource.cc
index 1732a6f1a692ebf9120844c61e667c8bb987af47..ca2544054cc9b8e12d59ba59c220830b64d26729 100644 (file)
@@ -35,8 +35,6 @@
 #include "ardour/sndfilesource.h"
 #include "ardour/sndfile_helpers.h"
 #include "ardour/utils.h"
-#include "ardour/version.h"
-#include "ardour/rc_configuration.h"
 #include "ardour/session.h"
 
 #include "i18n.h"
@@ -339,7 +337,7 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
                        if (ret != file_cnt) {
                                char errbuf[256];
                                sf_error_str (0, errbuf, sizeof (errbuf) - 1);
-                               error << string_compose(_("SndFileSource: @ %1 could not read %2 within %3 (%4) (len = %5)"), start, file_cnt, _name.val().substr (1), errbuf, _length) << endl;
+                               error << string_compose(_("SndFileSource: @ %1 could not read %2 within %3 (%4) (len = %5, ret was %6)"), start, file_cnt, _name.val().substr (1), errbuf, _length, ret) << endl;
                        }
                        _descriptor->release ();
                        return ret;
@@ -393,15 +391,13 @@ SndFileSource::nondestructive_write_unlocked (Sample *data, framecnt_t cnt)
                return 0;
        }
 
-       framecnt_t oldlen;
        int32_t frame_pos = _length;
 
        if (write_float (data, frame_pos, cnt) != cnt) {
                return 0;
        }
 
-       oldlen = _length;
-       update_length (oldlen, cnt);
+       update_length (_length + cnt);
 
        if (_build_peakfiles) {
                compute_and_write_peaks (data, frame_pos, cnt, false, true);
@@ -488,7 +484,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, framecnt_t cnt)
                }
        }
 
-       update_length (file_pos, cnt);
+       update_length (file_pos + cnt);
 
        if (_build_peakfiles) {
                compute_and_write_peaks (data, file_pos, cnt, false, true);
@@ -587,7 +583,7 @@ SndFileSource::set_header_timeline_position ()
        _broadcast_info->set_time_reference (_timeline_position);
 
        SNDFILE* sf = _descriptor->allocate ();
-
+       
        if (sf == 0 || !_broadcast_info->write_to_file (sf)) {
                error << string_compose (_("cannot set broadcast info for audio file %1 (%2); dropping broadcast info for this file"),
                                           _path, _broadcast_info->get_error())
@@ -862,7 +858,7 @@ SndFileSource::get_soundfile_info (const string& path, SoundFileInfo& info, stri
 
        sf_info.format = 0; // libsndfile says to clear this before sf_open().
 
-       if ((sf = sf_open ((char*) path.c_str(), SFM_READ, &sf_info)) == 0) {
+       if ((sf = sf_open (const_cast<char*>(path.c_str()), SFM_READ, &sf_info)) == 0) {
                char errbuf[256];
                error_msg = sf_error_str (0, errbuf, sizeof (errbuf) - 1);
                return false;