1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Opt-in conversion helpers.
//!
//! The direct USB path never converts anything. This module is for a host that has audio in one
//! format and a DAC that runs another (a rate the DAC refuses under
//! [`RatePolicy::NearestSupported`](crate::RatePolicy), a depth it lacks): it plans the smallest
//! chain of steps that bridges them, says honestly what that costs, and runs it.
//!
//! - [`ConversionPlan::between`] plans a conversion from a request to a negotiated format and
//! classifies it as [`ConversionKind::None`], [`ConversionKind::BitExact`] (widening and
//! repacking: every sample value is unchanged), [`ConversionKind::Lossless`] (mono duplicated to
//! stereo, integers carried in a float) or [`ConversionKind::Lossy`] (fewer bits, floats to
//! integers, a new sample rate). Only the first two keep a bit-perfect stream bit-perfect.
//! - [`Converter`] runs a plan on chunks of bytes, without allocating after it is built.
//! - [`Resampler`] is the polyphase windowed-sinc converter underneath, for any rational ratio
//! between the standard rates; its design and measured quality are in its module documentation.
//!
//! ### Clipping and headroom
//!
//! Integer outputs saturate at full scale and never wrap, and [`Converter::clipped_samples`] counts
//! how often. Resampling defaults to -3.5 dB gain after the filter. This covers the measured
//! full-scale square-wave overshoot; other signals can still clip, so monitor the saturation count.
//! Set 0 dB explicitly for unity. Exact and widening paths never apply this gain.
//!
//! ### What is not converted
//!
//! This PCM converter refuses DoP and native DSD ([`ConvertError::Unsupported`]); the separate
//! [`crate::dsd_pcm`] module explicitly converts native DSD to PCM. No channel
//! layout other than mono to stereo.
pub
pub use ;
pub use ;
pub use ;
pub use ;