pcm/Normalizer: use std::span
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "pcm/AudioParser.hxx"
|
||||
#include "pcm/AudioFormat.hxx"
|
||||
#include "util/PrintException.hxx"
|
||||
#include "util/SpanCast.hxx"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -22,9 +23,6 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
try {
|
||||
static char buffer[4096];
|
||||
ssize_t nbytes;
|
||||
|
||||
if (argc > 2) {
|
||||
fprintf(stderr, "Usage: run_normalize [FORMAT] <IN >OUT\n");
|
||||
return 1;
|
||||
@@ -36,9 +34,10 @@ try {
|
||||
|
||||
PcmNormalizer normalizer;
|
||||
|
||||
static std::byte buffer[4096];
|
||||
ssize_t nbytes;
|
||||
while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) {
|
||||
normalizer.ProcessS16((int16_t *)buffer, nbytes / 2);
|
||||
|
||||
normalizer.ProcessS16(FromBytesStrict<int16_t>(std::span{buffer}.first(nbytes)));
|
||||
[[maybe_unused]] ssize_t ignored = write(1, buffer, nbytes);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user