mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	more name hint interace updates
- add long card name to device description - create empty PCM plugin to allow right hint description parsing - reorder devices in alsa.conf - make namehint more configurable (using default.namehint.showall switch) - add two levels basic and exteded for hints to default configuration files - do not show direct device aliases - removed all known memory leaks
This commit is contained in:
		
							parent
							
								
									aa7a0dd70b
								
							
						
					
					
						commit
						1300e70573
					
				
					 20 changed files with 456 additions and 322 deletions
				
			
		| 
						 | 
				
			
			@ -292,7 +292,7 @@ else
 | 
			
		|||
pcm_plugins=""
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol extplug ioplug"
 | 
			
		||||
PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null empty share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol extplug ioplug"
 | 
			
		||||
 | 
			
		||||
build_pcm_plugin="no"
 | 
			
		||||
for t in $PCM_PLUGIN_LIST; do
 | 
			
		||||
| 
						 | 
				
			
			@ -332,6 +332,7 @@ AM_CONDITIONAL(BUILD_PCM_PLUGIN_MULTI, test x$build_pcm_multi = xyes)
 | 
			
		|||
AM_CONDITIONAL(BUILD_PCM_PLUGIN_SHM, test x$build_pcm_shm = xyes)
 | 
			
		||||
AM_CONDITIONAL(BUILD_PCM_PLUGIN_FILE, test x$build_pcm_file = xyes)
 | 
			
		||||
AM_CONDITIONAL(BUILD_PCM_PLUGIN_NULL, test x$build_pcm_null = xyes)
 | 
			
		||||
AM_CONDITIONAL(BUILD_PCM_PLUGIN_EMPTY, test x$build_pcm_empty = xyes)
 | 
			
		||||
AM_CONDITIONAL(BUILD_PCM_PLUGIN_SHARE, test x$build_pcm_share = xyes)
 | 
			
		||||
AM_CONDITIONAL(BUILD_PCM_PLUGIN_METER, test x$build_pcm_meter = xyes)
 | 
			
		||||
AM_CONDITIONAL(BUILD_PCM_PLUGIN_HOOKS, test x$build_pcm_hooks = xyes)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,8 +47,17 @@ cards.@hooks [
 | 
			
		|||
	}
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# defaults
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# show all name hints also for definitions without hint {} section
 | 
			
		||||
defaults.namehint.showall off
 | 
			
		||||
# show just basic name hints
 | 
			
		||||
defaults.namehint.basic on
 | 
			
		||||
# show extended name hints
 | 
			
		||||
defaults.namehint.extended off
 | 
			
		||||
#
 | 
			
		||||
defaults.ctl.card 0
 | 
			
		||||
defaults.pcm.card 0
 | 
			
		||||
defaults.pcm.device 0
 | 
			
		||||
| 
						 | 
				
			
			@ -101,6 +110,26 @@ defaults.timer.subdevice 0
 | 
			
		|||
#  PCM interface
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# redirect to load-on-demand extended pcm definitions
 | 
			
		||||
pcm.cards cards.pcm
 | 
			
		||||
 | 
			
		||||
pcm.default cards.pcm.default
 | 
			
		||||
pcm.front cards.pcm.front
 | 
			
		||||
pcm.rear cards.pcm.rear
 | 
			
		||||
pcm.center_lfe cards.pcm.center_lfe
 | 
			
		||||
pcm.side cards.pcm.side
 | 
			
		||||
pcm.surround40 cards.pcm.surround40
 | 
			
		||||
pcm.surround41 cards.pcm.surround41
 | 
			
		||||
pcm.surround50 cards.pcm.surround50
 | 
			
		||||
pcm.surround51 cards.pcm.surround51
 | 
			
		||||
pcm.surround71 cards.pcm.surround71
 | 
			
		||||
pcm.iec958 cards.pcm.iec958
 | 
			
		||||
pcm.spdif iec958
 | 
			
		||||
pcm.dmix cards.pcm.dmix
 | 
			
		||||
pcm.dsnoop cards.pcm.dsnoop
 | 
			
		||||
pcm.modem cards.pcm.modem
 | 
			
		||||
pcm.phoneline cards.pcm.phoneline
 | 
			
		||||
 | 
			
		||||
