X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsndfilesource.cc;h=1c3144f16421177f140b7da1753ec7bfaa8cf92f;hb=2b9421fd391efcddde0be3397cb66e19b744a155;hp=b5d821ffda62d8d7f47ed8d2f138edc7a1ab7dab;hpb=7169c77cfc5a45ec29dcb58a251feccba5ac6b62;p=ardour.git diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index b5d821ffda..1c3144f164 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -550,6 +550,30 @@ SndFileSource::flush_header () return r; } +void +SndFileSource::flush () +{ + if (!_open) { + warning << string_compose (_("attempt to flush an un-opened audio file source (%1)"), _path) << endmsg; + return; + } + + if (!writable()) { + warning << string_compose (_("attempt to flush a non-writable audio file source (%1)"), _path) << endmsg; + return; + } + + SNDFILE* sf = _descriptor->allocate (); + if (sf == 0) { + error << string_compose (_("could not allocate file %1 to flush contents"), _path) << endmsg; + return; + } + + // Hopefully everything OK + sf_write_sync (sf); + _descriptor->release (); +} + int SndFileSource::setup_broadcast_info (framepos_t /*when*/, struct tm& now, time_t /*tnow*/) {