summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-07-28 21:29:09 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-28 21:34:47 +0200
commitb44d3faa1c926204643d41eb1dac31a3ec301029 (patch)
tree3e1df1cb4b6ca42b831cd3ba137c71a1c8f4489e /Libraries
parentbe31e2232cb2a62126ccef4be428eab7703eb617 (diff)
downloadserenity-b44d3faa1c926204643d41eb1dac31a3ec301029.zip
LibAudio: WAV: Don't emit the very last sample in each decoded batch.
This is a total hack, because I haven't really looked into why these are happening. Somehow we're producing one extra sample and it's glitching up the sound stream ever so slightly.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibAudio/AWavLoader.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Libraries/LibAudio/AWavLoader.cpp b/Libraries/LibAudio/AWavLoader.cpp
index 2b28f8c219..93e6a2bd17 100644
--- a/Libraries/LibAudio/AWavLoader.cpp
+++ b/Libraries/LibAudio/AWavLoader.cpp
@@ -257,5 +257,10 @@ RefPtr<ABuffer> ABuffer::from_pcm_data(ByteBuffer& data, int num_channels, int b
// don't belong.
ASSERT(!stream.handle_read_failure());
+ // HACK: This is a total hack to remove an unnecessary sample at the end of the buffer.
+ // FIXME: Don't generate the extra sample... :^)
+ for (int i = 0; i < 1; ++i)
+ fdata.take_last();
+
return ABuffer::create_with_samples(move(fdata));
}