diff data/model/WritableWaveFileModel.cpp @ 684:bcca512445f3

Provide option for WavFileWriter to write directly to target file, rather than always using a temporary; make use of it in WritableWaveFileModel so we can read from target file without having to close it first
author Chris Cannam
date Wed, 11 May 2011 11:04:35 +0100
parents e43368ec5ff0
children 573d45e9487b
line wrap: on
line diff
--- a/data/model/WritableWaveFileModel.cpp	Wed May 11 11:04:02 2011 +0100
+++ b/data/model/WritableWaveFileModel.cpp	Wed May 11 11:04:35 2011 +0100
@@ -52,7 +52,10 @@
         }
     }
 
-    m_writer = new WavFileWriter(path, sampleRate, channels);
+    // Write directly to the target file, so that we can do
+    // incremental writes and concurrent reads
+    m_writer = new WavFileWriter(path, sampleRate, channels,
+                                 WavFileWriter::WriteToTarget);
     if (!m_writer->isOK()) {
         std::cerr << "WritableWaveFileModel: Error in creating WAV file writer: " << m_writer->getError().toStdString() << std::endl;
         delete m_writer;