mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +00:00
LibAudio: WAV reading should stop when we run out of file. :^)
This commit is contained in:
parent
e6eba24405
commit
68c20e50da
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
Add a link
Reference in a new issue