From ffc62c792c9a5196cb4ce7a353287dfe20db6524 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Fri, 9 Oct 2026 14:12:35 +0200 Subject: New upstream version 3.3.0~beta1+dfsg --- Audio/BWFFile.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Audio/BWFFile.cpp') diff --git a/Audio/BWFFile.cpp b/Audio/BWFFile.cpp index 5ddf9d8b..e7628ccf 100644 --- a/Audio/BWFFile.cpp +++ b/Audio/BWFFile.cpp @@ -1171,6 +1171,27 @@ bool BWFFile::flush () return success; } +bool BWFFile::finalize () +{ + if (!isOpen () || !(openMode () & WriteOnly)) { + setErrorString ("Cannot finalize a WAV file that is not open for writing"); + return false; + } + auto const samplesSize = size (); + bool const success = m_->update_header () && m_->file_.flush (); + if (!success) { + m_->error_ = FileError::WriteError; + setErrorString (m_->file_.error () == FileError::NoError + ? QStringLiteral ("Unable to finalize WAV file header") + : m_->file_.errorString ()); + } + m_->data_size_ = samplesSize; + m_->header_dirty_ = false; + QIODevice::close (); + m_->file_.close (); + return success; +} + int BWFFile::handle () const { int h {m_->file_.handle ()}; -- cgit v1.2.3