mpd/src/pcm/Silence.cxx

19 lines
434 B
C++
Raw Normal View History

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