Mercurial > hg > svcore
comparison data/fileio/WavFileWriter.cpp @ 1508:b837ccdd4946 import-audio-data
Catch failure to create model, e.g. because 0 channels for wave-file model
author | Chris Cannam |
---|---|
date | Tue, 04 Sep 2018 14:11:10 +0100 |
parents | 48e9f538e6e9 |
children | 954d0cf29ca7 |
comparison
equal
deleted
inserted
replaced
1507:fe579dc6a713 | 1508:b837ccdd4946 |
---|---|
61 m_file = sf_wchar_open((LPCWSTR)writePath.utf16(), SFM_WRITE, &fileInfo); | 61 m_file = sf_wchar_open((LPCWSTR)writePath.utf16(), SFM_WRITE, &fileInfo); |
62 #else | 62 #else |
63 m_file = sf_open(writePath.toLocal8Bit(), SFM_WRITE, &fileInfo); | 63 m_file = sf_open(writePath.toLocal8Bit(), SFM_WRITE, &fileInfo); |
64 #endif | 64 #endif |
65 if (!m_file) { | 65 if (!m_file) { |
66 SVCERR << "WavFileWriter: Failed to open file (" | 66 SVCERR << "WavFileWriter: Failed to create float-WAV file of " |
67 << sf_strerror(m_file) << ")" << endl; | 67 << m_channels << " channels at rate " << fileRate << " (" |
68 << sf_strerror(m_file) << ")" << endl; | |
68 m_error = QString("Failed to open audio file '%1' for writing") | 69 m_error = QString("Failed to open audio file '%1' for writing") |
69 .arg(writePath); | 70 .arg(writePath); |
71 if (m_temp) { | |
72 delete m_temp; | |
73 m_temp = 0; | |
74 } | |
70 } | 75 } |
71 } catch (FileOperationFailed &f) { | 76 } catch (FileOperationFailed &f) { |
72 m_error = f.what(); | 77 m_error = f.what(); |
73 m_temp = 0; | 78 m_temp = 0; |
74 m_file = 0; | 79 m_file = 0; |