git: a6ef377dc297 - main - sound: Retire OSSV4_EXPERIMENT

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 17 Nov 2026 15:44:35 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=a6ef377dc29760c43a189ade18cbccd2bdcd298a

commit a6ef377dc29760c43a189ade18cbccd2bdcd298a
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-11-17 15:43:00 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-11-17 15:43:00 +0000

    sound: Retire OSSV4_EXPERIMENT
    
    Added in 2006 (b611c801f0ac) but these stubs are still not implemented
    or specified by 4Front.
    
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D61671
---
 sys/dev/sound/pcm/buffer.c     |  28 ------
 sys/dev/sound/pcm/buffer.h     |   4 -
 sys/dev/sound/pcm/channel.c    |   9 --
 sys/dev/sound/pcm/channel.h    |   8 --
 sys/dev/sound/pcm/channel_if.m |  33 --------
 sys/dev/sound/pcm/dsp.c        | 187 -----------------------------------------
 sys/sys/soundcard.h            |  11 ---
 7 files changed, 280 deletions(-)

diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c
index 2b3021480700..d2cdfb13e32a 100644
--- a/sys/dev/sound/pcm/buffer.c
+++ b/sys/dev/sound/pcm/buffer.c
@@ -610,31 +610,3 @@ sndbuf_clearshadow(struct snd_dbuf *b)
 	if ((b->shadbuf != NULL) && (b->sl > 0))
 		memset(b->shadbuf, sndbuf_zerodata(b->fmt), b->sl);
 }
-
-#ifdef OSSV4_EXPERIMENT
-/**
- * @brief Return peak value from samples in buffer ready area.
- *
- * Peak ranges from 0-32767.  If channel is monaural, most significant 16
- * bits will be zero.  For now, only expects to work with 1-2 channel
- * buffers.
- *
- * @note  Currently only operates with linear PCM formats.
- *
- * @param b buffer to analyze
- * @param lpeak pointer to store left peak value
- * @param rpeak pointer to store right peak value
- */
-void
-sndbuf_getpeaks(struct snd_dbuf *b, int *lp, int *rp)
-{
-	uint32_t lpeak, rpeak;
-
-	lpeak = 0;
-	rpeak = 0;
-
-	/**
-	 * @todo fill this in later
-	 */
-}
-#endif
diff --git a/sys/dev/sound/pcm/buffer.h b/sys/dev/sound/pcm/buffer.h
index 4363a637bc34..bf0a41c84fd7 100644
--- a/sys/dev/sound/pcm/buffer.h
+++ b/sys/dev/sound/pcm/buffer.h
@@ -97,10 +97,6 @@ int sndbuf_acquire(struct snd_dbuf *b, uint8_t *from, unsigned int count);
 int sndbuf_dispose(struct snd_dbuf *b, uint8_t *to, unsigned int count);
 int sndbuf_feed(struct snd_dbuf *from, struct snd_dbuf *to, struct pcm_channel *channel, struct pcm_feeder *feeder, unsigned int count);
 
-#ifdef OSSV4_EXPERIMENT
-void sndbuf_getpeaks(struct snd_dbuf *b, int *lp, int *rp);
-#endif
-
 static inline uint32_t
 snd_xbytes(uint32_t v, uint32_t from, uint32_t to)
 {
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index c79761ccc22e..5d429240448b 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -2624,12 +2624,3 @@ chn_syncdestroy(struct pcm_channel *c)
 
 	return sg_id;
 }
