mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibAudio: Add integer sample format-specific support
This allows us to better handle specifically integer sample formats.
This commit is contained in:
parent
e45a666419
commit
7bb128e1ed
Notes:
sideshowbarker
2024-07-17 07:43:44 +09:00
Author: https://github.com/kleinesfilmroellchen
Commit: 7bb128e1ed
Pull-request: https://github.com/SerenityOS/serenity/pull/19790
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/LucasChollet
Reviewed-by: https://github.com/alimpfard
2 changed files with 23 additions and 0 deletions
|
@ -27,6 +27,27 @@ u16 pcm_bits_per_sample(PcmSampleFormat format)
|
|||
}
|
||||
}
|
||||
|
||||
bool is_integer_format(PcmSampleFormat format)
|
||||
{
|
||||
return format == PcmSampleFormat::Uint8 || format == PcmSampleFormat::Int16 || format == PcmSampleFormat::Int24 || format == PcmSampleFormat::Int32;
|
||||
}
|
||||
|
||||
Optional<PcmSampleFormat> integer_sample_format_for(u16 bits_per_sample)
|
||||
{
|
||||
switch (bits_per_sample) {
|
||||
case 8:
|
||||
return PcmSampleFormat::Uint8;
|
||||
case 16:
|
||||
return PcmSampleFormat::Int16;
|
||||
case 24:
|
||||
return PcmSampleFormat::Int24;
|
||||
case 32:
|
||||
return PcmSampleFormat::Int32;
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
DeprecatedString sample_format_name(PcmSampleFormat format)
|
||||
{
|
||||
bool is_float = format == PcmSampleFormat::Float32 || format == PcmSampleFormat::Float64;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue