Fix wrong multi-part WAV sequence management with time-limit files

This commit is contained in:
vsonnier 2018-01-14 15:30:40 +01:00
parent 3334538e64
commit 4c6d7ab4d7
2 changed files with 16 additions and 0 deletions

View File

@ -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();

View File

@ -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();