Mercurial > hg > svcore
comparison 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 |
comparison
equal
deleted
inserted
replaced
683:f84f147572b9 | 684:bcca512445f3 |
---|---|
50 std::cerr << "WritableWaveFileModel: Failed to create temporary directory" << std::endl; | 50 std::cerr << "WritableWaveFileModel: Failed to create temporary directory" << std::endl; |
51 return; | 51 return; |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 m_writer = new WavFileWriter(path, sampleRate, channels); | 55 // Write directly to the target file, so that we can do |
56 // incremental writes and concurrent reads | |
57 m_writer = new WavFileWriter(path, sampleRate, channels, | |
58 WavFileWriter::WriteToTarget); | |
56 if (!m_writer->isOK()) { | 59 if (!m_writer->isOK()) { |
57 std::cerr << "WritableWaveFileModel: Error in creating WAV file writer: " << m_writer->getError().toStdString() << std::endl; | 60 std::cerr << "WritableWaveFileModel: Error in creating WAV file writer: " << m_writer->getError().toStdString() << std::endl; |
58 delete m_writer; | 61 delete m_writer; |
59 m_writer = 0; | 62 m_writer = 0; |
60 return; | 63 return; |