MCPcopy Create free account
hub / github.com/SFML/SFML / close

Method close

src/SFML/Audio/SoundFileWriterWav.cpp:312–328  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

310
311////////////////////////////////////////////////////////////
312void SoundFileWriterWav::close()
313{
314 // If the file is open, finalize the header and close it
315 if (m_file.is_open())
316 {
317 m_file.flush();
318
319 // Update the main chunk size and data sub-chunk size
320 const std::uint32_t fileSize = static_cast<std::uint32_t>(m_file.tellp());
321 m_file.seekp(4);
322 encode(m_file, fileSize - 8); // 8 bytes RIFF header
323 m_file.seekp(40);
324 encode(m_file, fileSize - 44); // 44 bytes RIFF + WAVE headers
325
326 m_file.close();
327 }
328}
329
330} // namespace sf::priv

Callers

nothing calls this directly

Calls 1

encodeFunction · 0.70

Tested by

no test coverage detected