Fix WAV exporting on Windows
This commit is contained in:
@@ -56,6 +56,10 @@ protected:
|
||||
return m_outputFile.isOpen();
|
||||
}
|
||||
|
||||
inline int outputFileHandle() const
|
||||
{
|
||||
return m_outputFile.handle();
|
||||
}
|
||||
|
||||
private:
|
||||
QFile m_outputFile;
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#include "endian_handling.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
AudioFileWave::AudioFileWave( OutputSettings const & outputSettings,
|
||||
const ch_cnt_t channels, bool & successful,
|
||||
@@ -72,13 +75,15 @@ bool AudioFileWave::startEncoding()
|
||||
m_si.format |= SF_FORMAT_PCM_16;
|
||||
break;
|
||||
}
|
||||
m_sf = sf_open(
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
outputFile().toLocal8Bit().constData(),
|
||||
#else
|
||||
outputFile().toUtf8().constData(),
|
||||
#endif
|
||||
SFM_WRITE, &m_si );
|
||||
|
||||
// Use file handle to handle unicode file name on Windows
|
||||
m_sf = sf_open_fd( outputFileHandle(), SFM_WRITE, &m_si, false );
|
||||
|
||||
if (!m_sf)
|
||||
{
|
||||
qWarning("Error: AudioFileWave::startEncoding: %s", sf_strerror(nullptr));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent fold overs when encountering clipped data
|
||||
sf_command(m_sf, SFC_SET_CLIPPING, NULL, SF_TRUE);
|
||||
|
||||
Reference in New Issue
Block a user