mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:57:44 +00:00
LibAudio: Fix parsing of WAV files from memory
The WavLoaderPlugin now loads the file header correctly when reading from a ByteBuffer.
This commit is contained in:
parent
228fa1c51d
commit
d0812e9019
1 changed files with 15 additions and 6 deletions
|
@ -120,9 +120,12 @@ bool WavLoaderPlugin::parse_header()
|
||||||
u8 value;
|
u8 value;
|
||||||
if (m_file) {
|
if (m_file) {
|
||||||
*file_stream >> value;
|
*file_stream >> value;
|
||||||
if (file_stream->handle_read_failure()) {
|
if (file_stream->handle_read_failure())
|
||||||
|
ok = false;
|
||||||
|
} else {
|
||||||
|
*m_stream >> value;
|
||||||
|
if (m_stream->has_any_error())
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
@ -131,9 +134,12 @@ bool WavLoaderPlugin::parse_header()
|
||||||
u16 value;
|
u16 value;
|
||||||
if (m_file) {
|
if (m_file) {
|
||||||
*file_stream >> value;
|
*file_stream >> value;
|
||||||
if (file_stream->handle_read_failure()) {
|
if (file_stream->handle_read_failure())
|
||||||
|
ok = false;
|
||||||
|
} else {
|
||||||
|
*m_stream >> value;
|
||||||
|
if (m_stream->has_any_error())
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
@ -142,9 +148,12 @@ bool WavLoaderPlugin::parse_header()
|
||||||
u32 value;
|
u32 value;
|
||||||
if (m_file) {
|
if (m_file) {
|
||||||
*file_stream >> value;
|
*file_stream >> value;
|
||||||
if (file_stream->handle_read_failure()) {
|
if (file_stream->handle_read_failure())
|
||||||
|
ok = false;
|
||||||
|
} else {
|
||||||
|
*m_stream >> value;
|
||||||
|
if (m_stream->has_any_error())
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue