@@ -206,9 +206,9 @@ fn get_setup(args: &[String]) -> Setup {
206206 const HELP : & str = "h" ;
207207 const INITIAL_VOLUME : & str = "initial-volume" ;
208208 const MIXER_TYPE : & str = "mixer" ;
209- const MIXER_CARD : & str = "mixer-card " ;
210- const MIXER_INDEX : & str = "mixer-index" ;
211- const MIXER_NAME : & str = "mixer-name " ;
209+ const ALSA_MIXER_DEVICE : & str = "alsa- mixer-device " ;
210+ const ALSA_MIXER_INDEX : & str = "alsa- mixer-index" ;
211+ const ALSA_MIXER_CONTROL : & str = "alsa- mixer-control " ;
212212 const NAME : & str = "name" ;
213213 const NORMALISATION_ATTACK : & str = "normalisation-attack" ;
214214 const NORMALISATION_GAIN_TYPE : & str = "normalisation-gain-type" ;
@@ -296,24 +296,42 @@ fn get_setup(args: &[String]) -> Setup {
296296 "Specify the dither algorithm to use - [none, gpdf, tpdf, tpdf_hp]. Defaults to 'tpdf' for formats S16, S24, S24_3 and 'none' for other formats." ,
297297 "DITHER" ,
298298 )
299- . optopt ( "" , MIXER_TYPE , "Mixer to use {alsa|softvol}." , "MIXER" )
299+ . optopt ( "m " , MIXER_TYPE , "Mixer to use {alsa|softvol}." , "MIXER" )
300300 . optopt (
301- "m" ,
302- MIXER_NAME ,
301+ "" ,
302+ "mixer-name" , // deprecated
303+ "" ,
304+ "" ,
305+ )
306+ . optopt (
307+ "" ,
308+ ALSA_MIXER_CONTROL ,
303309 "Alsa mixer control, e.g. 'PCM' or 'Master'. Defaults to 'PCM'." ,
304310 "NAME" ,
305311 )
306312 . optopt (
307313 "" ,
308- MIXER_CARD ,
309- "Alsa mixer card, e.g 'hw:0' or similar from `aplay -l`. Defaults to DEVICE if specified, 'default' otherwise." ,
310- "MIXER_CARD" ,
314+ "mixer-card" , // deprecated
315+ "" ,
316+ "" ,
317+ )
318+ . optopt (
319+ "" ,
320+ ALSA_MIXER_DEVICE ,
321+ "Alsa mixer device, e.g 'hw:0' or similar from `aplay -l`. Defaults to `--device` if specified, 'default' otherwise." ,
322+ "DEVICE" ,
323+ )
324+ . optopt (
325+ "" ,
326+ "mixer-index" , // deprecated
327+ "" ,
328+ "" ,
311329 )
312330 . optopt (
313331 "" ,
314- MIXER_INDEX ,
332+ ALSA_MIXER_INDEX ,
315333 "Alsa index of the cards mixer. Defaults to 0." ,
316- "INDEX " ,
334+ "NUMBER " ,
317335 )
318336 . optopt (
319337 "" ,
@@ -459,20 +477,50 @@ fn get_setup(args: &[String]) -> Setup {
459477 let mixer = mixer:: find ( mixer_type. as_deref ( ) ) . expect ( "Invalid mixer" ) ;
460478
461479 let mixer_config = {
462- let card = matches. opt_str ( MIXER_CARD ) . unwrap_or_else ( || {
463- if let Some ( ref device_name ) = device {
464- device_name . to_string ( )
465- } else {
466- MixerConfig :: default ( ) . card
480+ let mixer_device = match matches. opt_str ( "mixer-card" ) {
481+ Some ( card ) => {
482+ warn ! ( "--mixer-card is deprecated and will be removed in a future release." ) ;
483+ warn ! ( "Please use --alsa-mixer-device instead." ) ;
484+ card
467485 }
468- } ) ;
469- let index = matches
470- . opt_str ( MIXER_INDEX )
471- . map ( |index| index. parse :: < u32 > ( ) . unwrap ( ) )
472- . unwrap_or ( 0 ) ;
473- let control = matches
474- . opt_str ( MIXER_NAME )
475- . unwrap_or_else ( || MixerConfig :: default ( ) . control ) ;
486+ None => matches. opt_str ( ALSA_MIXER_DEVICE ) . unwrap_or_else ( || {
487+ if let Some ( ref device_name) = device {
488+ device_name. to_string ( )
489+ } else {
490+ MixerConfig :: default ( ) . device
491+ }
492+ } ) ,
493+ } ;
494+
495+ let index = match matches. opt_str ( "mixer-index" ) {
496+ Some ( index) => {
497+ warn ! ( "--mixer-index is deprecated and will be removed in a future release." ) ;
498+ warn ! ( "Please use --alsa-mixer-index instead." ) ;
499+ index
500+ . parse :: < u32 > ( )
501+ . expect ( "Mixer index is not a valid number" )
502+ }
503+ None => matches
504+ . opt_str ( ALSA_MIXER_INDEX )
505+ . map ( |index| {
506+ index
507+ . parse :: < u32 > ( )
508+ . expect ( "Alsa mixer index is not a valid number" )
509+ } )
510+ . unwrap_or ( 0 ) ,
511+ } ;
512+
513+ let control = match matches. opt_str ( "mixer-name" ) {
514+ Some ( name) => {
515+ warn ! ( "--mixer-name is deprecated and will be removed in a future release." ) ;
516+ warn ! ( "Please use --alsa-mixer-control instead." ) ;
517+ name
518+ }
519+ None => matches
520+ . opt_str ( ALSA_MIXER_CONTROL )
521+ . unwrap_or_else ( || MixerConfig :: default ( ) . control ) ,
522+ } ;
523+
476524 let mut volume_range = matches
477525 . opt_str ( VOLUME_RANGE )
478526 . map ( |range| range. parse :: < f64 > ( ) . unwrap ( ) )
@@ -503,7 +551,7 @@ fn get_setup(args: &[String]) -> Setup {
503551 } ) ;
504552
505553 MixerConfig {
506- card ,
554+ device : mixer_device ,
507555 control,
508556 index,
509557 volume_ctrl,
0 commit comments