Commit graph

98 commits

Author SHA1 Message Date
Christos Margiolis e3b94b375e mixer(8): Use mixer_get_path()
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45276
2024-05-23 02:57:43 +02:00
Christos Margiolis 0e80798518 mixer(8): Ignore mixer_open() failures for the -a option
The most likely reason mixer_open() will fail is because either the
device doesn't exist, or because it is disabled, so there is not reason
to kill the application. Instead, continue and print the rest of the
enabled mixers.

PR:		277615
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45151
2024-05-23 02:57:25 +02:00
Christos Margiolis 5daa7cf42f mixer(8): Use new mixer if we change the default unit
If we use the -d option to change the default unit, close the current
mixer and open the one we set as the default to avoid printing and
applying changes (if any) to the old one.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D43809
2024-02-12 13:00:05 +02:00
Christos Margiolis cc7479d7dc mixer(8): Improve mute and recsrc controls
The input options of "dev.mute" (+, -, ^) and "dev.recsrc" (+, -, ^, =)
are quite cryptic. Allow the input to also be an actual description of
what these options do.

+ -> add (recsrc)
- -> remove (recsrc)
^ -> toggle (recsrc, mute)
= -> set (recsrc)
0 -> off (mute)
1 -> on (mute)

Also, deprecate the use of the symbol options in the EXAMPLES section of
the man page, by using the new descriptive options.

In the future, we might want to get rid of the symbol options
altogether, but preserve backwards compatibility for now.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, imp
Differential Revision:	https://reviews.freebsd.org/D43796
2024-02-12 13:00:05 +02:00
Christos Margiolis 7bd14d09a9 mixer.8: Fix wrong sentence
246e0457d9 ("mixer.8: Add terse example
for increasing volume") mentions that the example changes the volume of
the "first mixer found", while the example shows how the change the
volume of the current mixer's "vol" device. Re-phrease sentence to
reflect the actual behavior of the command.

Also, improve the example by using the % operator, instead of hardcoding
0.05.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D43795
2024-02-12 13:00:05 +02:00
Christos Margiolis 75be886e58 mixer(8): Allow full PCM device names as input for the -d option
The -d option is a wrapper around hw.snd.default_unit. Currently
mixer(8) expects the option argument to be just the unit's number (e.g
pcm0 -> 0). To avoid confusion, allow full device names of the form
"pcmN" as well.

While here, improve the -d option's description in the man page.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, imp
Differential Revision:	https://reviews.freebsd.org/D43794
2024-02-12 13:00:05 +02:00
Christos Margiolis 09ba07011a mixer(8): Improve error messsages and warnings
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, imp
Differential Revision:	https://reviews.freebsd.org/D43793
2024-02-12 12:59:58 +02:00
Alexander Ziaee 246e0457d9 mixer.8: Add terse example for increasing volume
Reviewed by:	jhb
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1044
2024-01-12 14:55:36 -08:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Simon J. Gerraty d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Mark Johnston 5c2b216a1c mixer: Fix default_unit switching with mixers that have no devices
Apparently it's possible for a mixer to have no devices:

$ mixer -f /dev/mixer2
pcm2:mixer: <USB audio> at ? kld snd_uaudio (rec)
$

If this is the default sound device, an attempt to change the default
unit using mixer -d fails with a segfault because mod_dunit is called
with a NULL device pointer, which is dereferenced to get the parent
mixer.

ctl_dunit seems to be a dummy, i.e., we don't actually need it and can
simply pass the mixer to mod_dunit() directly.  This patch removes that
structure and associated indirection to fix the crash.

Reviewed by:	christos, hselasky
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38060
2023-01-16 08:02:54 -05:00
Kyle Evans 4014365e42 mixer: remove volume backwards compat, add % interpretation
The current situation is fairly confusing, where an integer is interpreted
as a percent until you slap a decimal on it and magically it becomes an
absolute value.

Let's have a flag day in 14.0 and remove this shim entirely.  Setting with
percent can still be useful, so allow a trailing '%' to indicate as such.
As a side effect, we tighten down the format allowed in the volume a little
bit by ensuring there's no trailing garbage after the value once it's
separated into left and right components.

Reviewed by:	christos, hselasky, pauamma_gundo.com (manpages)
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D35101
2022-06-17 22:50:58 -05:00
Hans Petter Selasky 95e96c00fd mixer.8: Document shorthand syntax for volume setting.
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34614
Sponsored by:		NVIDIA Networking
2022-03-20 20:21:07 +01:00
Hans Petter Selasky bde8460272 mixer.4 and mixer.8: Fix mandoc -Tlint errors.
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34603
Sponsored by:		NVIDIA Networking
2022-03-20 20:21:03 +01:00
Hans Petter Selasky f250ff5ff3 mixer(8): Improve shorthand volume parsing.
The initial patch had a bug where the full volume syntax, floating point values,
:, + and -, wasn't accepted.

While at it move some defines to enum's.

Fixes:			da3d4469ef
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34617
Sponsored by:		NVIDIA Networking
2022-03-20 20:19:16 +01:00
Hans Petter Selasky da3d4469ef mixer(8): Add shorthand syntax for setting the volume.
dev.volume=X[.X] can now also be written as dev=X[.X] .

Requested by:		hselasky@ and bsduck (FreeBSD forums)
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34612
Sponsored by:		NVIDIA Networking
2022-03-20 17:32:46 +01:00
Hans Petter Selasky 60bdfe9869 mixer(8): Remove [.volume] string from default printout.
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34591
Sponsored by:		NVIDIA Networking
2022-03-20 17:32:43 +01:00
Mateusz Piotrowski c36d04222d mixer .8: Clean up the manual page
- Use correct macros (e.g., Pa for paths, Ar for arguments, Cm for
  command modifiers).
