@@ -475,7 +475,7 @@ impl Device {
475475 // Test both LE and BE formats to detect what the hardware actually supports.
476476 // LE is listed first as it's the common case for most audio hardware.
477477 // Hardware reports its supported formats regardless of CPU endianness.
478- const FORMATS : [ ( SampleFormat , alsa:: pcm:: Format ) ; 18 ] = [
478+ const FORMATS : [ ( SampleFormat , alsa:: pcm:: Format ) ; 23 ] = [
479479 ( SampleFormat :: I8 , alsa:: pcm:: Format :: S8 ) ,
480480 ( SampleFormat :: U8 , alsa:: pcm:: Format :: U8 ) ,
481481 ( SampleFormat :: I16 , alsa:: pcm:: Format :: S16LE ) ,
@@ -494,6 +494,11 @@ impl Device {
494494 ( SampleFormat :: F32 , alsa:: pcm:: Format :: FloatBE ) ,
495495 ( SampleFormat :: F64 , alsa:: pcm:: Format :: Float64LE ) ,
496496 ( SampleFormat :: F64 , alsa:: pcm:: Format :: Float64BE ) ,
497+ ( SampleFormat :: DsdU8 , alsa:: pcm:: Format :: DSDU8 ) ,
498+ ( SampleFormat :: DsdU16 , alsa:: pcm:: Format :: DSDU16LE ) ,
499+ ( SampleFormat :: DsdU16 , alsa:: pcm:: Format :: DSDU16BE ) ,
500+ ( SampleFormat :: DsdU32 , alsa:: pcm:: Format :: DSDU32LE ) ,
501+ ( SampleFormat :: DsdU32 , alsa:: pcm:: Format :: DSDU32BE ) ,
497502 //SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
498503 //SND_PCM_FORMAT_IEC958_SUBFRAME_BE,
499504 //SND_PCM_FORMAT_MU_LAW,
@@ -1262,6 +1267,7 @@ fn fill_with_equilibrium(buffer: &mut [u8], sample_format: SampleFormat) {
12621267 }
12631268 } } ;
12641269 }
1270+ const DSD_SILENCE_BYTE : u8 = 0x69 ;
12651271
12661272 match sample_format {
12671273 SampleFormat :: I8 => fill_typed ! ( i8 ) ,
@@ -1278,6 +1284,9 @@ fn fill_with_equilibrium(buffer: &mut [u8], sample_format: SampleFormat) {
12781284 SampleFormat :: U64 => fill_typed ! ( u64 ) ,
12791285 SampleFormat :: F32 => fill_typed ! ( f32 ) ,
12801286 SampleFormat :: F64 => fill_typed ! ( f64 ) ,
1287+ SampleFormat :: DsdU8 | SampleFormat :: DsdU16 | SampleFormat :: DsdU32 => {
1288+ buffer. fill ( DSD_SILENCE_BYTE )
1289+ }
12811290 }
12821291}
12831292
@@ -1344,6 +1353,15 @@ fn sample_format_to_alsa_format(
13441353 SampleFormat :: F64 => ( Format :: Float64LE , Format :: Float64BE ) ,
13451354 #[ cfg( target_endian = "big" ) ]
13461355 SampleFormat :: F64 => ( Format :: Float64BE , Format :: Float64LE ) ,
1356+ SampleFormat :: DsdU8 => return Ok ( Format :: DSDU8 ) ,
1357+ #[ cfg( target_endian = "little" ) ]
1358+ SampleFormat :: DsdU16 => ( Format :: DSDU16LE , Format :: DSDU16BE ) ,
1359+ #[ cfg( target_endian = "big" ) ]
1360+ SampleFormat :: DsdU16 => ( Format :: DSDU16BE , Format :: DSDU16LE ) ,
1361+ #[ cfg( target_endian = "little" ) ]
1362+ SampleFormat :: DsdU32 => ( Format :: DSDU32LE , Format :: DSDU32BE ) ,
1363+ #[ cfg( target_endian = "big" ) ]
1364+ SampleFormat :: DsdU32 => ( Format :: DSDU32BE , Format :: DSDU32LE ) ,
13471365 _ => {
13481366 return Err ( BackendSpecificError {
13491367 description : format ! ( "Sample format '{sample_format}' is not supported" ) ,
0 commit comments