1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

LibAudio: Rename Audio::Frame -> Audio::Sample

"Frame" is an MPEG term, which is not only unintuitive but also
overloaded with different meaning by other codecs (e.g. FLAC).
Therefore, use the standard term Sample for the central audio structure.

The class is also extracted to its own file, because it's becoming quite
large. Bundling these two changes means not distributing similar
modifications (changing names and paths) across commits.

Co-authored-by: kleines Filmröllchen <malu.bertsch@gmail.com>
This commit is contained in:
David Isaksson 2021-09-23 21:16:03 +02:00 committed by Brian Gianforcaro
parent fa4255bcf1
commit b6d075bb01
11 changed files with 179 additions and 165 deletions

View file

@ -12,10 +12,10 @@
// Converts Piano-internal data to an Audio::Buffer that AudioServer receives
static NonnullRefPtr<Audio::Buffer> music_samples_to_buffer(Array<Sample, sample_count> samples)
{
Vector<Audio::Frame, sample_count> frames;
Vector<Audio::Sample, sample_count> frames;
frames.ensure_capacity(sample_count);
for (auto sample : samples) {
Audio::Frame frame = { sample.left / (double)NumericLimits<i16>::max(), sample.right / (double)NumericLimits<i16>::max() };
Audio::Sample frame = { sample.left / (double)NumericLimits<i16>::max(), sample.right / (double)NumericLimits<i16>::max() };
frames.unchecked_append(frame);
}
return Audio::Buffer::create_with_samples(frames);