- Pet igor and mandoc -Tlint (e.g., start sentences after a newline).
- Use Ta instead of a tab character in tables.
- Stylize all table headers with Sy consistency.
- Add a missing "vol" variant to the synopsis of "dev.volume".
- Sort dev.recsrc command modifiers consistency.
- Use "Bd -literal" for code blocks in the examples. "Bl -tag" is not
  the right macro for that.

Fixes:	903873ce15 Implement and use new mixer(3) library for FreeBSD.
2022-03-13 13:40:51 +01:00
Christos Margiolis ce74223a36 mixer: make .Dt tags uppercase
The document title should be uppercase in man pages.

Reviewed by:	imp, gbe
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D33027
2021-11-20 08:58:36 +01:00
Mateusz Piotrowski a3a82ed843 mixer.8: Document -h 2021-10-17 10:02:15 +02:00
Hans Petter Selasky aa92785a5b mixer(8): Add -h option to show usage.
Differential Revision:	https://reviews.freebsd.org/D32508
Submitted by:	christos@
Sponsored by:	NVIDIA Networking
2021-10-16 10:40:37 +02:00
Hans Petter Selasky 67829b6307 mixer(8): Print usage to standard error.
Differential Revision:	https://reviews.freebsd.org/D32507
Submitted by:	christos@
Sponsored by:	NVIDIA Networking
2021-10-15 15:56:37 +02:00
Hans Petter Selasky 63dcf7fda2 mixer(8): Fix mixer status line for /dev/dspX.vpY mixer devices.
In some cases when passing /dev/dspX.vpY as mixer devices, m->ci.longname and
m->ci.hw_info will be empty. Don't print any brackets and parentheses
in this case.

Differential Revision:	https://reviews.freebsd.org/D32500
Submitted by:	christos@
Sponsored by:	NVIDIA Networking
2021-10-15 11:13:29 +02:00
Hans Petter Selasky db6ba1e0c5 mixer(3) and mixer(8): Update manual pages.
- Use correct e-mail address.
- Set FreeBSD 14.0 as introduction for the updated mixer(8) utility.

Submitted by:	christos@
Differential Revision:	https://reviews.freebsd.org/D31636
Sponsored by:	NVIDIA Networking
2021-09-22 22:01:40 +02:00
Hans Petter Selasky 8fc722a572 mixer(8): Compile fix for when the "char" type is unsigned.
Differential Revision:	https://reviews.freebsd.org/D31636
Sponsored by:	NVIDIA Networking
2021-09-22 20:58:47 +02:00
Hans Petter Selasky 903873ce15 Implement and use new mixer(3) library for FreeBSD.
Wiki article: https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements
This project was part of Google Summer of Code 2021.

Submitted by:	christos@
Differential Revision:	https://reviews.freebsd.org/D31636
Sponsored by:	NVIDIA Networking
2021-09-22 19:43:56 +02:00
Luca Pizzamiglio 19bb4570ea mixer: call the cleanup function in a test
The set_empty_value test has a cleanup function, but is not called.
Fix it

Reviewed by:	0mp
Approved by:	kp
Differential Revision:	https://reviews.freebsd.org/D23498
2020-02-06 14:31:29 +00:00
Mateusz Piotrowski babc4e8145 mixer(8): Report an error if the passed value is an empty string
This patch fixes a bug that made the mixer command enter
an infinite loop when instructed to set the value of a device
to an empty string (e.g., `mixer vol ""`).

Additionally, some tests for mixer(8) are being added.

PR:		240039
Reviewed by:	hselasky, mav
Approved by:	src (hselasky, mav)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21409
2019-08-25 17:55:31 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Pedro F. Giffuni 2b223a01ef mixer(8): Prevent possible sscanf() overflow.
Fix %s buffer sizes in sscanf().

Obtained from:	DragonflyBSD (git dab952e2)
MFC after:	5 days
2017-04-29 19:12:44 +00:00
Conrad Meyer 02dc4f1751 mixer(8): Style: Tag no-return usage() as __dead2
Coverity really should have figured this out from the exit(3) call at the end
of the routine, but just make it explicit.

No functional change.

Reported by:	Coverity
CID:		1304866 (false positive double-close of 'baz')
Sponsored by:	EMC / Isilon Storage Division
2016-05-11 17:27:27 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin 01c2b8ac0d use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
John-Mark Gurney b2c696468c add Xref to sound(4)...
MFC after:	1 week
2014-06-02 22:58:00 +00:00
Simon J. Gerraty fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty 76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty 7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Marcel Moolenaar 7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Alexander Motin 19e79b284d Return proper error message if recording device is not specified.
MFC after:	1 week
2012-01-27 09:15:55 +00:00
Ed Schouten 4d4fda8051 Mark global functions and/or variables in mixer(8) static where possible.
This allows compilers and static analyzers to do more thorough analysis.
2011-11-06 19:02:13 +00:00
Ulrich Spörlein 0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Ulrich Spörlein 62486687ed mdoc: consistently spell our email addresses <foo@FreeBSD.org>
Reviewed by:	ru
2010-05-19 08:57:53 +00:00
Ed Schouten 71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
Jung-uk Kim f48a417b24 mixer(8) is WARNS=6 clean since 1.25.
Tested with:	'make universe'
2008-03-16 08:06:36 +00:00
Jung-uk Kim 57067fb903 Fix a typo. 2008-03-15 01:36:20 +00:00