diff 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
line wrap: on
line diff
--- a/data/fileio/WavFileWriter.cpp	Tue Sep 04 13:19:20 2018 +0100
+++ b/data/fileio/WavFileWriter.cpp	Tue Sep 04 14:11:10 2018 +0100
@@ -63,10 +63,15 @@
         m_file = sf_open(writePath.toLocal8Bit(), SFM_WRITE, &fileInfo);
 #endif
         if (!m_file) {
-            SVCERR << "WavFileWriter: Failed to open file ("
-                 << sf_strerror(m_file) << ")" << endl;
+            SVCERR << "WavFileWriter: Failed to create float-WAV file of "
+                   << m_channels << " channels at rate " << fileRate << " ("
+                   << sf_strerror(m_file) << ")" << endl;
             m_error = QString("Failed to open audio file '%1' for writing")
                 .arg(writePath);
+            if (m_temp) {
+                delete m_temp;
+                m_temp = 0;
+            }
         }
     } catch (FileOperationFailed &f) {
         m_error = f.what();