Mercurial > hg > svcore
comparison data/fileio/MIDIFileWriter.cpp @ 1599:ce185d4dd408 bqaudiostream
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 23 Jan 2019 14:43:43 +0000 |
parents | 70e172e6cc59 |
children | 24dc8cb42755 |
comparison
equal
deleted
inserted
replaced
1598:d2555df635ec | 1599:ce185d4dd408 |
---|---|
44 sv_samplerate_t sampleRate, float tempo) : | 44 sv_samplerate_t sampleRate, float tempo) : |
45 m_path(path), | 45 m_path(path), |
46 m_exportable(exportable), | 46 m_exportable(exportable), |
47 m_sampleRate(sampleRate), | 47 m_sampleRate(sampleRate), |
48 m_tempo(tempo), | 48 m_tempo(tempo), |
49 m_midiFile(0) | 49 m_midiFile(nullptr) |
50 { | 50 { |
51 if (!convert()) { | 51 if (!convert()) { |
52 m_error = "Conversion from model to internal MIDI format failed"; | 52 m_error = "Conversion from model to internal MIDI format failed"; |
53 } | 53 } |
54 } | 54 } |
286 new ofstream(m_path.toLocal8Bit().data(), ios::out | ios::binary); | 286 new ofstream(m_path.toLocal8Bit().data(), ios::out | ios::binary); |
287 | 287 |
288 if (!(*m_midiFile)) { | 288 if (!(*m_midiFile)) { |
289 m_error = "Can't open file for writing."; | 289 m_error = "Can't open file for writing."; |
290 delete m_midiFile; | 290 delete m_midiFile; |
291 m_midiFile = 0; | 291 m_midiFile = nullptr; |
292 return false; | 292 return false; |
293 } | 293 } |
294 | 294 |
295 if (!writeHeader()) { | 295 if (!writeHeader()) { |
296 retOK = false; | 296 retOK = false; |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 m_midiFile->close(); | 305 m_midiFile->close(); |
306 delete m_midiFile; | 306 delete m_midiFile; |
307 m_midiFile = 0; | 307 m_midiFile = nullptr; |
308 | 308 |
309 if (!retOK) { | 309 if (!retOK) { |
310 m_error = "MIDI file write failed"; | 310 m_error = "MIDI file write failed"; |
311 } | 311 } |
312 | 312 |