diff options
| author | Dave Hibberd <hibby@debian.org> | 2026-10-20 22:35:06 +0100 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2026-10-20 22:35:06 +0100 |
| commit | 82ebb1ed1af30cee4dfbb1c628431d32885a00e0 (patch) | |
| tree | 1a1f782d3e576b758be0bc61171574a7cd8f2376 /Audio/BWFFile.cpp | |
| parent | 061658210acb6425517733ea012dda803a7f72a1 (diff) | |
| parent | 61d684922b0f1c8455cc60eb3d123df058c9e1f5 (diff) | |
Merge tag 'debian/3.3.0_beta2+dfsg-1' into hibbian/trixie-backports
tagging wsjtx 3.3.0~beta2+dfsg-1
Diffstat (limited to 'Audio/BWFFile.cpp')
| -rw-r--r-- | Audio/BWFFile.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
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 ()}; |
