mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +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
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