mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:57:45 +00:00
LibAudio: Speed up WavWriter by buffering output data
We were calling write syscall twice for every sample, which effectively hurt the writer's performance. With this change exporting a melody in the Piano app now takes less than a second, which previously took about 20 seconds on my machine. Additionally, I've removed an unused `WavWriter::file()` getter.
This commit is contained in:
parent
fbf87299a2
commit
963a6b3d3d
2 changed files with 3 additions and 3 deletions
|
@ -33,7 +33,8 @@ WavWriter::~WavWriter()
|
|||
|
||||
ErrorOr<void> WavWriter::set_file(StringView path)
|
||||
{
|
||||
m_file = TRY(Core::File::open(path, Core::File::OpenMode::Write));
|
||||
auto file = TRY(Core::File::open(path, Core::File::OpenMode::Write));
|
||||
m_file = TRY(Core::OutputBufferedFile::create(move(file)));
|
||||
TRY(m_file->seek(44, SeekMode::SetPosition));
|
||||
m_finalized = false;
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue