Lines Matching +full:device +full:- +full:id
1 .\"-
2 .\" Copyright (c) 2021-2022 Christos Margiolis <christos@FreeBSD.org>
51 Mixer library (libmixer, -lmixer)
63 .Fn mixer_add_ctl "struct mix_dev *parent" "int id" "const char *name" \
71 .Fn mixer_get_ctl "struct mix_dev *d" "int id"
109 .Bd -literal
111 TAILQ_HEAD(mix_devhead, mix_dev) devs; /* device list */
112 struct mix_dev *dev; /* selected device */
139 .Bl -tag -width "f_default"
143 A pointer to the currently selected device.
144 The device is one of the elements in
164 Since each mixer device maps to a pcmX device,
166 is always equal to the number of that pcmX device.
167 For example, if the audio device's number is 0 (i.e pcm0), then
177 For example, if device 10 is supported, then the 10th bit in the mask will be
194 Bit mask containing the supported modes for this audio device.
201 .Ss Mixer device
202 Each mixer device stored in a mixer is described as follows:
203 .Bd -literal
206 char name[NAME_MAX]; /* device name (e.g "vol") */
207 int devno; /* device number */
223 .Bl -tag -width "parent_mixer"
225 Pointer to the mixer the device is attached to.
227 Device name given by the OSS API.
229 .Bd -ragged
235 Device's index in the SOUND_MIXER_NRDEVICES macro defined in
241 Left and right-ear volumes.
242 Although the OSS API stores volumes in integers from 0-100, \
243 we normalize them to 32-bit floating point numbers.
248 Number of user-defined mixer controls associated with the device.
250 A tail queue containing user-defined mixer controls.
252 .Ss User-defined mixer controls
253 Each mixer device can have user-defined controls.
255 .Bd -literal
257 struct mix_dev *parent_dev; /* parent device */
258 int id; /* control id */
267 .Bl -tag -width "parent_dev"
269 Pointer to the device the control is attached to.
270 .It Fa id
271 Control ID assigned by the caller.
273 a control the same ID in case the caller has to choose controls using their ID.
277 .Ar id ,
293 function to obtain a handle to the device, which is used as an argument \
302 is the number of the mixer device.
303 Each device maps to an actual
321 function frees resources and closes the mixer device.
329 functions select a mixer device, either by its number or by its name
333 Each time a new device is to be manipulated, one of the two functions has to be
338 function changes the volume of the selected mixer device.
342 device.
347 function modifies the mute of a selected device.
351 .Bl -tag -width MIX_TOGGLEMUTE -offset indent
353 Mute the device.
355 Unmute the device.
357 Toggle the device's mute (e.g mute if unmuted and unmute if muted).
362 function modifies a recording device.
363 The selected device has to be a recording device, otherwise the function will
368 .Bl -tag -width MIX_REMOVERECSRC -offset indent
370 Add device to the recording sources.
372 Remove device from the recording sources.
374 Set device as the only recording source.
376 Toggle device from the recording sources.
391 function returns the operating mode of the audio device the mixer belongs to.
393 .Bl -tag -width "MIX_MODE_MIXER" -offset indent
395 The audio device has a mixer.
397 The audio device supports playback.
399 The audio device supports recording.
413 function writes the path of the mixer device specified in the
418 can be either -1, in which case
425 macro checks if a device is actually a valid device for a given mixer.
431 macro checks if a device is muted.
435 macro checks if a device is a recording device.
439 macro checks if a device is a recording source.
443 macro normalizes a value to 32-bit floating point number.
454 function creates a control and attaches it to the device specified in the
468 functions removes a control from the device its attached to.
472 function searches for a control in the device specified in the
475 The search is done using the control's ID.
497 functions return 0 or positive values on success and -1 on failure.
503 functions return the selected device on success and NULL on failure.
509 .Ss Change the volume of a device
510 .Bd -literal
520 if ((m->dev = mixer_get_dev_byname(m, dev_name)) < 0)
521 err(1, "unknown device: %s", dev_name);
528 (void)mixer_close(m);
531 .Bd -literal
537 TAILQ_FOREACH(dp, &m->devs, devs) {
538 m->dev = dp; /* Select device. */
539 if (M_ISMUTE(m, dp->devno))
542 warn("cannot mute device: %s", dp->name);
545 (void)mixer_close(m);
548 .Bd -literal
558 TAILQ_FOREACH(dp, &m->devs, devs) {
559 if (M_ISRECSRC(m, dp->devno))
561 dp->name, dp->vol.left, dp->vol.right);
564 (void)mixer_close(m);
567 .Bd -literal