pcm.hw {
 | 
			
		||||
	@args [ CARD DEV SUBDEV ]
 | 
			
		||||
	@args.CARD {
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +170,13 @@ pcm.hw {
 | 
			
		|||
	card $CARD
 | 
			
		||||
	device $DEV
 | 
			
		||||
	subdevice $SUBDEV
 | 
			
		||||
	hint 0
 | 
			
		||||
	hint {
 | 
			
		||||
		show {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.namehint.extended
 | 
			
		||||
		}
 | 
			
		||||
		description "Direct hardware device without any conversions"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pcm.plughw {
 | 
			
		||||
| 
						 | 
				
			
			@ -187,7 +222,13 @@ pcm.plughw {
 | 
			
		|||
		device $DEV
 | 
			
		||||
		subdevice $SUBDEV
 | 
			
		||||
	}
 | 
			
		||||
	hint 0
 | 
			
		||||
	hint {
 | 
			
		||||
		show {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.namehint.extended
 | 
			
		||||
		}
 | 
			
		||||
		description "Hardware device with all software conversions"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pcm.plug {
 | 
			
		||||
| 
						 | 
				
			
			@ -246,35 +287,35 @@ pcm.file {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
pcm.null {
 | 
			
		||||
	hint.description "Discard all samples (playback) or generate zero samples (capture)"
 | 
			
		||||
	type null
 | 
			
		||||
	hint {
 | 
			
		||||
		show {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.namehint.basic
 | 
			
		||||
		}
 | 
			
		||||
		description "Discard all samples (playback) or generate zero samples (capture)"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# redirect to load-on-demand extended pcm definitions
 | 
			
		||||
pcm.cards cards.pcm
 | 
			
		||||
# some links for easy use
 | 
			
		||||
pcm.front cards.pcm.front
 | 
			
		||||
pcm.rear cards.pcm.rear
 | 
			
		||||
pcm.center_lfe cards.pcm.center_lfe
 | 
			
		||||
pcm.side cards.pcm.side
 | 
			
		||||
pcm.surround40 cards.pcm.surround40
 | 
			
		||||
pcm.surround41 cards.pcm.surround41
 | 
			
		||||
pcm.surround50 cards.pcm.surround50
 | 
			
		||||
pcm.surround51 cards.pcm.surround51
 | 
			
		||||
pcm.surround71 cards.pcm.surround71
 | 
			
		||||
pcm.iec958 cards.pcm.iec958
 | 
			
		||||
pcm.spdif cards.pcm.iec958
 | 
			
		||||
pcm.modem cards.pcm.modem
 | 
			
		||||
pcm.phoneline cards.pcm.phoneline
 | 
			
		||||
 | 
			
		||||
pcm.default cards.pcm.default
 | 
			
		||||
pcm.dmix cards.pcm.dmix
 | 
			
		||||
pcm.dsnoop cards.pcm.dsnoop
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
#  Control interface
 | 
			
		||||
#
 | 
			
		||||
	
 | 
			
		||||
ctl.default {
 | 
			
		||||
	type hw
 | 
			
		||||
	card {
 | 
			
		||||
		@func getenv
 | 
			
		||||
		vars [
 | 
			
		||||
			ALSA_CTL_CARD
 | 
			
		||||
			ALSA_CARD
 | 
			
		||||
		]
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.ctl.card
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ctl.hw {
 | 
			
		||||
	@args[ CARD ]
 | 
			
		||||
	@args.CARD {
 | 
			
		||||
| 
						 | 
				
			
			@ -308,25 +349,35 @@ ctl.shm {
 | 
			
		|||
	ctl $CTL
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ctl.default {
 | 
			
		||||
#
 | 
			
		||||
#  RawMidi interface
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
rawmidi.default {
 | 
			
		||||
	type hw
 | 
			
		||||
	card {
 | 
			
		||||
		@func getenv
 | 
			
		||||
		vars [
 | 
			
		||||
			ALSA_CTL_CARD
 | 
			
		||||
			ALSA_RAWMIDI_CARD
 | 
			
		||||
			ALSA_CARD
 | 
			
		||||
		]
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.ctl.card
 | 
			
		||||
			name defaults.rawmidi.card
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	device {
 | 
			
		||||
		@func igetenv
 | 
			
		||||
		vars [
 | 
			
		||||
			ALSA_RAWMIDI_DEVICE
 | 
			
		||||
		]
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.rawmidi.device
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
#  RawMidi interface
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
rawmidi.hw {
 | 
			
		||||
	@args [ CARD DEV SUBDEV ]
 | 
			
		||||
	@args.CARD {
 | 
			
		||||
| 
						 | 
				
			
			@ -370,31 +421,6 @@ rawmidi.hw {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rawmidi.default {
 | 
			
		||||
	type hw
 | 
			
		||||
	card {
 | 
			
		||||
		@func getenv
 | 
			
		||||
		vars [
 | 
			
		||||
			ALSA_RAWMIDI_CARD
 | 
			
		||||
			ALSA_CARD
 | 
			
		||||
		]
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.rawmidi.card
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	device {
 | 
			
		||||
		@func igetenv
 | 
			
		||||
		vars [
 | 
			
		||||
			ALSA_RAWMIDI_DEVICE
 | 
			
		||||
		]
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.rawmidi.device
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rawmidi.virtual {
 | 
			
		||||
	@args [ MERGE ]
 | 
			
		||||
	@args.MERGE {
 | 
			
		||||
| 
						 | 
				
			
			@ -421,6 +447,31 @@ seq.hw {
 | 
			
		|||
#  HwDep interface
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
hwdep.default {
 | 
			
		||||
	type hw
 | 
			
		||||
	card {
 | 
			
		||||
		@func getenv
 | 
			
		||||
		vars [
 | 
			
		||||
			ALSA_HWDEP_CARD
 | 
			
		||||
			ALSA_CARD
 | 
			
		||||
		]
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.hwdep.card
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	device {
 | 
			
		||||
		@func igetenv
 | 
			
		||||
		vars [
 | 
			
		||||
			ALSA_HWDEP_DEVICE
 | 
			
		||||
		]
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.hwdep.device
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
hwdep.hw {
 | 
			
		||||
	@args [ CARD DEV ]
 | 
			
		||||
	@args.CARD {
 | 
			
		||||
| 
						 | 
				
			
			@ -455,41 +506,41 @@ hwdep.hw {
 | 
			
		|||
	device $DEV
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
hwdep.default {
 | 
			
		||||
	type hw
 | 
			
		||||
	card {
 | 
			
		||||
		@func getenv
 | 
			
		||||
		vars [
 | 
			
		||||
			ALSA_HWDEP_CARD
 | 
			
		||||
			ALSA_CARD
 | 
			
		||||
		]
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.hwdep.card
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	device {
 | 
			
		||||
		@func igetenv
 | 
			
		||||
		vars [
 | 
			
		||||
			ALSA_HWDEP_DEVICE
 | 
			
		||||
		]
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.hwdep.device
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
#  Timer interface
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
timer_query.default {
 | 
			
		||||
	type hw
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
timer_query.hw {
 | 
			
		||||
	type hw
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
timer_query.default {
 | 
			
		||||
timer.default {
 | 
			
		||||
	type hw
 | 
			
		||||
	class {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name defaults.timer.class
 | 
			
		||||
	}
 | 
			
		||||
	sclass {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name defaults.timer.sclass
 | 
			
		||||
	}
 | 
			
		||||
	card {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name defaults.timer.card
 | 
			
		||||
	}
 | 
			
		||||
	device {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name defaults.timer.device
 | 
			
		||||
	}
 | 
			
		||||
	subdevice {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name defaults.timer.subdevice
 | 
			
		||||
	}
 | 
			
		||||
	hint.description "Default direct hardware timer device"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
timer.hw {
 | 
			
		||||
| 
						 | 
				
			
			@ -536,28 +587,3 @@ timer.hw {
 | 
			
		|||
	device $DEV
 | 
			
		||||
	subdevice $SUBDEV
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
timer.default {
 | 
			
		||||
	type hw
 | 
			
		||||
	class {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name defaults.timer.class
 | 
			
		||||
	}
 | 
			
		||||
	sclass {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name defaults.timer.sclass
 | 
			
		||||
	}
 | 
			
		||||
	card {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name defaults.timer.card
 | 
			
		||||
	}
 | 
			
		||||
	device {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name defaults.timer.device
 | 
			
		||||
	}
 | 
			
		||||
	subdevice {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name defaults.timer.subdevice
 | 
			
		||||
	}
 | 
			
		||||
	hint.description "Default direct hardware timer device"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,10 +19,7 @@ HDA-Intel.pcm.front.0 {
 | 
			
		|||
		name "PCM Playback Volume"
 | 
			
		||||
		card $CARD
 | 
			
		||||
	}
 | 
			
		||||
	hint {
 | 
			
		||||
		description "Front speakers and multichannel output"
 | 
			
		||||
		device 0
 | 
			
		||||
	}
 | 
			
		||||
	hint.device 0
 | 
			
		||||
}	
 | 
			
		||||
 | 
			
		||||
# default with dmix+softvol & dsnoop
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +51,6 @@ HDA-Intel.pcm.default {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint {
 | 
			
		||||
		description "Default dmix+softvol + dsnoop device"
 | 
			
		||||
		device_output {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.pcm.dmix.device
 | 
			
		||||
| 
						 | 
				
			
			@ -140,10 +136,7 @@ HDA-Intel.pcm.iec958.0 {
 | 
			
		|||
			]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint {
 | 
			
		||||
		description "IEC958 (S/PDIF) Output"
 | 
			
		||||
		device 1
 | 
			
		||||
	}
 | 
			
		||||
	hint.device 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
<confdir:pcm/modem.conf>
 | 
			
		||||
| 
						 | 
				
			
			@ -156,5 +149,5 @@ HDA-Intel.pcm.modem.0 {
 | 
			
		|||
	type hw
 | 
			
		||||
	card $CARD
 | 
			
		||||
	device 6
 | 
			
		||||
	hint 0
 | 
			
		||||
	hint.show off
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,16 +32,26 @@ pcm.!center_lfe {
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@func refer
 | 
			
		||||
	name {
 | 
			
		||||
		@func concat
 | 
			
		||||
		strings [
 | 
			
		||||
			"cards."
 | 
			
		||||
			{
 | 
			
		||||
				@func card_driver
 | 
			
		||||
				card $CARD
 | 
			
		||||
			}
 | 
			
		||||
			".pcm.center_lfe." $DEV ":CARD=" $CARD
 | 
			
		||||
		]
 | 
			
		||||
	type empty
 | 
			
		||||
	slave.pcm {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name {
 | 
			
		||||
			@func concat
 | 
			
		||||
			strings [
 | 
			
		||||
				"cards."
 | 
			
		||||
				{
 | 
			
		||||
					@func card_driver
 | 
			
		||||
					card $CARD
 | 
			
		||||
				}
 | 
			
		||||
				".pcm.center_lfe." $DEV ":CARD=" $CARD
 | 
			
		||||
			]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint {
 | 
			
		||||
		show {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.namehint.basic
 | 
			
		||||
		}
 | 
			
		||||
		description "Center and Subwoofer speakers"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,14 +12,14 @@ pcm.!dmix {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@args.DEV {
 | 
			
		||||
		type string
 | 
			
		||||
		type integer
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.pcm.dmix.device
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@args.SUBDEV {
 | 
			
		||||
		type string
 | 
			
		||||
		type integer
 | 
			
		||||
		default -1
 | 
			
		||||
	}
 | 
			
		||||
	@args.FORMAT {
 | 
			
		||||
| 
						 | 
				
			
			@ -120,6 +120,10 @@ pcm.!dmix {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint {
 | 
			
		||||
		show {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.namehint.extended
 | 
			
		||||
		}
 | 
			
		||||
		description "Direct sample mixing device"
 | 
			
		||||
		device $DEV
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,14 +12,14 @@ pcm.!dsnoop {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@args.DEV {
 | 
			
		||||
		type string
 | 
			
		||||
		type integer
 | 
			
		||||
		default {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.pcm.dsnoop.device
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@args.SUBDEV {
 | 
			
		||||
		type string
 | 
			
		||||
		type integer
 | 
			
		||||
		default -1
 | 
			
		||||
	}
 | 
			
		||||
	@args.FORMAT {
 | 
			
		||||
| 
						 | 
				
			
			@ -120,6 +120,10 @@ pcm.!dsnoop {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint {
 | 
			
		||||
		show {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.namehint.extended
 | 
			
		||||
		}
 | 
			
		||||
		description "Direct sample snooping device"
 | 
			
		||||
		device $DEV
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,16 +32,26 @@ pcm.!front {
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@func refer
 | 
			
		||||
	name {
 | 
			
		||||
		@func concat
 | 
			
		||||
		strings [
 | 
			
		||||
			"cards."
 | 
			
		||||
			{
 | 
			
		||||
				@func card_driver
 | 
			
		||||
				card $CARD
 | 
			
		||||
			}
 | 
			
		||||
			".pcm.front." $DEV ":CARD=" $CARD
 | 
			
		||||
		]
 | 
			
		||||
	type empty
 | 
			
		||||
	slave.pcm {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name {
 | 
			
		||||
			@func concat
 | 
			
		||||
			strings [
 | 
			
		||||
				"cards."
 | 
			
		||||
				{
 | 
			
		||||
					@func card_driver
 | 
			
		||||
					card $CARD
 | 
			
		||||
				}
 | 
			
		||||
				".pcm.front." $DEV ":CARD=" $CARD
 | 
			
		||||
			]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint {
 | 
			
		||||
		show {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.namehint.basic
 | 
			
		||||
		}
 | 
			
		||||
		description "Front speakers"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,21 +52,31 @@ pcm.!iec958 {
 | 
			
		|||
		# fs=48000Hz, clock accuracy=1000ppm
 | 
			
		||||
		default 0x02
 | 
			
		||||
	}
 | 
			
		||||
	@func refer
 | 
			
		||||
	name {
 | 
			
		||||
		@func concat
 | 
			
		||||
		strings [
 | 
			
		||||
			"cards."
 | 
			
		||||
			{
 | 
			
		||||
				@func card_driver
 | 
			
		||||
				card $CARD
 | 
			
		||||
			}
 | 
			
		||||
			".pcm.iec958." $DEV ":"
 | 
			
		||||
			"CARD=" $CARD ","
 | 
			
		||||
			"AES0=" $AES0 ","
 | 
			
		||||
			"AES1=" $AES1 ","
 | 
			
		||||
			"AES2=" $AES2 ","
 | 
			
		||||
			"AES3=" $AES3
 | 
			
		||||
		]
 | 
			
		||||
	type empty
 | 
			
		||||
	slave.pcm {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name {
 | 
			
		||||
			@func concat
 | 
			
		||||
			strings [
 | 
			
		||||
				"cards."
 | 
			
		||||
				{
 | 
			
		||||
					@func card_driver
 | 
			
		||||
					card $CARD
 | 
			
		||||
				}
 | 
			
		||||
				".pcm.iec958." $DEV ":"
 | 
			
		||||
				"CARD=" $CARD ","
 | 
			
		||||
				"AES0=" $AES0 ","
 | 
			
		||||
				"AES1=" $AES1 ","
 | 
			
		||||
				"AES2=" $AES2 ","
 | 
			
		||||
				"AES3=" $AES3
 | 
			
		||||
			]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint {
 | 
			
		||||
		show {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.namehint.basic
 | 
			
		||||
		}
 | 
			
		||||
		description "IEC958 (S/PDIF) Digital Audio Output"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,7 +44,7 @@ pcm.!phoneline {
 | 
			
		|||
			".pcm.modem." $DEV ":CARD=" $CARD
 | 
			
		||||
		]
 | 
			
		||||
	}
 | 
			
		||||
	hint 0
 | 
			
		||||
	hint.show off
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -102,5 +102,5 @@ pcm.!modem {
 | 
			
		|||
		}
 | 
			
		||||
		]
 | 
			
		||||
	}
 | 
			
		||||
	hint 0
 | 
			
		||||
	hint.show off
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,16 +32,26 @@ pcm.!rear {
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@func refer
 | 
			
		||||
	name {
 | 
			
		||||
		@func concat
 | 
			
		||||
		strings [
 | 
			
		||||
			"cards."
 | 
			
		||||
			{
 | 
			
		||||
				@func card_driver
 | 
			
		||||
				card $CARD
 | 
			
		||||
			}
 | 
			
		||||
			".pcm.rear." $DEV ":CARD=" $CARD
 | 
			
		||||
		]
 | 
			
		||||
	type empty
 | 
			
		||||
	slave.pcm {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name {
 | 
			
		||||
			@func concat
 | 
			
		||||
			strings [
 | 
			
		||||
				"cards."
 | 
			
		||||
				{
 | 
			
		||||
					@func card_driver
 | 
			
		||||
					card $CARD
 | 
			
		||||
				}
 | 
			
		||||
				".pcm.rear." $DEV ":CARD=" $CARD
 | 
			
		||||
			]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint {
 | 
			
		||||
		show {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.namehint.basic
 | 
			
		||||
		}
 | 
			
		||||
		description "Rear speakers"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,16 +32,26 @@ pcm.!side {
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@func refer
 | 
			
		||||
	name {
 | 
			
		||||
		@func concat
 | 
			
		||||
		strings [
 | 
			
		||||
			"cards."
 | 
			
		||||
			{
 | 
			
		||||
				@func card_driver
 | 
			
		||||
				card $CARD
 | 
			
		||||
			}
 | 
			
		||||
			".pcm.side." $DEV ":CARD=" $CARD
 | 
			
		||||
		]
 | 
			
		||||
	type empty
 | 
			
		||||
	slave.pcm {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name {
 | 
			
		||||
			@func concat
 | 
			
		||||
			strings [
 | 
			
		||||
				"cards."
 | 
			
		||||
				{
 | 
			
		||||
					@func card_driver
 | 
			
		||||
					card $CARD
 | 
			
		||||
				}
 | 
			
		||||
				".pcm.side." $DEV ":CARD=" $CARD
 | 
			
		||||
			]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint {
 | 
			
		||||
		show {
 | 
			
		||||
			@func refer
 | 
			
		||||
			name defaults.namehint.basic
 | 
			
		||||
		}
 | 
			
		||||
		description "Side speakers"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,16 +37,20 @@ pcm.!surround40 {
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@func refer
 | 
			
		||||
	name {
 | 
			
		||||
		@func concat
 | 
			
		||||
		strings [
 | 
			
		||||
			"cards."
 | 
			
		||||
			{
 | 
			
		||||
				@func card_driver
 | 
			
		||||
				card $CARD
 | 
			
		||||
			}
 | 
			
		||||
			".pcm.surround40." $DEV ":CARD=" $CARD
 | 
			
		||||
		]
 | 
			
		||||
	type empty
 | 
			
		||||
	slave.pcm {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name {
 | 
			
		||||
			@func concat
 | 
			
		||||
			strings [
 | 
			
		||||
				"cards."
 | 
			
		||||
				{
 | 
			
		||||
					@func card_driver
 | 
			
		||||
					card $CARD
 | 
			
		||||
				}
 | 
			
		||||
				".pcm.surround40." $DEV ":CARD=" $CARD
 | 
			
		||||
			]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint.description "4.0 Surround output to Front and Rear speakers"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,4 +59,5 @@ pcm.!surround41 {
 | 
			
		|||
	ttable.2.2 1
 | 
			
		||||
	ttable.3.3 1
 | 
			
		||||
	ttable.4.5 1
 | 
			
		||||
	hint.description "4.1 Surround output to Front, Rear and Subwoofer speakers"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,4 +59,5 @@ pcm.!surround50 {
 | 
			
		|||
	ttable.2.2 1
 | 
			
		||||
	ttable.3.3 1
 | 
			
		||||
	ttable.4.4 1
 | 
			
		||||
	hint.description "5.0 Surround output to Front, Center and Rear speakers"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,16 +39,20 @@ pcm.!surround51 {
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@func refer
 | 
			
		||||
	name {
 | 
			
		||||
		@func concat
 | 
			
		||||
		strings [
 | 
			
		||||
			"cards."
 | 
			
		||||
			{
 | 
			
		||||
				@func card_driver
 | 
			
		||||
				card $CARD
 | 
			
		||||
			}
 | 
			
		||||
			".pcm.surround51." $DEV ":CARD=" $CARD
 | 
			
		||||
		]
 | 
			
		||||
	type empty
 | 
			
		||||
	slave.pcm {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name {
 | 
			
		||||
			@func concat
 | 
			
		||||
			strings [
 | 
			
		||||
				"cards."
 | 
			
		||||
				{
 | 
			
		||||
					@func card_driver
 | 
			
		||||
					card $CARD
 | 
			
		||||
				}
 | 
			
		||||
				".pcm.surround51." $DEV ":CARD=" $CARD
 | 
			
		||||
			]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint.description "5.1 Surround output to Front, Center, Rear and Subwoofer speakers"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,16 +41,20 @@ pcm.!surround71 {
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	@func refer
 | 
			
		||||
	name {
 | 
			
		||||
		@func concat
 | 
			
		||||
		strings [
 | 
			
		||||
			"cards."
 | 
			
		||||
			{
 | 
			
		||||
				@func card_driver
 | 
			
		||||
				card $CARD
 | 
			
		||||
			}
 | 
			
		||||
			".pcm.surround71." $DEV ":CARD=" $CARD
 | 
			
		||||
		]
 | 
			
		||||
	type empty
 | 
			
		||||
	slave.pcm {
 | 
			
		||||
		@func refer
 | 
			
		||||
		name {
 | 
			
		||||
			@func concat
 | 
			
		||||
			strings [
 | 
			
		||||
				"cards."
 | 
			
		||||
				{
 | 
			
		||||
					@func card_driver
 | 
			
		||||
					card $CARD
 | 
			
		||||
				}
 | 
			
		||||
				".pcm.surround71." $DEV ":CARD=" $CARD
 | 
			
		||||
			]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	hint.description "7.1 Surround output to Front, Center, Side, Rear and Woofer speakers"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -493,16 +493,6 @@ static int snd_func_iops(snd_config_t **dst,
 | 
			
		|||
			}
 | 
			
		||||
			if (i == idx) {
 | 
			
		||||
				idx++;
 | 
			
		||||
#if 1
 | 
			
		||||
	{
 | 
			
		||||
                        snd_output_t *out;
 | 
			
		||||
                        fprintf(stderr, "********* ID '%s':\n", id);
 | 
			
		||||
                        snd_output_stdio_attach(&out, stderr, 0);
 | 
			
		||||
                        snd_config_save(n, out);
 | 
			
		||||
                        snd_output_close(out);
 | 
			
		||||
                        printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
				err = snd_config_get_integer(n, &val);
 | 
			
		||||
				if (err < 0) {
 | 
			
		||||
					SNDERR("invalid integer for id %s", id);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,8 @@ struct hint_list {
 | 
			
		|||
	long device_input;
 | 
			
		||||
	long device_output;
 | 
			
		||||
	int stream;
 | 
			
		||||
	int show_all;
 | 
			
		||||
	char *longname;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -80,10 +82,11 @@ static void zero_handler(const char *file ATTRIBUTE_UNUSED,
 | 
			
		|||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static char *get_dev_name1(struct hint_list *list)
 | 
			
		||||
static int get_dev_name1(struct hint_list *list, char **res)
 | 
			
		||||
{
 | 
			
		||||
	*res = NULL;
 | 
			
		||||
	if (list->device < 0)
 | 
			
		||||
		return NULL;
 | 
			
		||||
		return 0;
 | 
			
		||||
	switch (list->iface) {
 | 
			
		||||
	case SND_CTL_ELEM_IFACE_HWDEP:
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -91,8 +94,9 @@ static char *get_dev_name1(struct hint_list *list)
 | 
			
		|||
			snd_hwdep_info_alloca(&info);
 | 
			
		||||
			snd_hwdep_info_set_device(info, list->device);
 | 
			
		||||
			if (snd_ctl_hwdep_info(list->ctl, info) < 0)
 | 
			
		||||
				return NULL;
 | 
			
		||||
			return strdup(snd_hwdep_info_get_name(info));
 | 
			
		||||
				return 0;
 | 
			
		||||
			*res = strdup(snd_hwdep_info_get_name(info));
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
	case SND_CTL_ELEM_IFACE_PCM:
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -101,15 +105,16 @@ static char *get_dev_name1(struct hint_list *list)
 | 
			
		|||
			snd_pcm_info_set_device(info, list->device);
 | 
			
		||||
			snd_pcm_info_set_stream(info, list->stream ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK);
 | 
			
		||||
			if (snd_ctl_pcm_info(list->ctl, info) < 0)
 | 
			
		||||
				return NULL;
 | 
			
		||||
				return 0;
 | 
			
		||||
			switch (snd_pcm_info_get_class(info)) {
 | 
			
		||||
			case SND_PCM_CLASS_MODEM:
 | 
			
		||||
			case SND_PCM_CLASS_DIGITIZER:
 | 
			
		||||
				return NULL;
 | 
			
		||||
				return -ENODEV;
 | 
			
		||||
			default:
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			return strdup(snd_pcm_info_get_name(info));
 | 
			
		||||
			*res = strdup(snd_pcm_info_get_name(info));
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
	case SND_CTL_ELEM_IFACE_RAWMIDI:
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -118,11 +123,12 @@ static char *get_dev_name1(struct hint_list *list)
 | 
			
		|||
			snd_rawmidi_info_set_device(info, list->device);
 | 
			
		||||
			snd_rawmidi_info_set_stream(info, list->stream ? SND_RAWMIDI_STREAM_INPUT : SND_RAWMIDI_STREAM_OUTPUT);
 | 
			
		||||
			if (snd_ctl_rawmidi_info(list->ctl, info) < 0)
 | 
			
		||||
				return NULL;
 | 
			
		||||
			return strdup(snd_rawmidi_info_get_name(info));
 | 
			
		||||
				return 0;
 | 
			
		||||
			*res = strdup(snd_rawmidi_info_get_name(info));
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
	default:
 | 
			
		||||
		return NULL;
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -132,49 +138,60 @@ static char *get_dev_name(struct hint_list *list)
 | 
			
		|||
	
 | 
			
		||||
	list->device = list->device_input >= 0 ? list->device_input : list->device;
 | 
			
		||||
	list->stream = 1;
 | 
			
		||||
	str1 = get_dev_name1(list);
 | 
			
		||||
	if (get_dev_name1(list, &str1) < 0)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	list->device = list->device_output >= 0 ? list->device_input : list->device;
 | 
			
		||||
	list->stream = 0;
 | 
			
		||||
	str2 = get_dev_name1(list);
 | 
			
		||||
	if (get_dev_name1(list, &str2) < 0) {
 | 
			
		||||
		if (str1)
 | 
			
		||||
			free(str1);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	if (str1 != NULL || str2 != NULL) {
 | 
			
		||||
		if (str1 != NULL && str2 != NULL) {
 | 
			
		||||
			if (strcmp(str1, str2) == 0) {
 | 
			
		||||
				free(str1);
 | 
			
		||||
				return str2;
 | 
			
		||||
			}
 | 
			
		||||
			res = realloc(str2, strlen(str2) + strlen(str1) + 4);
 | 
			
		||||
			if (res != NULL) {
 | 
			
		||||
				strcat(res, " / ");
 | 
			
		||||
				strcat(res, str1);
 | 
			
		||||
				free(str1);
 | 
			
		||||
				return res;
 | 
			
		||||
				res = malloc(strlen(list->longname) + strlen(str2) + 3);
 | 
			
		||||
				if (res != NULL) {
 | 
			
		||||
					strcpy(res, list->longname);
 | 
			
		||||
					strcat(res, ", ");
 | 
			
		||||
					strcat(res, str2);
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				free(str2);
 | 
			
		||||
				free(str1);
 | 
			
		||||
				res = malloc(strlen(list->longname) + strlen(str2) + strlen(str1) + 6);
 | 
			
		||||
				if (res != NULL) {
 | 
			
		||||
					strcpy(res, list->longname);
 | 
			
		||||
					strcat(res, ", ");
 | 
			
		||||
					strcat(res, str2);
 | 
			
		||||
					strcat(res, " / ");
 | 
			
		||||
					strcat(res, str1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			free(str2);
 | 
			
		||||
			free(str1);
 | 
			
		||||
			return res;
 | 
			
		||||
		} else {
 | 
			
		||||
			if (str1 != NULL) {
 | 
			
		||||
				res = realloc(str1, strlen(str1) + 16);
 | 
			
		||||
				if (res == NULL) {
 | 
			
		||||
					free(str1);
 | 
			
		||||
					return NULL;
 | 
			
		||||
				}
 | 
			
		||||
				strcat(res, " {");
 | 
			
		||||
				strcat(res, list->iface == SND_CTL_ELEM_IFACE_PCM ? "Capture" : "Input");
 | 
			
		||||
				strcat(res, "}");
 | 
			
		||||
				return res;
 | 
			
		||||
				str2 = list->iface == SND_CTL_ELEM_IFACE_PCM ? "Capture" : "Input";
 | 
			
		||||
			} else {
 | 
			
		||||
				res = realloc(str2, strlen(str2) + 16);
 | 
			
		||||
				if (res == NULL) {
 | 
			
		||||
					free(str2);
 | 
			
		||||
					return NULL;
 | 
			
		||||
				}
 | 
			
		||||
				strcat(res, " {");
 | 
			
		||||
				strcat(res, list->iface == SND_CTL_ELEM_IFACE_PCM ? "Playback" : "Output");
 | 
			
		||||
				strcat(res, "}");
 | 
			
		||||
				return res;
 | 
			
		||||
				str1 = str2;
 | 
			
		||||
				str2 = list->iface == SND_CTL_ELEM_IFACE_PCM ? "Playback" : "Output";
 | 
			
		||||
			}
 | 
			
		||||
			res = malloc(strlen(list->longname) + strlen(str1) + 19);
 | 
			
		||||
			if (res == NULL) {
 | 
			
		||||
				free(str1);
 | 
			
		||||
				return NULL;
 | 
			
		||||
			}
 | 
			
		||||
			strcpy(res, list->longname);
 | 
			
		||||
			strcat(res, ", ");
 | 
			
		||||
			strcat(res, str1);
 | 
			
		||||
			strcat(res, " {");
 | 
			
		||||
			strcat(res, list->iface == SND_CTL_ELEM_IFACE_PCM ? "Capture" : "Input");
 | 
			
		||||
			strcat(res, "}");
 | 
			
		||||
			free(str1);
 | 
			
		||||
			return res;
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		return strdup(list->longname);
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -188,11 +205,11 @@ static int try_config(struct hint_list *list,
 | 
			
		|||
		      const char *name)
 | 
			
		||||
{
 | 
			
		||||
	snd_lib_error_handler_t eh;
 | 
			
		||||
	snd_config_t *res, *cfg, *n;
 | 
			
		||||
	snd_config_t *res = NULL, *cfg, *n;
 | 
			
		||||
	snd_config_iterator_t i, next;
 | 
			
		||||
	char *buf, *buf1 = NULL, *buf2;
 | 
			
		||||
	const char *str;
 | 
			
		||||
	int err;
 | 
			
		||||
	int err = 0, level;
 | 
			
		||||
	long dev = list->device;
 | 
			
		||||
 | 
			
		||||
	list->device_input = -1;
 | 
			
		||||
| 
						 | 
				
			
			@ -200,6 +217,13 @@ static int try_config(struct hint_list *list,
 | 
			
		|||
	buf = malloc(BUF_SIZE);
 | 
			
		||||
	if (buf == NULL)
 | 
			
		||||
		return -ENOMEM;
 | 
			
		||||
	sprintf(buf, "%s.%s", base, name);
 | 
			
		||||
	/* look for redirection */
 | 
			
		||||
	if (snd_config_search(snd_config, buf, &cfg) >= 0 &&
 | 
			
		||||
	    snd_config_get_string(cfg, &str) >= 0 &&
 | 
			
		||||
	    ((strncmp(base, str, strlen(base)) == 0 &&
 | 
			
		||||
	     str[strlen(base)] == '.') || strchr(str, '.') == NULL))
 | 
			
		||||
	     	goto __skip_add;
 | 
			
		||||
	if (list->card >= 0 && list->device >= 0)
 | 
			
		||||
		sprintf(buf, "%s:CARD=%s,DEV=%i", name, snd_ctl_card_info_get_id(list->info), list->device);
 | 
			
		||||
	else if (list->card >= 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -211,52 +235,13 @@ static int try_config(struct hint_list *list,
 | 
			
		|||
	err = snd_config_search_definition(snd_config, base, buf, &res);
 | 
			
		||||
	snd_lib_error_set_handler(eh);
 | 
			
		||||
	if (err < 0)
 | 
			
		||||
		return err;
 | 
			
		||||
		goto __skip_add;
 | 
			
		||||
	err = -EINVAL;
 | 
			
		||||
	if (snd_config_get_type(res) != SND_CONFIG_TYPE_COMPOUND)
 | 
			
		||||
		goto __cleanup;
 | 
			
		||||
	if (snd_config_search(res, "type", NULL) < 0)
 | 
			
		||||
		goto __cleanup;
 | 
			
		||||
	cfg = res;
 | 
			
		||||
      __hint:
 | 
			
		||||
	if (snd_config_search(cfg, "hint", &cfg) >= 0) {
 | 
			
		||||
		if (snd_config_get_type(cfg) == SND_CONFIG_TYPE_COMPOUND) {
 | 
			
		||||
			if (snd_config_search(cfg, "description", &n) >= 0 &&
 | 
			
		||||
			    snd_config_get_string(n, &str) >= 0) {
 | 
			
		||||
				buf1 = strdup(str);
 | 
			
		||||
				if (buf1 == NULL) {
 | 
			
		||||
					err = -ENOMEM;
 | 
			
		||||
					goto __cleanup;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (snd_config_search(cfg, "device", &n) >= 0) {
 | 
			
		||||
				if (snd_config_get_integer(n, &dev) < 0) {
 | 
			
		||||
					err = -EINVAL;
 | 
			
		||||
					goto __cleanup;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (snd_config_search(cfg, "device_input", &n) >= 0) {
 | 
			
		||||
				if (snd_config_get_integer(n, &list->device_input) < 0) {
 | 
			
		||||
					err = -EINVAL;
 | 
			
		||||
					goto __cleanup;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (snd_config_search(cfg, "device_output", &n) >= 0) {
 | 
			
		||||
				if (snd_config_get_integer(n, &list->device_output) < 0) {
 | 
			
		||||
					err = -EINVAL;
 | 
			
		||||
					goto __cleanup;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		} else if (snd_config_get_bool(cfg) == 0) {
 | 
			
		||||
			err = -EXDEV;
 | 
			
		||||
			goto __cleanup;
 | 
			
		||||
		}
 | 
			
		||||
		goto __hint_ok;
 | 
			
		||||
	}
 | 
			
		||||
	if (snd_config_search(cfg, "slave", &cfg) >= 0 &&
 | 
			
		||||
	    snd_config_search(cfg, base, &cfg) >= 0)
 | 
			
		||||
	    	goto __hint;
 | 
			
		||||
      __hint_ok:
 | 
			
		||||
 | 
			
		||||
#if 0	/* for debug purposes */
 | 
			
		||||
		{
 | 
			
		||||
			snd_output_t *out;
 | 
			
		||||
| 
						 | 
				
			
			@ -264,9 +249,62 @@ static int try_config(struct hint_list *list,
 | 
			
		|||
			snd_output_stdio_attach(&out, stderr, 0);
 | 
			
		||||
			snd_config_save(res, out);
 | 
			
		||||
			snd_output_close(out);
 | 
			
		||||
			printf("\n");
 | 
			
		||||
			fprintf(stderr, "\n");
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	cfg = res;
 | 
			
		||||
	level = 0;
 | 
			
		||||
      __hint:
 | 
			
		||||
      	level++;
 | 
			
		||||
	if (snd_config_search(cfg, "hint", &cfg) >= 0) {
 | 
			
		||||
		if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
 | 
			
		||||
			SNDERR("hint (%s) must be a compound", buf);
 | 
			
		||||
			err = -EINVAL;
 | 
			
		||||
			goto __cleanup;
 | 
			
		||||
		}
 | 
			
		||||
		if (level == 1 &&
 | 
			
		||||
		    snd_config_search(cfg, "show", &n) >= 0 &&
 | 
			
		||||
		    snd_config_get_bool(n) <= 0)
 | 
			
		||||
		    	goto __skip_add;
 | 
			
		||||
		if (buf1 == NULL &&
 | 
			
		||||
		    snd_config_search(cfg, "description", &n) >= 0 &&
 | 
			
		||||
		    snd_config_get_string(n, &str) >= 0) {
 | 
			
		||||
			buf1 = strdup(str);
 | 
			
		||||
			if (buf1 == NULL) {
 | 
			
		||||
				err = -ENOMEM;
 | 
			
		||||
				goto __cleanup;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (snd_config_search(cfg, "device", &n) >= 0) {
 | 
			
		||||
			if (snd_config_get_integer(n, &dev) < 0) {
 | 
			
		||||
				SNDERR("(%s) device must be an integer", buf);
 | 
			
		||||
				err = -EINVAL;
 | 
			
		||||
				goto __cleanup;
 | 
			
		||||
			}
 | 
			
		||||
			list->device_input = -1;
 | 
			
		||||
			list->device_output = -1;
 | 
			
		||||
		}
 | 
			
		||||
		if (snd_config_search(cfg, "device_input", &n) >= 0) {
 | 
			
		||||
			if (snd_config_get_integer(n, &list->device_input) < 0) {
 | 
			
		||||
				SNDERR("(%s) device_input must be an integer", buf);
 | 
			
		||||
				err = -EINVAL;
 | 
			
		||||
				goto __cleanup;
 | 
			
		||||
			}
 | 
			
		||||
			list->device_output = -1;
 | 
			
		||||
		}
 | 
			
		||||
		if (snd_config_search(cfg, "device_output", &n) >= 0) {
 | 
			
		||||
			if (snd_config_get_integer(n, &list->device_output) < 0) {
 | 
			
		||||
				SNDERR("(%s) device_output must be an integer", buf);
 | 
			
		||||
				err = -EINVAL;
 | 
			
		||||
				goto __cleanup;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else if (level == 1 && !list->show_all)
 | 
			
		||||
		goto __skip_add;
 | 
			
		||||
	if (snd_config_search(cfg, "slave", &cfg) >= 0 &&
 | 
			
		||||
	    snd_config_search(cfg, base, &cfg) >= 0)
 | 
			
		||||
	    	goto __hint;
 | 
			
		||||
	snd_config_delete(res);
 | 
			
		||||
	res = NULL;
 | 
			
		||||
	if (strchr(buf, ':') != NULL)
 | 
			
		||||
| 
						 | 
				
			
			@ -291,16 +329,14 @@ static int try_config(struct hint_list *list,
 | 
			
		|||
      __ok:
 | 
			
		||||
	err = 0;
 | 
			
		||||
      __cleanup:
 | 
			
		||||
      	if (res)
 | 
			
		||||
	      	snd_config_delete(res);
 | 
			
		||||
      	if (err >= 0) {
 | 
			
		||||
      		list->device = dev;
 | 
			
		||||
 		str = get_dev_name(list);
 | 
			
		||||
 		str = list->card >= 0 ? get_dev_name(list) : NULL;
 | 
			
		||||
      		if (str != NULL) {
 | 
			
		||||
      			buf2 = realloc((char *)str, (buf1 == NULL ? 0 : strlen(buf1)) + 2 + strlen(str) + 1);
 | 
			
		||||
      			buf2 = realloc((char *)str, (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str) + 1);
 | 
			
		||||
      			if (buf2 != NULL) {
 | 
			
		||||
      				if (buf1 != NULL) {
 | 
			
		||||
	      				strcat(buf2, ": ");
 | 
			
		||||
	      				strcat(buf2, "\n");
 | 
			
		||||
	      				strcat(buf2, buf1);
 | 
			
		||||
					free(buf1);
 | 
			
		||||
				}
 | 
			
		||||
| 
						 | 
				
			
			@ -313,6 +349,8 @@ static int try_config(struct hint_list *list,
 | 
			
		|||
	      	err = hint_list_add(list, buf, buf1);
 | 
			
		||||
	}
 | 
			
		||||
      __skip_add:
 | 
			
		||||
      	if (res)
 | 
			
		||||
	      	snd_config_delete(res);
 | 
			
		||||
	if (buf1)
 | 
			
		||||
		free(buf1);
 | 
			
		||||
      	free(buf);
 | 
			
		||||
| 
						 | 
				
			
			@ -348,8 +386,6 @@ static int add_card(struct hint_list *list, int card, snd_ctl_elem_iface_t iface
 | 
			
		|||
	list->info = info;
 | 
			
		||||
	if (iface > SND_CTL_ELEM_IFACE_LAST)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
	if (snd_card_get_name(card, (char **)&str) < 0)
 | 
			
		||||
		return 0;
 | 
			
		||||
	base = snd_ctl_iface_conf_name(iface);
 | 
			
		||||
	err = snd_config_search(snd_config, base, &conf);
 | 
			
		||||
	if (err < 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -399,8 +435,7 @@ static int add_card(struct hint_list *list, int card, snd_ctl_elem_iface_t iface
 | 
			
		|||
	}
 | 
			
		||||
	err = 0;
 | 
			
		||||
      __error:
 | 
			
		||||
      	if (err < 0)
 | 
			
		||||
      		snd_ctl_close(list->ctl);
 | 
			
		||||
      	snd_ctl_close(list->ctl);
 | 
			
		||||
	return err;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -421,6 +456,9 @@ static int add_card(struct hint_list *list, int card, snd_ctl_elem_iface_t iface
 | 
			
		|||
 *   myplug "plug:front:Do all conversions for front speakers"<br>
 | 
			
		||||
 * }
 | 
			
		||||
 * </code>
 | 
			
		||||
 *
 | 
			
		||||
 * Special variables: defaults.namehint.showall specifies if all device
 | 
			
		||||
 * definitions are accepted (boolean type).
 | 
			
		||||
 */
 | 
			
		||||
int snd_device_name_hint(int card, snd_ctl_elem_iface_t iface, char ***hints)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -439,6 +477,10 @@ int snd_device_name_hint(int card, snd_ctl_elem_iface_t iface, char ***hints)
 | 
			
		|||
	list.list = NULL;
 | 
			
		||||
	list.count = list.allocated = 0;
 | 
			
		||||
	list.iface = iface;
 | 
			
		||||
	list.show_all = 0;
 | 
			
		||||
	list.longname = NULL;
 | 
			
		||||
	if (snd_config_search(snd_config, "defaults.namehint.showall", &conf) >= 0)
 | 
			
		||||
		list.show_all = snd_config_get_bool(conf) > 0;
 | 
			
		||||
	if (card >= 0) {
 | 
			
		||||
		err = add_card(&list, card, iface);
 | 
			
		||||
	} else {
 | 
			
		||||
| 
						 | 
				
			
			@ -446,6 +488,9 @@ int snd_device_name_hint(int card, snd_ctl_elem_iface_t iface, char ***hints)
 | 
			
		|||
		if (err < 0)
 | 
			
		||||
			goto __error;
 | 
			
		||||
		while (card >= 0) {
 | 
			
		||||
			err = snd_card_get_longname(card, &list.longname);
 | 
			
		||||
			if (err < 0)
 | 
			
		||||
				goto __error;
 | 
			
		||||
			err = add_card(&list, card, iface);
 | 
			
		||||
			if (err < 0)
 | 
			
		||||
				goto __error;
 | 
			
		||||
| 
						 | 
				
			
			@ -470,12 +515,16 @@ int snd_device_name_hint(int card, snd_ctl_elem_iface_t iface, char ***hints)
 | 
			
		|||
      __error:
 | 
			
		||||
      	if (err < 0) {
 | 
			
		||||
      		snd_device_name_free_hint(list.list);
 | 
			
		||||
      		if (list.longname)
 | 
			
		||||
	      		free(list.longname);
 | 
			
		||||
      		return err;
 | 
			
		||||
      	} else {
 | 
			
		||||
      		err = hint_list_add(&list, NULL, NULL);
 | 
			
		||||
      		if (err < 0)
 | 
			
		||||
      			goto __error;
 | 
			
		||||
      		*hints = list.list;
 | 
			
		||||
      		if (list.longname)
 | 
			
		||||
	      		free(list.longname);
 | 
			
		||||
	}
 | 
			
		||||
      	return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,6 +46,9 @@ endif
 | 
			
		|||
if BUILD_PCM_PLUGIN_NULL
 | 
			
		||||
libpcm_la_SOURCES += pcm_null.c
 | 
			
		||||
endif
 | 
			
		||||
if BUILD_PCM_PLUGIN_EMPTY
 | 
			
		||||
libpcm_la_SOURCES += pcm_empty.c
 | 
			
		||||
endif
 | 
			
		||||
if BUILD_PCM_PLUGIN_SHARE
 | 
			
		||||
libpcm_la_SOURCES += pcm_share.c
 | 
			
		||||
endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1983,7 +1983,7 @@ snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler)
 | 
			
		|||
 | 
			
		||||
static char *build_in_pcms[] = {
 | 
			
		||||
	"adpcm", "alaw", "copy", "dmix", "file", "hooks", "hw", "ladspa", "lfloat",
 | 
			
		||||
	"linear", "meter", "mulaw", "multi", "null", "plug", "rate", "route", "share",
 | 
			
		||||
	"linear", "meter", "mulaw", "multi", "null", "empty", "plug", "rate", "route", "share",
 | 
			
		||||
	"shm", "dsnoop", "dshare", "asym", "iec958", "softvol", NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue