31 template <
typename InputSource,
typename OutputSampleType,
typename ContextType>
41 static_assert(std::is_integral<InputSampleType>::value,
"Input sample type must be integral.");
42 static_assert(std::is_integral<OutputSampleType>::value,
"Output sample type must be integral.");
43 static_assert(std::is_signed<InputSampleType>::value == std::is_signed<OutputSampleType>::value,
"Input sample type and output sample type must have same signedness.");
44 static_assert(
sizeof(
InputSampleType) >
sizeof(OutputSampleType),
"Output sample type must be smaller than the input sample type.");
47 static constexpr
size_t SampleRate = InputSource::SampleRate;
80 InputSampleType ditheredNoise = ContextType::Options::Ditherer::DitherFractionalValue(remainder, divisor);
82 return static_cast<OutputSampleType
>(quotient + ditheredNoise);
typename InputSource::SampleType InputSampleType
Definition: decreasebitdepthoperator.h:40
SampleType operator[](size_t index) const
Definition: decreasebitdepthoperator.h:62
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
SampleRange GetSampleRange() const
Definition: decreasebitdepthoperator.h:56
static constexpr size_t SampleRate
Definition: decreasebitdepthoperator.h:47
OutputSampleType SampleType
Definition: decreasebitdepthoperator.h:46
#define assert(expr)
Definition: assertion.h:47
Definition: dsputilities.h:60
InputSource mInputSource
Definition: decreasebitdepthoperator.h:86
InputSource & GetInputSource()
Definition: decreasebitdepthoperator.h:50
Definition: decreasebitdepthoperator.h:32
DecreaseBitDepthOperator(ContextType &context)
Definition: decreasebitdepthoperator.h:35