Skip to content

Commit

Permalink
LibAudio: WAV: Don't emit the very last sample in each decoded batch.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
awesomekling committed Jul 28, 2019
1 parent be31e22 commit b44d3fa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Libraries/LibAudio/AWavLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

0 comments on commit b44d3fa

Please sign in to comment.