-
-#ifdef OSSV4_EXPERIMENT
-int
-chn_getpeaks(struct pcm_channel *c, int *lpeak, int *rpeak)
-{
-	CHN_LOCKASSERT(c);
-	return CHANNEL_GETPEAKS(c->methods, c->devinfo, lpeak, rpeak);
-}
-#endif
diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h
index 12185628b11d..32508dab581d 100644
--- a/sys/dev/sound/pcm/channel.h
+++ b/sys/dev/sound/pcm/channel.h
@@ -143,10 +143,6 @@ struct pcm_channel {
 	 * container.
 	 */
 	struct pcmchan_syncmember *sm;
-#ifdef OSSV4_EXPERIMENT
-	uint16_t lpeak, rpeak;	/**< Peak value from 0-32767. */
-#endif
-
 	struct {
 		SLIST_HEAD(, pcm_channel) head;
 		SLIST_ENTRY(pcm_channel) link;
@@ -306,10 +302,6 @@ int chn_notify(struct pcm_channel *c, uint32_t flags);
 int chn_getrates(struct pcm_channel *c, int **rates);
 int chn_syncdestroy(struct pcm_channel *c);
 
-#ifdef OSSV4_EXPERIMENT
-int chn_getpeaks(struct pcm_channel *c, int *lpeak, int *rpeak);
-#endif
-
 #define CHN_LOCKOWNED(c)	mtx_owned(&(c)->lock)
 #define CHN_LOCK(c)		mtx_lock(&(c)->lock)
 #define CHN_UNLOCK(c)		mtx_unlock(&(c)->lock)
diff --git a/sys/dev/sound/pcm/channel_if.m b/sys/dev/sound/pcm/channel_if.m
index 1bf04a9bf33a..1248ddbe4a85 100644
--- a/sys/dev/sound/pcm/channel_if.m
+++ b/sys/dev/sound/pcm/channel_if.m
@@ -65,12 +65,6 @@ CODE {
 		return 0;
 	}
 
-	static int
-	channel_nogetpeaks(kobj_t obj, void *data, int *lpeak, int *rpeak)
-	{
-		return -1;
-	}
-
 	static int
 	channel_nogetrates(kobj_t obj, void *data, int **rates)
 	{
@@ -168,33 +162,6 @@ METHOD int notify {
 	uint32_t changed;
 } DEFAULT channel_nonotify;
 
-/**
- * @brief Retrieve channel peak values
- *
- * This function is intended to obtain peak volume values for samples
- * played/recorded on a channel.  Values are on a linear scale from 0 to
- * 32767.  If the channel is monaural, a single value should be recorded
- * in @c lpeak.
- *
- * If hardware support isn't available, the SNDCTL_DSP_GET[IO]PEAKS
- * operation should return EINVAL.  However, we may opt to provide
- * software support that the user may toggle via sysctl/mixext.
- *
- * @param obj	standard kobj object (usually @c channel->methods)
- * @param data	driver-specific data (usually @c channel->devinfo)
- * @param lpeak	pointer to store left peak level
- * @param rpeak	pointer to store right peak level
- *
- * @retval -1	Error; usually operation isn't supported.
- * @retval 0	success
- */
-METHOD int getpeaks {
-	kobj_t obj;
-	void *data;
-	int *lpeak;
-	int *rpeak;
-} DEFAULT channel_nogetpeaks;
-
 /**
  * @brief Retrieve discrete supported sample rates
  *
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 6fa00dbd3aa7..8f05139b3617 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -101,14 +101,6 @@ static int dsp_oss_cookedmode(struct pcm_channel *wrch, struct pcm_channel *rdch
 static int dsp_oss_getchnorder(struct pcm_channel *wrch, struct pcm_channel *rdch, unsigned long long *map);
 static int dsp_oss_setchnorder(struct pcm_channel *wrch, struct pcm_channel *rdch, unsigned long long *map);
 static int dsp_oss_getchannelmask(struct pcm_channel *wrch, struct pcm_channel *rdch, int *mask);
-#ifdef OSSV4_EXPERIMENT
-static int dsp_oss_getlabel(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_label_t *label);
-static int dsp_oss_setlabel(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_label_t *label);
-static int dsp_oss_getsong(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *song);
-static int dsp_oss_setsong(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *song);
-static int dsp_oss_setname(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *name);
-#endif
-
 static uint32_t
 dsp_clamp_fragments(uint32_t maxfrags, uint32_t fragsz, uint32_t maxsize)
 {
@@ -1790,52 +1782,6 @@ dsp_ioctl(struct cdev *i_dev, unsigned long cmd, caddr_t arg, int mode,
 	case SNDCTL_DSP_BIND_CHANNEL:		/* XXX what?!? */
 		ret = EINVAL;
 		break;
-#ifdef	OSSV4_EXPERIMENT
-	/*
-	 * XXX The following ioctls are not yet supported and just return
-	 * EINVAL.
-	 */
-	case SNDCTL_DSP_GETOPEAKS:
-	case SNDCTL_DSP_GETIPEAKS:
-		chn = (cmd == SNDCTL_DSP_GETOPEAKS) ? wrch : rdch;
-		if (chn == NULL)
-			ret = EINVAL;
-		else {
-			oss_peaks_t *op = (oss_peaks_t *)arg;
-			int lpeak, rpeak;
-
-			CHN_LOCK(chn);
-			ret = chn_getpeaks(chn, &lpeak, &rpeak);
-			if (ret == -1)
-				ret = EINVAL;
-			else {
-				(*op)[0] = lpeak;
-				(*op)[1] = rpeak;
-			}
-			CHN_UNLOCK(chn);
-		}
-		break;
-
-	/*
-	 * XXX Once implemented, revisit this for proper cv protection
-	 *     (if necessary).
-	 */
-	case SNDCTL_GETLABEL:
-		ret = dsp_oss_getlabel(wrch, rdch, (oss_label_t *)arg);
-		break;
-	case SNDCTL_SETLABEL:
-		ret = dsp_oss_setlabel(wrch, rdch, (oss_label_t *)arg);
-		break;
-	case SNDCTL_GETSONG:
-		ret = dsp_oss_getsong(wrch, rdch, (oss_longname_t *)arg);
-		break;
-	case SNDCTL_SETSONG:
-		ret = dsp_oss_setsong(wrch, rdch, (oss_longname_t *)arg);
-		break;
-	case SNDCTL_SETNAME:
-		ret = dsp_oss_setname(wrch, rdch, (oss_longname_t *)arg);
-		break;
-#endif	/* !OSSV4_EXPERIMENT */
 	case SNDCTL_DSP_MAPINBUF:
 	case SNDCTL_DSP_MAPOUTBUF:
 	case SNDCTL_DSP_SETSYNCRO:
@@ -3106,136 +3052,3 @@ dsp_kqfilter(struct cdev *dev, struct knote *kn)
 
 	return (err);
 }
-
-#ifdef OSSV4_EXPERIMENT
-/**
- * @brief Retrieve an audio device's label
- *
- * This is a handler for the @c SNDCTL_GETLABEL ioctl.
- *
- * See @c http://manuals.opensound.com/developer/SNDCTL_GETLABEL.html
- * for more details.
- *
- * From Hannu@4Front:  "For example ossxmix (just like some HW mixer
- * consoles) can show variable "labels" for certain controls. By default
- * the application name (say quake) is shown as the label but
- * applications may change the labels themselves."
- *
- * @note As the ioctl definition is still under construction, FreeBSD
- *	 does not currently support @c SNDCTL_GETLABEL.
- *
- * @param wrch	playback channel (optional; may be NULL)
- * @param rdch	recording channel (optional; may be NULL)
- * @param label	label gets copied here
- *
- * @retval EINVAL	Operation not yet supported.
- */
-static int
-dsp_oss_getlabel(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_label_t *label)
-{
-	return (EINVAL);
-}
-
-/**
- * @brief Specify an audio device's label
- *
- * This is a handler for the @c SNDCTL_SETLABEL ioctl.  Please see the
- * comments for @c dsp_oss_getlabel immediately above.
- *
- * See @c http://manuals.opensound.com/developer/SNDCTL_GETLABEL.html
- * for more details.
- *
- * @note As the ioctl definition is still under construction, FreeBSD
- *	 does not currently support SNDCTL_SETLABEL.
- *
- * @param wrch	playback channel (optional; may be NULL)
- * @param rdch	recording channel (optional; may be NULL)
- * @param label	label gets copied from here
- *
- * @retval EINVAL	Operation not yet supported.
- */
-static int
-dsp_oss_setlabel(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_label_t *label)
-{
-	return (EINVAL);
-}
-
-/**
- * @brief Retrieve name of currently played song
- *
- * This is a handler for the @c SNDCTL_GETSONG ioctl.  Audio players could
- * tell the system the name of the currently playing song, which would be
- * visible in @c /dev/sndstat.
- *
- * See @c http://manuals.opensound.com/developer/SNDCTL_GETSONG.html
- * for more details.
- *
- * @note As the ioctl definition is still under construction, FreeBSD
- *	 does not currently support SNDCTL_GETSONG.
- *
- * @param wrch	playback channel (optional; may be NULL)
- * @param rdch	recording channel (optional; may be NULL)
- * @param song	song name gets copied here
- *
- * @retval EINVAL	Operation not yet supported.
- */
-static int
-dsp_oss_getsong(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *song)
-{
-	return (EINVAL);
-}
-
-/**
- * @brief Retrieve name of currently played song
- *
- * This is a handler for the @c SNDCTL_SETSONG ioctl.  Audio players could
- * tell the system the name of the currently playing song, which would be
- * visible in @c /dev/sndstat.
- *
- * See @c http://manuals.opensound.com/developer/SNDCTL_SETSONG.html
- * for more details.
- *
- * @note As the ioctl definition is still under construction, FreeBSD
- *	 does not currently support SNDCTL_SETSONG.
- *
- * @param wrch	playback channel (optional; may be NULL)
- * @param rdch	recording channel (optional; may be NULL)
- * @param song	song name gets copied from here
- *
- * @retval EINVAL	Operation not yet supported.
- */
-static int
-dsp_oss_setsong(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *song)
-{
-	return (EINVAL);
-}
-
-/**
- * @brief Rename a device
- *
- * This is a handler for the @c SNDCTL_SETNAME ioctl.
- *
- * See @c http://manuals.opensound.com/developer/SNDCTL_SETNAME.html for
- * more details.
- *
- * From Hannu@4Front:  "This call is used to change the device name
- * reported in /dev/sndstat and ossinfo. So instead of  using some generic
- * 'OSS loopback audio (MIDI) driver' the device may be given a meaningfull
- * name depending on the current context (for example 'OSS virtual wave table
- * synth' or 'VoIP link to London')."
- *
- * @note As the ioctl definition is still under construction, FreeBSD
- *	 does not currently support SNDCTL_SETNAME.
- *
- * @param wrch	playback channel (optional; may be NULL)
- * @param rdch	recording channel (optional; may be NULL)
- * @param name	new device name gets copied from here
- *
- * @retval EINVAL	Operation not yet supported.
- */
-static int
-dsp_oss_setname(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *name)
-{
-	return (EINVAL);
-}
-#endif	/* !OSSV4_EXPERIMENT */
diff --git a/sys/sys/soundcard.h b/sys/sys/soundcard.h
index aab67532503e..adbb1c4215fb 100644
--- a/sys/sys/soundcard.h
+++ b/sys/sys/soundcard.h
@@ -1558,17 +1558,6 @@ void seqbuf_dump(void);	/* This function must be provided by programs */
  * @todo ask about maintaining __SIOWR vs. _IOWR ioctl cmd defines
  */
 
-/**
- * @note The @c OSSV4_EXPERIMENT macro is meant to wrap new development code
- * in the sound system relevant to adopting 4Front's OSSv4 specification.
- * Users should not enable this!  Really!
- */
-#if 0
-# define OSSV4_EXPERIMENT 1
-#else
-# undef OSSV4_EXPERIMENT
-#endif
-
 #ifdef SOUND_VERSION
 # undef SOUND_VERSION
 # define SOUND_VERSION	0x040000