1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17:35 +00:00

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.
This commit is contained in:
Andreas Kling 2019-07-28 21:29:09 +02:00
parent be31e2232c
commit b44d3faa1c

View file

@ -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));
}