diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2022-04-27 12:41:37 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-04-29 18:05:42 +0200 |
commit | ae0ca355418a1f27d916d4de69962d802e9c1414 (patch) | |
tree | 01c39bdfe15e081e63d85367d2075567f601526c /Userland/Libraries | |
parent | 50cf4e6e64d1e0eb8f7a40b30d560e75ed608e54 (diff) | |
download | serenity-ae0ca355418a1f27d916d4de69962d802e9c1414.zip |
LibAudio: Add a formatter for `Audio::Sample`
Useful for debugging.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibAudio/Sample.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibAudio/Sample.h b/Userland/Libraries/LibAudio/Sample.h index b3b5e57e2f..209e0c840a 100644 --- a/Userland/Libraries/LibAudio/Sample.h +++ b/Userland/Libraries/LibAudio/Sample.h @@ -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); + } +}; + +} |