According to SNDCTL_DSP_SETFMT documentation if the ioctl() succeeds the application must check if value was accepted. Unfortunately, our OSS implementation may return value that's not actually supported. http://manuals.opensound.com/developer/SNDCTL_DSP_SETFMT.html At least the following ports check requested format and would assume AFMT_FLOAT is accepted if built with sys/soundcard.h from opensound.com. devel/allegro-devel emulators/wine multimedia/audacious-plugins multimedia/mplayer multimedia/vlc Probably, only Linux accepts AFMT_FLOAT which means apps built with OSSv4 wouldn't work under linuxulator either. How-To-Repeat: # kern/21073, audio/oss $ ./dsp-record -b float Trying 8012 Hz 1 Channel float Format ioctl(SNDCTL_DSP_SETFMT) failed: Tried 16384, Got 16 # kern/21073, native $ ./dsp-record -b float | head -1 | vis -m Trying 8012 Hz 1 Channel float Format Recording 8012 Hz 1 Channel float Format =00=00=00=80=FF=FF=FF=7F=FA=FF=FF=7Fx=FF=FF=7F=E4=00=00=80=9B=FE=FF=7F # audio/oss $ ./test 0x00000010 # native $ ./test 0x00004000 $ cat test.c #include <sys/soundcard.h> #include <fcntl.h> #include <stdio.h> #ifndef AFMT_FLOAT #define AFMT_FLOAT 0x00004000 #endif int main() { int fd = open("/dev/dsp", O_RDWR, 0); int format = AFMT_FLOAT; if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) < 0) return 1; printf("%0#10x\n", format); return 0; }
batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Hi, AFMT_FLOAT is not defined for the in-kernel OSS. If there is enough bits left we can do that. Your AFMT_FLOAT definition is actually AFMT_U32_LE, which of-course is supported when using vchans: /usr/include/sys/soundcard.h:#define AFMT_U32_LE 0x00004000 /* Little endian unsigned 32-bit */ --HPS
We are out of bits in the AFMT field in FreeBSD. So AFMT_FLOAT cannot be defined! Assume that when AFMT_FLOAT is not defined, that it is not supported. Also OSS documentation marks this feature as "not recommended". Please edit the applications in question. Thank you! --HPS