1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

Libraries: Change enums to enum classes in LibAudio

This commit is contained in:
Lenny Maiorani 2022-03-17 14:38:24 -06:00 committed by Andreas Kling
parent be360db223
commit d3893a73fb
5 changed files with 22 additions and 22 deletions

View file

@ -169,7 +169,7 @@ MaybeLoaderError FlacLoaderPlugin::reset()
MaybeLoaderError FlacLoaderPlugin::seek(const int position)
{
if (m_stream->seek(position, Core::Stream::SeekMode::SetPosition).is_error())
return LoaderError { LoaderError::IO, m_loaded_samples, String::formatted("Invalid seek position {}", position) };
return LoaderError { LoaderError::Category::IO, m_loaded_samples, String::formatted("Invalid seek position {}", position) };
return {};
}
@ -232,7 +232,7 @@ MaybeLoaderError FlacLoaderPlugin::next_frame(Span<Sample> target_vector)
u32 frame_sample_rate = TRY(convert_sample_rate_code(LOADER_TRY(bit_stream->read_bits<u8>(4))));
u8 channel_type_num = LOADER_TRY(bit_stream->read_bits<u8>(4));
FLAC_VERIFY(channel_type_num < 0b1011, LoaderError::Format, "Channel assignment");
FLAC_VERIFY(channel_type_num < 0b1011, LoaderError::Category::Format, "Channel assignment");
FlacFrameChannelType channel_type = (FlacFrameChannelType)channel_type_num;
PcmSampleFormat bit_depth = TRY(convert_bit_depth_code(LOADER_TRY(bit_stream->read_bits<u8>(3))));
@ -440,8 +440,8 @@ ErrorOr<PcmSampleFormat, LoaderError> FlacLoaderPlugin::convert_bit_depth_code(u
u8 frame_channel_type_to_channel_count(FlacFrameChannelType channel_type)
{
if (channel_type <= 7)
return channel_type + 1;
if (channel_type <= FlacFrameChannelType::Surround7p1)
return to_underlying(channel_type) + 1;
return 2;
}
@ -451,13 +451,13 @@ ErrorOr<FlacSubframeHeader, LoaderError> FlacLoaderPlugin::next_subframe_header(
// For inter-channel correlation, the side channel needs an extra bit for its samples
switch (m_current_frame->channels) {
case LeftSideStereo:
case MidSideStereo:
case FlacFrameChannelType::LeftSideStereo:
case FlacFrameChannelType::MidSideStereo:
if (channel_index == 1) {
++bits_per_sample;
}
break;
case RightSideStereo:
case FlacFrameChannelType::RightSideStereo:
if (channel_index == 0) {
++bits_per_sample;
}
@ -675,7 +675,7 @@ ErrorOr<Vector<i32>, LoaderError> FlacLoaderPlugin::decode_fixed_lpc(FlacSubfram
// Decode the residual, the "error" between the function approximation and the actual audio data
MaybeLoaderError FlacLoaderPlugin::decode_residual(Vector<i32>& decoded, FlacSubframeHeader& subframe, BigEndianInputBitStream& bit_input)
{
u8 residual_mode = LOADER_TRY(bit_input.read_bits<u8>(2));
auto residual_mode = static_cast<FlacResidualMode>(LOADER_TRY(bit_input.read_bits<u8>(2)));
u8 partition_order = LOADER_TRY(bit_input.read_bits<u8>(4));
size_t partitions = 1 << partition_order;