After attaching an 18-in / 18-out device: ugen0.7: <BEHRINGER X18/XR18> at usbus0 uaudio0 on uhub0 uaudio0: <X18/XR18> on usbus0 uaudio0: Play[0]: 48000 Hz, 18 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Record[0]: 48000 Hz, 18 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: MIDI sequencer. pcm2: <USB audio> on uaudio0 uaudio0: No HID volume keys found. SNDCTL_AUDIOINFO reports min_channels = 2, max_channels = 2 pcm/dsp.c::dsp_oss_audioinfo() only reports 1 or 2 for min/max it appears: for (i = 0; caps->fmtlist[i]; i++) { fmts |= caps->fmtlist[i]; if (AFMT_CHANNEL(caps->fmtlist[i]) > 1) { minch = (minch == 0) ? 2 : minch; maxch = 2; } else { minch = 1; maxch = (maxch == 0) ? 1 : maxch; } }
FreeBSD OSS use stereo mode by default, unless you set "dev.pcm.<n>.play.vchanformat" and "dev.pcm.<n>.rec.vchanformat". If there is more than 8 channels, then only bitperfect mode is supported. Maybe the audioinfo could need an update in that regards. I think we support up to 127 channels, limited by AFMT. --HPS
Indeed, this attaches with bitperfect mode enabled dev.pcm.2.bitperfect: 1 The 2nd problem I encountered is Audacity's OSS support via PortAudio does not support beyond S16_NE. I will try (sometime) to have a look at improving audioinfo reporting in this case.
I've submitted a few pull requests to PortAudio related to the work that prompted this PR: https://github.com/PortAudio/portaudio/pull/448 https://github.com/PortAudio/portaudio/pull/449 https://github.com/PortAudio/portaudio/pull/450 with these applied as well as addition of cases for AFMT_S32_NE I can now record from the XR18 in 2 channel mode with bitperfect=1. Attempting to record in 18 channel mode results in a PA assertion: 21:42:13: Debug: GetBestRate() suggested rate 48000 Hz 21:42:13: Debug: GetBestRate() Returning 48000 Hz Assertion failed: (firstChannel + channelCount <= bp->inputChannelCount), function PaUtil_SetInterleavedInputChannels, file src/common/pa_process.c, line 482. Abort trap (core dumped)
Looks like PA OSS only tries up to 16 channels: https://github.com/PortAudio/portaudio/blob/master/src/hostapi/oss/pa_unix_oss.c#L358 /* Negotiate for the maximum number of channels for this device. PLB20010927 * Consider up to 16 as the upper number of channels. * Variable maxNumChannels should contain the actual upper limit after the call. * Thanks to John Lazzaro and Heiko Purnhagen for suggestions. */ maxNumChannels = 0; for( numChannels = 1; numChannels <= 16; numChannels++ ) {
That's not directly the cause of the assertion though, the values involved in the assertion expression: firstChannel=0 channelCount=18 bp->inputChannelCount=2
Any news here? --HPS
(In reply to Hans Petter Selasky from comment #1) I have a 20-in/18-out device and would like to use vchans. So far I only managed to use the audio interface with virtual_oss. Is anyone working on changing the limit from 8 to 127? uaudio0 on uhub4 uaudio0: <Audiofuse Studio> on usbus1 uaudio0: Play[0]: 192000 Hz, 18 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Play[0]: 176400 Hz, 18 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Play[0]: 96000 Hz, 18 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Play[0]: 88200 Hz, 18 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Play[0]: 48000 Hz, 18 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Play[0]: 44100 Hz, 18 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Record[0]: 192000 Hz, 20 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Record[0]: 176400 Hz, 20 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Record[0]: 96000 Hz, 20 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Record[0]: 88200 Hz, 20 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Record[0]: 48000 Hz, 20 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: Record[0]: 44100 Hz, 20 ch, 32-bit S-LE PCM format, 2x8ms buffer. uaudio0: MIDI sequencer. pcm4: <USB audio> on uaudio0
When there are more than 8 channels, vchannels are disabled and bitperfect is enabled. Then you have to use virtual_oss if your application does not support bitperfect. The vchannel limit of 8 channels was chosen because surround use 8 channels. --HPS
> Is anyone working on changing the limit from 8 to 127? Not as I'm aware of.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e07f9178502b7cbc0769fc10e99ad0d013f437fd commit e07f9178502b7cbc0769fc10e99ad0d013f437fd Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2024-05-23 00:57:04 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2024-05-23 00:57:04 +0000 sound: Separate implementations for SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO FreeBSD's implementation of SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO does not exactly work as intended. The problem is essentially that both IOCTLs return the same information, while in fact the information returned currently by dsp_oss_audioinfo() is what _only_ SNDCTL_ENGINEINFO is meant to return. This behavior is also noted in the OSS manual [1] (see bold paragraph in "Audio engines and device files" section), but since e8c0d15a64fa ("sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9)") we can actually fix this, because we now expose only a single device for each soundcard, and create the engines (channels) internally. SNDCTL_ENGINEINFO will now report info about all channels in a given device, and SNDCTL_AUDIOINFO[_EX] will only report information about /dev/dspX. To make this work, we also have to modify the SNDCTL_SYSINFO IOCTL to report the number of audio devices and audio engines correctly. While here, modernize the minimum and maximum channel counting in both SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO. Currently these IOCTLs will report only up to 2 channels, which is no longer the case. [1] http://manuals.opensound.com/developer/SNDCTL_AUDIOINFO.html PR: 246231, 252761 Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D45164 sys/dev/sound/pcm/dsp.c | 179 +++++++++++++++++++++++++++++++++++++++++----- sys/dev/sound/pcm/dsp.h | 3 +- sys/dev/sound/pcm/mixer.c | 8 ++- sys/dev/sound/pcm/sound.c | 8 +-- 4 files changed, 173 insertions(+), 25 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e8a80b4e50e8d992fe46a95509b37fc457288f93 commit e8a80b4e50e8d992fe46a95509b37fc457288f93 Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2024-05-23 00:57:04 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2024-05-25 19:30:26 +0000 sound: Separate implementations for SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO FreeBSD's implementation of SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO does not exactly work as intended. The problem is essentially that both IOCTLs return the same information, while in fact the information returned currently by dsp_oss_audioinfo() is what _only_ SNDCTL_ENGINEINFO is meant to return. This behavior is also noted in the OSS manual [1] (see bold paragraph in "Audio engines and device files" section), but since e8c0d15a64fa ("sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9)") we can actually fix this, because we now expose only a single device for each soundcard, and create the engines (channels) internally. SNDCTL_ENGINEINFO will now report info about all channels in a given device, and SNDCTL_AUDIOINFO[_EX] will only report information about /dev/dspX. To make this work, we also have to modify the SNDCTL_SYSINFO IOCTL to report the number of audio devices and audio engines correctly. While here, modernize the minimum and maximum channel counting in both SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO. Currently these IOCTLs will report only up to 2 channels, which is no longer the case. [1] http://manuals.opensound.com/developer/SNDCTL_AUDIOINFO.html PR: 246231, 252761 Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D45164 (cherry picked from commit e07f9178502b7cbc0769fc10e99ad0d013f437fd) sys/dev/sound/pcm/dsp.c | 179 +++++++++++++++++++++++++++++++++++++++++----- sys/dev/sound/pcm/dsp.h | 3 +- sys/dev/sound/pcm/mixer.c | 8 ++- sys/dev/sound/pcm/sound.c | 8 +-- 4 files changed, 173 insertions(+), 25 deletions(-)