@@ -653,14 +653,14 @@ impl Player {
653653 } )
654654 . or_else ( || {
655655 // Set a default dithering level
656- use cpal:: SampleFormat :: { I8 , I16 , I32 , I64 , U8 , U16 , U32 , U64 } ;
656+ use cpal:: SampleFormat :: { I8 , I16 , I24 , I32 , I64 , U8 , U16 , U32 , U64 } ;
657657 let bits = match device_config. sample_format ( ) {
658658 // Very low fidelity, e.g., legacy or telephony
659659 I8 | U8 => 7.0 ,
660660 // Most DACs handling 16-bit do not achieve a true 16-bit SINAD
661661 I16 | U16 => 15.5 ,
662662 // Good delta-sigma DACs max out around 20–21 bits; 19.5 is safe
663- I32 | U32 => 19.5 ,
663+ I24 | I32 | U32 => 19.5 ,
664664 // No DAC supports more, this is purely for internal formats
665665 I64 | U64 => 24.0 ,
666666 // Floating point usually gets quantized later - don't dither here
@@ -734,10 +734,12 @@ impl Player {
734734 ///
735735 /// Only includes the three most common sample formats:
736736 /// * I16 - 16-bit signed integer
737+ /// * I24 - 24-bit signed integer (stored in 4 bytes)
737738 /// * I32 - 32-bit signed integer
738739 /// * F32 - 32-bit floating point
739- const SAMPLE_FORMATS : [ cpal:: SampleFormat ; 3 ] = [
740+ const SAMPLE_FORMATS : [ cpal:: SampleFormat ; 4 ] = [
740741 cpal:: SampleFormat :: I16 ,
742+ cpal:: SampleFormat :: I24 ,
741743 cpal:: SampleFormat :: I32 ,
742744 cpal:: SampleFormat :: F32 ,
743745 ] ;
@@ -754,6 +756,7 @@ impl Player {
754756 /// - 44.1 kHz (CD audio, streaming services)
755757 /// - 48 kHz (professional audio, video production)
756758 /// - I16 (16-bit integer)
759+ /// - I24 (24-bit integer stored in 4 bytes)
757760 /// - I32 (32-bit integer)
758761 /// - F32 (32-bit float)
759762 /// * Stereo output (2 channels)
0 commit comments