summaryrefslogtreecommitdiff
path: root/libs/ardour/sndfilesource.cc
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2013-08-09 17:56:14 +0100
committerJohn Emmas <johne53@tiscali.co.uk>2013-08-09 17:56:14 +0100
commit5f703f25a9c73912d2d28c29c52130e5f363c768 (patch)
treea3bdba0ab67a167e8601b626bed41ad002b3f834 /libs/ardour/sndfilesource.cc
parent64cc518e72c684f05a3dc48d97ec985fbe6186d1 (diff)
'libs/ardour' - If the platform is Windows, prevent lengthy caching by flushing imported files on completion of the import
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*/)
{