summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibAudio/FlacLoader.cpp11
-rw-r--r--Userland/Libraries/LibAudio/FlacLoader.h2
2 files changed, 5 insertions, 8 deletions
diff --git a/Userland/Libraries/LibAudio/FlacLoader.cpp b/Userland/Libraries/LibAudio/FlacLoader.cpp
index a2baf1aaa7..019633c446 100644
--- a/Userland/Libraries/LibAudio/FlacLoader.cpp
+++ b/Userland/Libraries/LibAudio/FlacLoader.cpp
@@ -41,7 +41,7 @@ FlacLoaderPlugin::FlacLoaderPlugin(const StringView& path)
if (!m_valid)
return;
- m_resampler = make<ResampleHelper<double>>(m_sample_rate, 44100);
+ m_resampler = make<ResampleHelper<i32>>(m_sample_rate, 44100);
}
FlacLoaderPlugin::FlacLoaderPlugin(const ByteBuffer& buffer)
@@ -59,7 +59,7 @@ FlacLoaderPlugin::FlacLoaderPlugin(const ByteBuffer& buffer)
if (!m_valid)
return;
- m_resampler = make<ResampleHelper<double>>(m_sample_rate, 44100);
+ m_resampler = make<ResampleHelper<i32>>(m_sample_rate, 44100);
}
bool FlacLoaderPlugin::sniff()
@@ -244,10 +244,6 @@ RefPtr<Buffer> FlacLoaderPlugin::get_more_samples(size_t max_bytes_to_read_from_
m_error_string = String::formatted("Frame parsing error: {}", m_error_string);
return nullptr;
}
- // HACK: Test the start of the next subframe
- // auto input = m_stream->bit_stream();
- // u64 next = input.read_bits_big_endian(64);
- // dbgln("After frame end: {}", next);
}
samples.append(m_current_frame_data.take_first());
if (m_current_frame_data.size() == 0) {
@@ -352,7 +348,8 @@ void FlacLoaderPlugin::next_frame()
FlacSubframeHeader new_subframe = next_subframe_header(bit_stream, i);
CHECK_ERROR_STRING;
Vector<i32> subframe_samples = parse_subframe(new_subframe, bit_stream);
- // HACK: Test the start of the next subframe
+ m_resampler->reset();
+ subframe_samples = m_resampler->resample(subframe_samples);
CHECK_ERROR_STRING;
current_subframes.append(move(subframe_samples));
}
diff --git a/Userland/Libraries/LibAudio/FlacLoader.h b/Userland/Libraries/LibAudio/FlacLoader.h
index 1542ae3911..b593804385 100644
--- a/Userland/Libraries/LibAudio/FlacLoader.h
+++ b/Userland/Libraries/LibAudio/FlacLoader.h
@@ -124,7 +124,7 @@ private:
bool m_valid { false };
RefPtr<Core::File> m_file;
String m_error_string;
- OwnPtr<ResampleHelper<double>> m_resampler;
+ OwnPtr<ResampleHelper<i32>> m_resampler;
// Data obtained directly from the FLAC metadata: many values have specific bit counts
u32 m_sample_rate { 0 }; // 20 bit