2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2016-07-05 17:52:24 +02:00
|
|
|
|
|
|
|
#include "Silence.hxx"
|
2017-01-19 11:57:01 +01:00
|
|
|
#include "Traits.hxx"
|
2017-01-17 11:02:11 +01:00
|
|
|
#include "SampleFormat.hxx"
|
2016-07-05 17:52:24 +02:00
|
|
|
|
2022-05-20 10:09:50 +02:00
|
|
|
#include <algorithm>
|
2016-07-05 17:52:24 +02:00
|
|
|
|
|
|
|
void
|
2022-05-20 10:09:50 +02:00
|
|
|
PcmSilence(std::span<std::byte> dest, SampleFormat format) noexcept
|
2016-07-05 17:52:24 +02:00
|
|
|
{
|
2022-05-20 10:09:50 +02:00
|
|
|
std::byte pattern{0};
|
2016-07-05 17:52:24 +02:00
|
|
|
if (format == SampleFormat::DSD)
|
2022-05-20 10:09:50 +02:00
|
|
|
pattern = std::byte{SampleTraits<SampleFormat::DSD>::SILENCE};
|
2016-07-05 17:52:24 +02:00
|
|
|
|
2022-05-20 10:09:50 +02:00
|
|
|
std::fill(dest.begin(), dest.end(), pattern);
|
2016-07-05 17:52:24 +02:00
|
|
|
}
|