Mercurial > hg > svcore
comparison data/fileio/WavFileWriter.cpp @ 1599:ce185d4dd408 bqaudiostream
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 23 Jan 2019 14:43:43 +0000 |
parents | 70e172e6cc59 |
children |
comparison
equal
deleted
inserted
replaced
1598:d2555df635ec | 1599:ce185d4dd408 |
---|---|
37 int channels, | 37 int channels, |
38 FileWriteMode mode) : | 38 FileWriteMode mode) : |
39 m_path(path), | 39 m_path(path), |
40 m_sampleRate(sampleRate), | 40 m_sampleRate(sampleRate), |
41 m_channels(channels), | 41 m_channels(channels), |
42 m_temp(0), | 42 m_temp(nullptr), |
43 m_file(0) | 43 m_file(nullptr) |
44 { | 44 { |
45 SF_INFO fileInfo; | 45 SF_INFO fileInfo; |
46 | 46 |
47 int fileRate = int(round(m_sampleRate)); | 47 int fileRate = int(round(m_sampleRate)); |
48 if (m_sampleRate != sv_samplerate_t(fileRate)) { | 48 if (m_sampleRate != sv_samplerate_t(fileRate)) { |
71 << sf_strerror(m_file) << ")" << endl; | 71 << sf_strerror(m_file) << ")" << endl; |
72 m_error = QString("Failed to open audio file '%1' for writing") | 72 m_error = QString("Failed to open audio file '%1' for writing") |
73 .arg(writePath); | 73 .arg(writePath); |
74 if (m_temp) { | 74 if (m_temp) { |
75 delete m_temp; | 75 delete m_temp; |
76 m_temp = 0; | 76 m_temp = nullptr; |
77 } | 77 } |
78 } | 78 } |
79 } catch (FileOperationFailed &f) { | 79 } catch (FileOperationFailed &f) { |
80 m_error = f.what(); | 80 m_error = f.what(); |
81 m_temp = 0; | 81 m_temp = nullptr; |
82 m_file = 0; | 82 m_file = nullptr; |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 WavFileWriter::~WavFileWriter() | 86 WavFileWriter::~WavFileWriter() |
87 { | 87 { |
216 bool | 216 bool |
217 WavFileWriter::close() | 217 WavFileWriter::close() |
218 { | 218 { |
219 if (m_file) { | 219 if (m_file) { |
220 sf_close(m_file); | 220 sf_close(m_file); |
221 m_file = 0; | 221 m_file = nullptr; |
222 } | 222 } |
223 if (m_temp) { | 223 if (m_temp) { |
224 m_temp->moveToTarget(); | 224 m_temp->moveToTarget(); |
225 delete m_temp; | 225 delete m_temp; |
226 m_temp = 0; | 226 m_temp = nullptr; |
227 } | 227 } |
228 return true; | 228 return true; |
229 } | 229 } |
230 | 230 |