Skip to content
Permalink
Browse files
Fix WAV exporting on Windows
  • Loading branch information
PhysSong committed Jul 5, 2018
1 parent ddcae47 commit 1af0f08
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
@@ -56,6 +56,10 @@ class AudioFileDevice : public AudioDevice
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);

0 comments on commit 1af0f08

Please sign in to comment.