diff --git a/src/audio/AudioFileWAV.cpp b/src/audio/AudioFileWAV.cpp index ad4078f..d0629ab 100644 --- a/src/audio/AudioFileWAV.cpp +++ b/src/audio/AudioFileWAV.cpp @@ -65,9 +65,11 @@ std::string AudioFileWAV::getExtension() bool AudioFileWAV::writeToFile(AudioThreadInputPtr input) { if (!outputFileStream.is_open()) { + std::string ofName = getOutputFileName(); outputFileStream.open(ofName.c_str(), std::ios::binary); + currentFileSize = 0; writeHeaderToFileStream(input); } @@ -111,6 +113,7 @@ bool AudioFileWAV::closeFile() write_word(outputFileStream, file_length - 8, 4); outputFileStream.close(); + currentFileSize = 0; } return true; @@ -169,6 +172,16 @@ size_t AudioFileWAV::getMaxWritableNumberOfSamples(AudioThreadInputPtr input) { } +void AudioFileWAV::setOutputFileName(std::string filename) { + + if (filename != filenameBase) { + + currentSequenceNumber = 0; + } + + AudioFile::setOutputFileName(filename); +} + std::string AudioFileWAV::getOutputFileName() { std::string recPath = wxGetApp().getConfig()->getRecordingPath(); diff --git a/src/audio/AudioFileWAV.h b/src/audio/AudioFileWAV.h index dcd102d..1dc9672 100644 --- a/src/audio/AudioFileWAV.h +++ b/src/audio/AudioFileWAV.h @@ -13,6 +13,9 @@ public: AudioFileWAV(); ~AudioFileWAV(); + //override to manage name change with multi-part WAV. + virtual void setOutputFileName(std::string filename); + //override of the base method to generate multi-part //WAV to overcome the WAV format size limit. virtual std::string getOutputFileName();