summaryrefslogtreecommitdiff
path: root/libs/ardour/sndfilesource.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/sndfilesource.cc')
-rw-r--r--libs/ardour/sndfilesource.cc24
1 files changed, 24 insertions, 0 deletions
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*/)
{