LibAudio: Add a formatter for Audio::Sample

Useful for debugging.
This commit is contained in:
Jelle Raaijmakers 2022-04-27 12:41:37 +02:00 committed by Andreas Kling
parent 50cf4e6e64
commit ae0ca35541
Notes: sideshowbarker 2024-07-17 11:28:23 +09:00

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/Format.h>
#include <AK/Math.h>
namespace Audio {
@ -146,3 +147,15 @@ struct Sample {
};
}
namespace AK {
template<>
struct Formatter<Audio::Sample> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, Audio::Sample const& value)
{
return Formatter<FormatString>::format(builder, "[{}, {}]", value.left, value.right);
}
};
}