mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibAudio: WAV reading should stop when we run out of file. :^)
This commit is contained in:
parent
e6eba24405
commit
68c20e50da
Notes:
sideshowbarker
2024-07-19 13:01:26 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/68c20e50da9
1 changed files with 5 additions and 2 deletions
|
@ -18,11 +18,14 @@ AWavLoader::AWavLoader(const StringView& path)
|
|||
|
||||
RefPtr<ABuffer> AWavLoader::get_more_samples()
|
||||
{
|
||||
#ifdef AWAVLOADER_DEBUG
|
||||
dbgprintf("Read WAV of format PCM with num_channels %u sample rate %u, bits per sample %u\n", m_num_channels, m_sample_rate, m_bits_per_sample);
|
||||
#endif
|
||||
|
||||
auto raw_samples = m_file.read(128 * KB);
|
||||
auto buffer = ABuffer::from_pcm_data(raw_samples, m_num_channels, m_bits_per_sample, m_sample_rate);
|
||||
return buffer;
|
||||
if (raw_samples.is_empty())
|
||||
return nullptr;
|
||||
return ABuffer::from_pcm_data(raw_samples, m_num_channels, m_bits_per_sample, m_sample_rate);
|
||||
}
|
||||
|
||||
bool AWavLoader::parse_header()
|
||||
|
|
Loading…
Add table
Reference in a new issue