summaryrefslogtreecommitdiff
path: root/Audio/BWFFile.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
commitffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch)
tree1269efa852935b183daae4bb33a58d1b4d2ffb53 /Audio/BWFFile.cpp
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'Audio/BWFFile.cpp')
-rw-r--r--Audio/BWFFile.cpp21
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 ()};