Home | History | Annotate | only in /src/usr.bin/audio
History log of /src/usr.bin/audio
RevisionDateAuthorComments
 1.2 30-Dec-2000  sommerfeld Let src/usr.bin build with recursive parallel make..
- add .WAIT and .NOTPARALLEL in a few places
- change ${MAKE} print-objdir to ${PRINTOBJDIR}
- convert other ad-hoc forms to use ${PRINTOBJDIR}
 1.1 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.5 14-Apr-2009  lukem Enable WARNS=4 by default for usr.bin, except for:
awk bdes checknr compile_et error gss hxtool kgetcred kinit
klist ldd less lex locale login m4 man menuc mk_cmds
mklocale msgc openssl rpcgen rpcinfo sdiff spell ssh
string2key telnet tn3270 verify_krb5_conf xlint
 1.4 15-Jan-2002  mrg branches: 1.4.44;
- WARNS=3 (from ross@netbsd.org)
- fix a bug in WAV conversions
 1.3 10-May-2001  windsor -g for debug, try without when done debugging
 1.2 30-Dec-2000  sommerfeld Let src/usr.bin build with recursive parallel make..
- add .WAIT and .NOTPARALLEL in a few places
- change ${MAKE} print-objdir to ${PRINTOBJDIR}
- convert other ad-hoc forms to use ${PRINTOBJDIR}
 1.1 26-Mar-1999  mrg branches: 1.1.10;
add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.1.10.1 15-May-2001  he Pull up revision 1.3 (requested by windsor):
Remove COPTS+=-g, we are no longer debugging.
 1.4.44.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.9 21-Jun-2015  mrg separate the 3 functions midirecord uses from libaudio.a into its own
file and link it directly, instead of having an (implicit) dependancy
on usr.bin/audio/common being built before usr.bin/midirecord is linked.
 1.8 03-May-2008  lukem Rename MKPRIVATELIB to LIBISPRIVATE, to make it clearer that this is
a variable that is used by in-tree Makefiles to control behaviour.
(MKsomevar variables are generally intended to be controlled by the end-user)
 1.7 23-May-2004  lukem branches: 1.7.26;
Use MKPRIVATELIB=yes instead of providing an empty libinstall:: target and
setting NOLINT, NOPIC, NOPROFILE (etc)
 1.6 13-Oct-2002  mrg inline the contents of auconv.c into auconv.h. this makes audiorecord(1)
slightly smaller (about 200 bytes on x86) and i would guess slightly faster.
 1.5 18-Sep-2002  lukem makefile delint. use NETBSDSRCDIR as appropriate
 1.4 15-Jan-2002  mrg for sun output files, if we have unsigned or little endian data, convert
it to signed big endian data. pull in a modified copy of the kernels'
auconv.[ch] to help with this (and remove some home grown code that did
some of the same things.)
 1.3 15-Jan-2002  mrg - add rudimentary "wav" recording support: don't think it copes with
big-endian systems properly yet -- need to add RIFX support or swap
samples while writing. more on this coming soon.

- new "-F <format>" option for audiorecord. supported values of <format>
are "sun", "wav" and "none", plus a few aliases.

- split sun & wav support out into their own files.

- don't assume that WAV header elements are properly aligned for the
type of data they hold.

XXX: still need to clean up libaudio interfaces a lot.
 1.2 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.1 26-Mar-1999  mrg branches: 1.1.10;
add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.1.10.1 29-Jan-2002  he Pull up revisions 1.3-1.4 (via patch, requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.7.26.1 18-May-2008  yamt sync with head.
 1.2 13-Oct-2002  mrg inline the contents of auconv.c into auconv.h. this makes audiorecord(1)
slightly smaller (about 200 bytes on x86) and i would guess slightly faster.
 1.1 15-Jan-2002  mrg branches: 1.1.2;
for sun output files, if we have unsigned or little endian data, convert
it to signed big endian data. pull in a modified copy of the kernels'
auconv.[ch] to help with this (and remove some home grown code that did
some of the same things.)
 1.1.2.2 29-Jan-2002  he Pull up revision 1.1 (requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.1.2.1 15-Jan-2002  he file auconv.c was added on branch netbsd-1-5 on 2002-01-29 23:09:33 +0000
 1.6 15-Apr-2023  mlelstv Add support for recording 24bit wav files.
 1.5 28-Apr-2008  martin branches: 1.5.54; 1.5.64; 1.5.72;
Remove clause 3 and 4 from TNF licenses
 1.4 24-Dec-2005  perry branches: 1.4.20;
__inline__ -> inline
 1.3 19-Jul-2004  mycroft Fix fencepost errors in the conversion functions (making them a bit more like
the kernel versions).
 1.2 13-Oct-2002  mrg branches: 1.2.2;
inline the contents of auconv.c into auconv.h. this makes audiorecord(1)
slightly smaller (about 200 bytes on x86) and i would guess slightly faster.
 1.1 15-Jan-2002  mrg branches: 1.1.2;
for sun output files, if we have unsigned or little endian data, convert
it to signed big endian data. pull in a modified copy of the kernels'
auconv.[ch] to help with this (and remove some home grown code that did
some of the same things.)
 1.1.2.2 29-Jan-2002  he Pull up revision 1.1 (requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.1.2.1 15-Jan-2002  he file auconv.h was added on branch netbsd-1-5 on 2002-01-29 23:09:33 +0000
 1.2.2.1 23-Jul-2004  tron Pull up revision 1.3 (requested by mycroft in ticket #690):
Fix fencepost errors in the conversion functions (making them a bit more like
the kernel versions).
 1.4.20.1 18-May-2008  yamt sync with head.
 1.5.72.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
 1.5.64.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.5.54.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.27 27-Feb-2024  gson Clean up lines containing only tabs.
 1.26 09-Nov-2019  mrg branches: 1.26.8;
add support for playing IEEE float32 and float64 RIFF WAVE
samples on platforms that have these types natively, and
can handle signed linear 32 bit samples. explicitly
disabled on vax, run-or-compile-time sizeof() check
disabled for everyone else

now i can play a float32 .wav file i found.
float64 not tested.

copyright maint, update HISTORY, update audio drivers list.
 1.25 05-Aug-2015  mrg branches: 1.25.8; 1.25.16; 1.25.18;
rename struct write_info as struct track_info, and the variable name 'wi'
as 'ti', as this info is useful for reading as well.
 1.24 21-Jun-2015  mrg separate the 3 functions midirecord uses from libaudio.a into its own
file and link it directly, instead of having an (implicit) dependancy
on usr.bin/audio/common being built before usr.bin/midirecord is linked.
 1.23 30-Dec-2014  mrg add a decode_uint() function.
 1.22 30-Aug-2013  mrg branches: 1.22.4;
move most of the header writing code from record.c into wav.c and sun.c.

introduce a struct write_info for communication between front ends and
backends.

libaudio API is still pretty ugly, and needs to stay local here for now,
but it is a little more usable for other tools now.
 1.21 06-Sep-2011  jmcneill branches: 1.21.2; 1.21.8;
recognize AUDIO_ENCODING_AC3
 1.20 28-Aug-2011  joerg ANSIfy. Add static. Add __dead.
 1.19 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.18 30-Oct-2004  dsl branches: 1.18.26; 1.18.28;
Add (unsigned char) cast to ctype functions
 1.17 23-Jun-2003  agc Add NetBSD RCS Ids.
 1.16 27-Dec-2002  mrg - decode_int(): always use base 10, so that a time of "1:09" works.
- decode_time(): 60 seconds in a minute, really.
both from tsarna@netbsd.org.

- be verbose about the time we are going to record for, if verbose.
 1.15 15-Jan-2002  mrg - WARNS=3 (from ross@netbsd.org)
- fix a bug in WAV conversions
 1.14 15-Jan-2002  mrg - add rudimentary "wav" recording support: don't think it copes with
big-endian systems properly yet -- need to add RIFX support or swap
samples while writing. more on this coming soon.

- new "-F <format>" option for audiorecord. supported values of <format>
are "sun", "wav" and "none", plus a few aliases.

- split sun & wav support out into their own files.

- don't assume that WAV header elements are properly aligned for the
type of data they hold.

XXX: still need to clean up libaudio interfaces a lot.
 1.13 01-Jan-2002  mrg fix 2001/03/04 change: audio_parse_wav_hdr() returns a signed value.
 1.12 07-Jun-2001  mrg fix bug in audiorecord -t handling.
 1.11 04-Mar-2001  hubertf Don't play trailing garbage at end of RIFF WAVE (.wav) files
Patch sent by YAMAMOTO Takashi <takashi.yamamoto@bigfoot.com> in PR 12328
 1.10 13-Dec-2000  mrg libaudio:
- rename audio_get_sun_encoding() to audio_sun_to_encoding()
- add audio_encoding_to_sun()
play.c:
- adapt
record.c:
- convert NetBSD encoding to sun encoding if possible, otherwise don't
output a header at all.
fixes PR#10380 from Michael Eriksson <eramore@era-t.ericsson.se>.
 1.9 27-Sep-1999  mrg branches: 1.9.6;
fix off-by-one error in error message array. add a comment.
 1.8 13-Sep-1999  tron branches: 1.8.2;
Use "NULL" instead of "0" for null pointer.
 1.7 30-Mar-1999  mrg branches: 1.7.2;
remove duplicate include of <stdio.h>
 1.6 29-Mar-1999  mycroft Only 8-bit data is unsigned in WAVE files.
 1.5 29-Mar-1999  mrg .wav files are little endian.
 1.4 27-Mar-1999  mrg make recording precision/encoding setting sane.
 1.3 27-Mar-1999  mrg add support to play stdin.
 1.2 26-Mar-1999  mrg add missing copyrights.
 1.1 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.7.2.1 27-Sep-1999  cgd pull up rev 1.9 from trunk (requested by mrg):
Fix an off-by-one error in the error message array.
 1.8.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.6.2 29-Jan-2002  he Pull up revisions 1.10,1.12-1.15 (via patch, requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.9.6.1 11-Mar-2001  he Pull up revision 1.11 (via patch, requested by hubertf):
Do not play trailing garbage at the end of RIFF WAVE (.wav) files.
Fixes PR#12328.
 1.18.28.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.26.1 04-Jun-2008  yamt sync with head
 1.21.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.22.4.1 12-Jan-2015  martin Pull up following revision(s) (requested by mrg in ticket #409):
usr.bin/audio/common/audio.c: revision 1.23
usr.bin/audio/common/libaudio.h: revision 1.19
add a decode_uint() function.
 1.25.18.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.25.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.25.8.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.26.8.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
 1.2 27-Feb-2024  gson Clean up lines containing only tabs.
 1.1 21-Jun-2015  mrg branches: 1.1.8; 1.1.18; 1.1.26;
separate the 3 functions midirecord uses from libaudio.a into its own
file and link it directly, instead of having an (implicit) dependancy
on usr.bin/audio/common being built before usr.bin/midirecord is linked.
 1.1.26.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
 1.1.18.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.1.8.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.22 08-Mar-2024  mrg audio_wav_parse_hdr(): avoid buffer overreads and clean up

reimplement most of this function using a new method of buffer
management to ensure that we never read beyond the provided size.

properly handle RIFF chunk lengths, instead of assuming various
offsets from most files are right.

update list of consumed documentation and fill the list of WAVE
formats from RFC 2361 (most remain not supported.)

should fix PR#57973.

tested against a large number of .wav files i have handy and with
a testsuite generator that should be incoming soon.
 1.21 09-Nov-2019  mrg branches: 1.21.8;
add support for playing IEEE float32 and float64 RIFF WAVE
samples on platforms that have these types natively, and
can handle signed linear 32 bit samples. explicitly
disabled on vax, run-or-compile-time sizeof() check
disabled for everyone else

now i can play a float32 .wav file i found.
float64 not tested.

copyright maint, update HISTORY, update audio drivers list.
 1.20 05-Aug-2015  mrg branches: 1.20.8; 1.20.16; 1.20.18;
rename struct write_info as struct track_info, and the variable name 'wi'
as 'ti', as this info is useful for reading as well.
 1.19 30-Dec-2014  mrg add a decode_uint() function.
 1.18 30-Aug-2013  mrg branches: 1.18.4;
move most of the header writing code from record.c into wav.c and sun.c.

introduce a struct write_info for communication between front ends and
backends.

libaudio API is still pretty ugly, and needs to stay local here for now,
but it is a little more usable for other tools now.
 1.17 28-Aug-2011  joerg branches: 1.17.2; 1.17.8;
ANSIfy. Add static. Add __dead.
 1.16 18-Jun-2009  mrg - add extended WAVE header support
- attempt to play a bunch more WAV files
 1.15 29-May-2008  mrg branches: 1.15.4; 1.15.10;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.14 11-May-2006  mrg branches: 1.14.20; 1.14.22;
variable signed/unsigned cleanup.
 1.13 01-Jul-2004  drochner put the __packed__ attribute close to the struct definition
(to appease gcc-3.4), and use the compiler-independant __packed
form for consistency
 1.12 21-Jan-2004  mrg apply the patch from PR#24127: make audio_wav_parse_hdr() take u_int *
parameters for encoding, precision, sample rate and channels.
 1.11 10-Feb-2002  mrg - add a AUDIO_FORMAT_DEFAULT. use it. don't change functionity.

- fix the function selection in sunau conversions.

- be more verbose when given -V. (hi lennart! :)
 1.10 15-Jan-2002  mrg - WARNS=3 (from ross@netbsd.org)
- fix a bug in WAV conversions
 1.9 15-Jan-2002  mrg - add rudimentary "wav" recording support: don't think it copes with
big-endian systems properly yet -- need to add RIFX support or swap
samples while writing. more on this coming soon.

- new "-F <format>" option for audiorecord. supported values of <format>
are "sun", "wav" and "none", plus a few aliases.

- split sun & wav support out into their own files.

- don't assume that WAV header elements are properly aligned for the
type of data they hold.

XXX: still need to clean up libaudio interfaces a lot.
 1.8 01-Jan-2002  mrg fix 2001/03/04 change: audio_parse_wav_hdr() returns a signed value.
 1.7 04-Mar-2001  hubertf Don't play trailing garbage at end of RIFF WAVE (.wav) files
Patch sent by YAMAMOTO Takashi <takashi.yamamoto@bigfoot.com> in PR 12328
 1.6 22-Dec-2000  mrg de-__P()-ify
 1.5 13-Dec-2000  mrg libaudio:
- rename audio_get_sun_encoding() to audio_sun_to_encoding()
- add audio_encoding_to_sun()
play.c:
- adapt
record.c:
- convert NetBSD encoding to sun encoding if possible, otherwise don't
output a header at all.
fixes PR#10380 from Michael Eriksson <eramore@era-t.ericsson.se>.
 1.4 18-Jun-2000  mrg branches: 1.4.2;
remove unused crap.
 1.3 27-Mar-1999  mrg branches: 1.3.8;
make recording precision/encoding setting sane.
 1.2 26-Mar-1999  mrg add missing copyrights.
 1.1 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.3.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.2.2 29-Jan-2002  he Pull up revisions 1.5-1.6,1.8-1.10 (via patch, requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.4.2.1 11-Mar-2001  he Pull up revision 1.7 (via patch, requested by hubertf):
Do not play trailing garbage at the end of RIFF WAVE (.wav) files.
Fixes PR#12328.
 1.14.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.14.20.1 04-Jun-2008  yamt sync with head
 1.15.10.1 21-Apr-2010  matt sync to netbsd-5
 1.15.4.1 23-Jun-2009  snj Pull up following revision(s) (requested by mrg in ticket #825):
usr.bin/audio/common/libaudio.h: revision 1.16
usr.bin/audio/common/wav.c: revision 1.9
- - add extended WAVE header support
- - attempt to play a bunch more WAV files
 1.17.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.18.4.1 12-Jan-2015  martin Pull up following revision(s) (requested by mrg in ticket #409):
usr.bin/audio/common/audio.c: revision 1.23
usr.bin/audio/common/libaudio.h: revision 1.19
add a decode_uint() function.
 1.20.18.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.20.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.20.8.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.21.8.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
 1.11 27-Feb-2024  gson Clean up lines containing only tabs.
 1.10 09-Nov-2019  mrg branches: 1.10.8;
add support for playing IEEE float32 and float64 RIFF WAVE
samples on platforms that have these types natively, and
can handle signed linear 32 bit samples. explicitly
disabled on vax, run-or-compile-time sizeof() check
disabled for everyone else

now i can play a float32 .wav file i found.
float64 not tested.

copyright maint, update HISTORY, update audio drivers list.
 1.9 05-Aug-2015  mrg branches: 1.9.8; 1.9.16; 1.9.18;
rename struct write_info as struct track_info, and the variable name 'wi'
as 'ti', as this info is useful for reading as well.
 1.8 30-Aug-2013  mrg move most of the header writing code from record.c into wav.c and sun.c.

introduce a struct write_info for communication between front ends and
backends.

libaudio API is still pretty ugly, and needs to stay local here for now,
but it is a little more usable for other tools now.
 1.7 28-Aug-2011  joerg branches: 1.7.2; 1.7.8;
ANSIfy. Add static. Add __dead.
 1.6 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.5 22-Oct-2006  christos branches: 1.5.16; 1.5.18;
missing initializers.
 1.4 11-May-2006  mrg variable signed/unsigned cleanup.
 1.3 23-Jun-2003  agc Add NetBSD RCS Ids.
 1.2 15-Jan-2002  mrg branches: 1.2.2;
sun linear encodings are *signed*
 1.1 15-Jan-2002  mrg - add rudimentary "wav" recording support: don't think it copes with
big-endian systems properly yet -- need to add RIFX support or swap
samples while writing. more on this coming soon.

- new "-F <format>" option for audiorecord. supported values of <format>
are "sun", "wav" and "none", plus a few aliases.

- split sun & wav support out into their own files.

- don't assume that WAV header elements are properly aligned for the
type of data they hold.

XXX: still need to clean up libaudio interfaces a lot.
 1.2.2.2 29-Jan-2002  he Pull up revisions 1.1-1.2 (new, requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.2.2.1 15-Jan-2002  he file sun.c was added on branch netbsd-1-5 on 2002-01-29 23:09:55 +0000
 1.5.18.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.5.16.1 04-Jun-2008  yamt sync with head
 1.7.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.18.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.9.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9.8.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.10.8.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
 1.24 20-Mar-2024  mrg audio_wav_parse_hdr: handle zero-length data files again

the previous clean up turns zero-length data into no data and thus
an error, instead of simply doing nothing. noted by gson.
 1.23 14-Mar-2024  mrg fix some sizeof() confusion.

using "const char search[4]" as a function parameter means that
"search" is actually a pointer type so "sizeof search" returns
8 on 64-bit platforms. i mis-read this and used "sizeof *search"
which is always 1, noted by rillig.

instead of trying to avoid writing "4" twice, put it in a define
and use that in various places instead. annoying.
 1.22 12-Mar-2024  mrg audioplay(1): handle mis-aligned RIFF chunks.

put the code to find RIFF chunks into a new find_riff_chunk() function,
and handle mis-aligned chunk lengths. can now play files with chunks
that say they are 7 bytes long, and have 1 byte padding.

add some -V -V extra-verbose for the wav parser.
 1.21 11-Mar-2024  mrg minor clean up in the RIFF/WAVE header checking.

use memcmp() not strncmp() to check for "RIFF" and "WAVE".
avoid endian convesion on part.len 3 times.
 1.20 11-Mar-2024  mrg be sure to byte swap ext.len when checking/printing it.

noted by rillig@.
 1.19 08-Mar-2024  mrg audio_wav_parse_hdr(): avoid buffer overreads and clean up

reimplement most of this function using a new method of buffer
management to ensure that we never read beyond the provided size.

properly handle RIFF chunk lengths, instead of assuming various
offsets from most files are right.

update list of consumed documentation and fill the list of WAVE
formats from RFC 2361 (most remain not supported.)

should fix PR#57973.

tested against a large number of .wav files i have handy and with
a testsuite generator that should be incoming soon.
 1.18 27-Feb-2024  gson Clean up lines containing only tabs.
 1.17 27-Feb-2024  gson Clean up lines containing only spaces.
 1.16 15-Apr-2023  mlelstv Add support for recording 24bit wav files.
 1.15 09-Nov-2019  mrg branches: 1.15.8;
add support for playing IEEE float32 and float64 RIFF WAVE
samples on platforms that have these types natively, and
can handle signed linear 32 bit samples. explicitly
disabled on vax, run-or-compile-time sizeof() check
disabled for everyone else

now i can play a float32 .wav file i found.
float64 not tested.

copyright maint, update HISTORY, update audio drivers list.
 1.14 25-Nov-2017  jdolecek branches: 1.14.4; 1.14.6;
need getle16() for ext.sub_tag too

PR bin/52762 by Yosuke Sugahara
 1.13 05-Aug-2015  mrg branches: 1.13.8;
rename struct write_info as struct track_info, and the variable name 'wi'
as 'ti', as this info is useful for reading as well.
 1.12 18-Oct-2013  christos fix unused variable warnings
 1.11 30-Aug-2013  mrg move most of the header writing code from record.c into wav.c and sun.c.

introduce a struct write_info for communication between front ends and
backends.

libaudio API is still pretty ugly, and needs to stay local here for now,
but it is a little more usable for other tools now.
 1.10 28-Aug-2011  joerg branches: 1.10.2; 1.10.8;
ANSIfy. Add static. Add __dead.
 1.9 18-Jun-2009  mrg - add extended WAVE header support
- attempt to play a bunch more WAV files
 1.8 29-May-2008  mrg branches: 1.8.4; 1.8.10;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.7 21-Jan-2004  mrg branches: 1.7.32; 1.7.34;
apply the patch from PR#24127: make audio_wav_parse_hdr() take u_int *
parameters for encoding, precision, sample rate and channels.
 1.6 23-Jun-2003  agc Add NetBSD RCS Ids.
 1.5 06-Apr-2003  wiz Respect the law: Use A-law and mu-law as spellings as far as easily possible.
Inspired by Igor Sobrado in PR 19680.
 1.4 08-Dec-2002  mrg remove some #if 0 debug code
 1.3 25-Jan-2002  mrg branches: 1.3.2;
add $NetBSD$
 1.2 15-Jan-2002  mrg - WARNS=3 (from ross@netbsd.org)
- fix a bug in WAV conversions
 1.1 15-Jan-2002  mrg - add rudimentary "wav" recording support: don't think it copes with
big-endian systems properly yet -- need to add RIFX support or swap
samples while writing. more on this coming soon.

- new "-F <format>" option for audiorecord. supported values of <format>
are "sun", "wav" and "none", plus a few aliases.

- split sun & wav support out into their own files.

- don't assume that WAV header elements are properly aligned for the
type of data they hold.

XXX: still need to clean up libaudio interfaces a lot.
 1.3.2.2 29-Jan-2002  he Pull up revisions 1.1-1.3 (new, requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.3.2.1 25-Jan-2002  he file wav.c was added on branch netbsd-1-5 on 2002-01-29 23:10:14 +0000
 1.7.34.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.7.32.1 04-Jun-2008  yamt sync with head
 1.8.10.1 21-Apr-2010  matt sync to netbsd-5
 1.8.4.1 23-Jun-2009  snj Pull up following revision(s) (requested by mrg in ticket #825):
usr.bin/audio/common/libaudio.h: revision 1.16
usr.bin/audio/common/wav.c: revision 1.9
- - add extended WAVE header support
- - attempt to play a bunch more WAV files
 1.10.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.8.3 25-Mar-2024  martin Pull up following revision(s) (requested by mrg in ticket #1950):

usr.bin/audio/common/wav.c: revision 1.24

audio_wav_parse_hdr: handle zero-length data files again
the previous clean up turns zero-length data into no data and thus
an error, instead of simply doing nothing. noted by gson.
 1.13.8.2 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.13.8.1 27-Nov-2017  martin Pull up following revision(s) (requested by jdolecek in ticket #395):
usr.bin/audio/common/wav.c: revision 1.14
need getle16() for ext.sub_tag too
PR bin/52762 by Yosuke Sugahara
 1.14.6.3 23-Aug-2024  martin Pull up following revision(s) (requested by mrg in ticket #1874):

usr.bin/audio/common/wav.c: revision 1.23
usr.bin/audio/record/record.c: revision 1.59

fix some sizeof() confusion.

using "const char search[4]" as a function parameter means that
"search" is actually a pointer type so "sizeof search" returns
8 on 64-bit platforms. i mis-read this and used "sizeof *search"
which is always 1, noted by rillig.

instead of trying to avoid writing "4" twice, put it in a define
and use that in various places instead. annoying.
match message & conversion function name properly.

probably should make this into an array with two members.
 1.14.6.2 25-Mar-2024  martin Pull up following revision(s) (requested by mrg in ticket #1950):

usr.bin/audio/common/wav.c: revision 1.24

audio_wav_parse_hdr: handle zero-length data files again
the previous clean up turns zero-length data into no data and thus
an error, instead of simply doing nothing. noted by gson.
 1.14.6.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.14.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.15.8.3 23-Aug-2024  martin Pull up following revision(s) (requested by mrg in ticket #797):

usr.bin/audio/common/wav.c: revision 1.23
usr.bin/audio/record/record.c: revision 1.59

fix some sizeof() confusion.

using "const char search[4]" as a function parameter means that
"search" is actually a pointer type so "sizeof search" returns
8 on 64-bit platforms. i mis-read this and used "sizeof *search"
which is always 1, noted by rillig.

instead of trying to avoid writing "4" twice, put it in a define
and use that in various places instead. annoying.
match message & conversion function name properly.

probably should make this into an array with two members.
 1.15.8.2 25-Mar-2024  martin Pull up following revision(s) (requested by mrg in ticket #640):

usr.bin/audio/common/wav.c: revision 1.24

audio_wav_parse_hdr: handle zero-length data files again
the previous clean up turns zero-length data into no data and thus
an error, instead of simply doing nothing. noted by gson.
 1.15.8.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
 1.1 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.26 03-Jun-2025  kre Update to correct (minor) misstatememt pointed out on netbsd-users
by Ramiro Aceves.

(Someone with better knowledge of the audio system than I should
review this and correct anything I do not correctly understand.)
 1.25 07-Aug-2022  andvar branches: 1.25.4;
fix various typos in comments, documentation and messages.
mainly s/paramater/parameter/ and s/reduntant/redundant/.
 1.24 21-Mar-2021  nia audioctl.1: describe foibles
 1.23 09-May-2019  wiz branches: 1.23.2;
Sort options (no-argument options before ones demanding arguments).

Bump date.
 1.22 08-May-2019  isaki Remove -p option. AUDIO_SETCHAN is insecure and is obsoleted.
 1.21 10-Feb-2017  nat branches: 1.21.12;
Audio now uses fdclone, there is no longer a limitation of one audio
instance per process. Virtual channels are placed in a queue, so there is
no longer a compile time limit of VAUDIOCHANS.

A new sysctl has been added to control multiple user access.
Mixer labels on virtual channels are now prefixed by vchan.

audiobell.c and audioctl have been updated to reflect these changes.

Use of fdclone was posted to tech-kern@ and improvements made.
Multiuser access control changes and the use of a queue were suggessted by
pgoyette@
 1.20 08-Dec-2016  nat branches: 1.20.2;
The audio sub-system now supports the following features as
posted to tech-kern:

* Simultaneous playback and mixing of multiple streams
* Playback streams can be of different encoding, frequency, precision
and number of channels
* Simultaneous recording to different formats
* One audio device per process
* Sysctls to set the common format frequency, precision and channels
* Independent mixer controls for recording/playback per stream
* Utilizes little cpu time for multiple streams / good performance
* Compatible with existing programs that use OSS/NetBSD audio
* Changes to audioctl(1) to allow specifying process id for corresponding
audio device
 1.19 15-May-2010  joerg branches: 1.19.28;
Reorder sections to canonical order.
 1.18 30-Apr-2008  martin Convert TNF licenses to new 2 clause variant
 1.17 25-Feb-2003  wiz branches: 1.17.32;
.Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.16 13-Oct-2002  wiz New sentence, new line. Use Aq/An.
 1.15 27-Jan-2002  jdolecek Use '-d' rather than '-f' for specification of alternative
mixer or audioctl device. The support for '-f' is kept for compatibility
for now.
 1.14 17-Oct-2001  wiz Sort sections, drop some whitespace.
 1.13 02-Apr-1999  augustss Xref audioplay(1) and audiorecord(1).
 1.12 10-Mar-1999  erh branches: 1.12.2;
Add missing .El line.
 1.11 18-Feb-1999  mycroft Oops; update the date as well.
 1.10 18-Feb-1999  mycroft Update comments.
 1.9 18-Feb-1999  mycroft Rework the examples section a little.
 1.8 21-Aug-1998  augustss Use audio and mixer devices with unit numbers. Also allow the devices
without unit numbers of a compatibility option is set. Fixes PR 5991.
 1.7 27-Apr-1998  augustss Chnage the name of the environment variables just introduced.
 1.6 27-Apr-1998  augustss Add an environment variable for the default audio device.
 1.5 18-Oct-1997  lukem fix .Nm usage
 1.4 08-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.3 18-Aug-1997  augustss Change to use /dev/audioctl.
 1.2 15-May-1997  augustss Add HISTORY section.
 1.1 13-May-1997  augustss Add audio utility programs.
The audio device can be inspected and changed by audioctl,
and the mixer device by mixerctl. The command syntax was
inspired by sysctl.
 1.12.2.1 13-Apr-1999  mrg pull up 1.13
 1.17.32.1 18-May-2008  yamt sync with head.
 1.19.28.2 20-Mar-2017  pgoyette Sync with HEAD
 1.19.28.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.20.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.21.12.1 10-Jun-2019  christos Sync with HEAD
 1.23.2.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.25.4.1 02-Aug-2025  perseant Sync with HEAD
 1.4 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.3 22-Dec-2000  mrg branches: 1.3.34; 1.3.36;
de-__P()-ify
 1.2 26-Mar-1999  mrg add missing copyrights.
 1.1 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.3.36.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.3.34.1 04-Jun-2008  yamt sync with head
 1.44 08-May-2019  isaki Remove -p option. AUDIO_SETCHAN is insecure and is obsoleted.
 1.43 21-Mar-2017  nat branches: 1.43.12;
Renane ioctl AUDIO_SETPROC to AUDIO_SETCHAN.

Add an ioctl to return channel number (AUDIO_GETCHAN). This can be used
on audio/sound/audioctl devices.

Return EIO in read/write/ioctl/poll/stat if fp has been closed or is
invalid.

Update audio.4, audioio.h and audioctl(1) to reflect these changes.
 1.42 10-Feb-2017  nat Audio now uses fdclone, there is no longer a limitation of one audio
instance per process. Virtual channels are placed in a queue, so there is
no longer a compile time limit of VAUDIOCHANS.

A new sysctl has been added to control multiple user access.
Mixer labels on virtual channels are now prefixed by vchan.

audiobell.c and audioctl have been updated to reflect these changes.

Use of fdclone was posted to tech-kern@ and improvements made.
Multiuser access control changes and the use of a queue were suggessted by
pgoyette@
 1.41 08-Dec-2016  nat branches: 1.41.2;
The audio sub-system now supports the following features as
posted to tech-kern:

* Simultaneous playback and mixing of multiple streams
* Playback streams can be of different encoding, frequency, precision
and number of channels
* Simultaneous recording to different formats
* One audio device per process
* Sysctls to set the common format frequency, precision and channels
* Independent mixer controls for recording/playback per stream
* Utilizes little cpu time for multiple streams / good performance
* Compatible with existing programs that use OSS/NetBSD audio
* Changes to audioctl(1) to allow specifying process id for corresponding
audio device
 1.40 30-Aug-2013  mrg branches: 1.40.8;
move most of the header writing code from record.c into wav.c and sun.c.

introduce a struct write_info for communication between front ends and
backends.

libaudio API is still pretty ugly, and needs to stay local here for now,
but it is a little more usable for other tools now.
 1.39 28-Aug-2011  joerg branches: 1.39.2; 1.39.8;
ANSIfy. Add static. Add __dead.
 1.38 11-Apr-2009  lukem fix -Wsign-compare and other WARNS=4 issues
 1.37 28-Apr-2008  martin branches: 1.37.8;
Remove clause 3 and 4 from TNF licenses
 1.36 22-Oct-2006  christos branches: 1.36.16;
use c99 initializer.
 1.35 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.34 23-Jun-2003  agc Add NetBSD RCS Ids.
 1.33 06-Jan-2003  wiz compatibility, not compatiblity.
 1.32 05-Feb-2002  augustss Test for default device in a portable way. Thanks to Michael Ericsson
for spotting the problem.
 1.31 31-Jan-2002  augustss Use _PATH_SOUND etc, all fall back to _PATH_SOUND0 (etc.) if that fails.
 1.30 27-Jan-2002  jdolecek Delete the old code which made audioctl use stderr for output
if the stdout was same as the audio device. It's no longer relevant,
and the check was broken anyway (code used st_dev rather than st_rdev
when comparing the character devices).
A by-product of this is that 'audioctl -a > /dev/null' now works.

Okay'ed by Lennart.
 1.29 27-Jan-2002  jdolecek Use '-d' rather than '-f' for specification of alternative
mixer or audioctl device. The support for '-f' is kept for compatibility
for now.
 1.28 15-Jan-2002  mrg - WARNS=3 (from ross@netbsd.org)
- fix a bug in WAV conversions
 1.27 28-Mar-2001  simonb Fix white space and formatting nits.
 1.26 19-Feb-2001  cgd convert to use getprogname()
 1.25 05-Feb-2001  christos fix nested extern
 1.24 22-Dec-2000  mrg de-__P()-ify
 1.23 26-Mar-1999  mrg branches: 1.23.10;
audio paths are in <paths.h>
 1.22 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.21 25-Nov-1998  augustss Make the copyright header conform to the NetBSD template.
 1.20 21-Aug-1998  augustss Fix thinko in last commit.
 1.19 21-Aug-1998  augustss Use audio and mixer devices with unit numbers. Also allow the devices
without unit numbers of a compatibility option is set. Fixes PR 5991.
 1.18 13-Aug-1998  mrg audio_prinfo.seek is now a UINT
 1.17 10-Aug-1998  mycroft Make it possible to do:
audioctl -w play=44100,2,16,slinear

Not the greatest implementation.
 1.16 28-Jul-1998  mycroft __AUDIT__ cleanup.
 1.15 13-Jul-1998  augustss Fix typo. From Feico Dillema <dillema@acm.org>
 1.14 27-Apr-1998  augustss Chnage the name of the environment variables just introduced.
 1.13 27-Apr-1998  augustss Add an environment variable for the default audio device.
 1.12 19-Oct-1997  augustss Update for SunOS compatibility.
 1.11 11-Oct-1997  augustss Print properties differently.
Change indentation.
 1.10 08-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.9 07-Oct-1997  augustss Get rid of warnings.
 1.8 25-Aug-1997  augustss Don't try opening the device O_RDWR.
 1.7 18-Aug-1997  augustss Change to use /dev/audioctl.
 1.6 27-Jul-1997  augustss Modernize for new audio features.
 1.5 16-Jul-1997  augustss Sync with audioio.h changes.
 1.4 15-Jul-1997  veego Sync with the recent changes of the audio variables.
s/AUDIO_ENCODING_LINEAR_LE/AUDIO_ENCODING_SLINEAR_LE/
s/AUDIO_ENCODING_LINEAR_BE/AUDIO_ENCODING_SLINEAR_BE/
 1.3 21-May-1997  augustss Fix pasto.
 1.2 19-May-1997  augustss Fix some buglets and clean up a little.
 1.1 13-May-1997  augustss Add audio utility programs.
The audio device can be inspected and changed by audioctl,
and the mixer device by mixerctl. The command syntax was
inspired by sysctl.
 1.23.10.2 09-Feb-2002  he Pull up revision 1.30 (via patch, requested by jdolecek):
Remove the old code which made audioctl use stderr for output if
stdout was the same as the audio device. A by-product is that
``audioctl -a > /dev/null'' now works.
 1.23.10.1 29-Jan-2002  he Apply patch (requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.36.16.1 18-May-2008  yamt sync with head.
 1.37.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.39.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.39.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.40.8.3 26-Apr-2017  pgoyette Sync with HEAD
 1.40.8.2 20-Mar-2017  pgoyette Sync with HEAD
 1.40.8.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.41.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.43.12.1 10-Jun-2019  christos Sync with HEAD
 1.4 14-Apr-2009  lukem Enable WARNS=4 by default for usr.bin, except for:
awk bdes checknr compile_et error gss hxtool kgetcred kinit
klist ldd less lex locale login m4 man menuc mk_cmds
mklocale msgc openssl rpcgen rpcinfo sdiff spell ssh
string2key telnet tn3270 verify_krb5_conf xlint
 1.3 05-Oct-2007  lukem branches: 1.3.14;
Convert to raise_default_signal(3).
 1.2 13-Jan-2002  ross branches: 1.2.26;
Rototill play_fd() to fix some original problems and some added later.
Also, fix up for and enable WARNS=2. This fixes problems playing from
pipes or standard input, and playing from funny filesystems or other
cases that can't be mmap(2)ed.
 1.1 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.2.26.1 06-Nov-2007  matt sync with HEAD
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.34 04-Mar-2024  mrg audioplay: add -n flag that doesn't write audio data.

this will be used in an upcoming testsuite for the wav parser.
 1.33 04-Feb-2024  mrg update my email address.
 1.32 30-Jun-2023  gutteridge audioplay.1: fix sentence punctuation
 1.31 13-Feb-2023  uwe audioplay(1): fix typo

From Jim Spath in PR/57228
 1.30 10-Apr-2020  gutteridge branches: 1.30.6;
audioplay.1: generalize a reference to web browsers
 1.29 12-Nov-2019  wiz Remove list of audio drivers, moved to audio(4).
 1.28 11-Nov-2019  wiz Fix a typo. Fix some xrefs, comment out references to non-existing man pages.
 1.27 09-Nov-2019  mrg add support for playing IEEE float32 and float64 RIFF WAVE
samples on platforms that have these types natively, and
can handle signed linear 32 bit samples. explicitly
disabled on vax, run-or-compile-time sizeof() check
disabled for everyone else

now i can play a float32 .wav file i found.
float64 not tested.

copyright maint, update HISTORY, update audio drivers list.
 1.26 18-Mar-2014  riastradh branches: 1.26.18; 1.26.26; 1.26.28;
Merge riastradh-drm2 to HEAD.
 1.25 20-Jul-2013  wiz Use Mt for email addresses.
 1.24 29-Dec-2010  wiz branches: 1.24.6; 1.24.12; 1.24.16;
Use better reference after sorting in -f description.
 1.23 29-Dec-2010  wiz Sort some more.
 1.22 29-Dec-2010  mrg add a new "-B buffersize" flag to both audioplay and audiorecord.
suggested by jmcneill@.

sort audioplay manual some.
 1.21 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.20 31-Mar-2003  perry branches: 1.20.32; 1.20.34;
audiofiles -> audio files
 1.19 13-Oct-2002  wiz New sentence, new line. Use Aq/An.
 1.18 26-Feb-2002  augustss Update man pages to reflect the use of /dev/sound instead of /dev/audio.
 1.17 08-Feb-2002  ross Generate <>& symbolically. I'm avoiding .../dist/... directories for now.
 1.16 02-Feb-2002  jdolecek Retire -C, do all the ioctls on same audio device we do i/o
 1.15 15-Jan-2002  wiz Sort SEE ALSO.
 1.14 15-Jan-2002  mrg - add signed linear support to audiorecord's WAV support.
- swap big endian samples for WAV.
- update audioplay(1) and audiorecord(1) audio driver xrefs.

XXX fix support for unsigned linear samples -- it seems they need
to be converted to signed for WAV???
 1.13 15-Jan-2002  mrg - add rudimentary "wav" recording support: don't think it copes with
big-endian systems properly yet -- need to add RIFX support or swap
samples while writing. more on this coming soon.

- new "-F <format>" option for audiorecord. supported values of <format>
are "sun", "wav" and "none", plus a few aliases.

- split sun & wav support out into their own files.

- don't assume that WAV header elements are properly aligned for the
type of data they hold.

XXX: still need to clean up libaudio interfaces a lot.
 1.12 01-Dec-2001  wiz Sort sections, sort SEE ALSO, close quotes in two places.
 1.11 01-Dec-2001  wiz Whitespace cleanup.
 1.10 05-Jun-2001  wiz Don't give .Os an argument, not even 'NetBSD' (default includes version).
 1.9 02-May-2001  minoura X68k built-in voice synthesizer supports 4bit ADPCM.
 1.8 05-Jul-2000  msaitoh remove extra period in SEE ALL section
 1.7 14-Sep-1999  mrg branches: 1.7.8;
add a note about "audioctl encodings", to find available supported encodings.
 1.6 13-Sep-1999  tron Name possible encodings for "-e" option and add an example provided by
Ben Wong in PR bin/8391. Thanks must go to Ross Harvey for helping me
with the "nroff" stuff.
 1.5 13-Jul-1999  kleink If not specified on the command line, attempt to fall back to the environment
variables AUDIODEVICE (for -d) and AUDIOCTLDEVICE (for -C, already used in
audioctl(1)) before falling back to _PATH_* constants.
 1.4 02-Apr-1999  augustss Fix various buglets.
 1.3 30-Mar-1999  mrg branches: 1.3.2;
document new play -f/-s/-P-/c/-e, s/name/named/ from mason in pr#7292. update dates.
 1.2 28-Mar-1999  mrg add -f (force) flag to audioplay, plus -s/-P/-c/-e switches for force setting sample rate, precision, channels and encoding. fix some man pages missing .El bits (via veego)
 1.1 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.3.2.2 22-Oct-1999  he Pull up revision 1.5 (requested by dmcmahill):
If not specified on the command line, attempt to fall back
to the environment variables AUDIODEVICE (for -d) and
AUDIOCTLDEVICE (for -C) before falling back to _PATH_* constants.
 1.3.2.1 13-Apr-1999  mrg pullup 1.4
 1.7.8.1 29-Jan-2002  he Pull up revisions 1.8-1.15 (requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.20.34.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.20.32.1 04-Jun-2008  yamt sync with head
 1.24.16.1 23-Jul-2013  riastradh sync with HEAD
 1.24.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.24.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.26.28.2 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.26.28.1 14-Feb-2023  martin Pull up following revision(s) (requested by uwe in ticket #1593):

usr.bin/audio/play/audioplay.1: revision 1.31

audioplay(1): fix typo

From Jim Spath in PR/57228
 1.26.26.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.26.18.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.30.6.2 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
 1.30.6.1 14-Feb-2023  martin Pull up following revision(s) (requested by uwe in ticket #82):

usr.bin/audio/play/audioplay.1: revision 1.31

audioplay(1): fix typo

From Jim Spath in PR/57228
 1.64 04-Mar-2024  mrg audioplay: add -n flag that doesn't write audio data.

this will be used in an upcoming testsuite for the wav parser.
 1.63 15-Apr-2023  mlelstv Revert accidentially committed part. The 'latency' report isn't ready
to be useful.
 1.62 15-Apr-2023  mlelstv Add support for recording 24bit wav files.
 1.61 15-May-2022  mrg branches: 1.61.2;
fix verbose log for 64 bit float
 1.60 11-Nov-2019  joerg Spell the largest 32bit signed value as INT32_MAX. Explicitly cast to
float, because it is not precisely representable.
 1.59 09-Nov-2019  mrg copyright maint.
 1.58 09-Nov-2019  mrg add support for playing IEEE float32 and float64 RIFF WAVE
samples on platforms that have these types natively, and
can handle signed linear 32 bit samples. explicitly
disabled on vax, run-or-compile-time sizeof() check
disabled for everyone else

now i can play a float32 .wav file i found.
float64 not tested.

copyright maint, update HISTORY, update audio drivers list.
 1.57 04-May-2019  isaki branches: 1.57.2;
Use err(3)/errx(3) properly to avoid "write failed: Undefined error: 0".
 1.56 16-Nov-2018  mlelstv The test for regular file was wrong.

From yarl on freenode, thanks!
 1.55 05-Aug-2015  mrg branches: 1.55.8; 1.55.14; 1.55.16;
rename struct write_info as struct track_info, and the variable name 'wi'
as 'ti', as this info is useful for reading as well.
 1.54 28-Aug-2011  joerg ANSIfy. Add static. Add __dead.
 1.53 29-Dec-2010  wiz Sort usage.
 1.52 29-Dec-2010  jmcneill allow for buffer sizes < 32k
 1.51 29-Dec-2010  mrg add a new "-B buffersize" flag to both audioplay and audiorecord.
suggested by jmcneill@.

sort audioplay manual some.
 1.50 11-Apr-2009  lukem fix -Wsign-compare and other WARNS=4 issues
 1.49 29-May-2008  mrg branches: 1.49.6;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.48 15-Dec-2007  perry branches: 1.48.4; 1.48.6;
convert __attribute__s to applicable cdefs.h macros
 1.47 05-Oct-2007  lukem Convert to raise_default_signal(3).
 1.46 23-May-2006  christos branches: 1.46.10;
Coverity CID 3187: Fix memory leak
 1.45 13-Jul-2005  mrg branches: 1.45.2;
play.c: allow empty files to exit gracefully rather than with an error
of "header seems really large". reported by wiz.

record.c: don't use total_size in the header if is -1 (it's initial value)
 1.44 02-Jun-2005  lukem appease gcc -Wuninitialized
 1.43 09-Jul-2004  wiz branches: 1.43.2;
There is no -m option -- remove it from the usage.
From Kouichirou Hiratsuka in PR 26192.
 1.42 23-Jun-2003  agc branches: 1.42.4;
Add NetBSD RCS Ids.
 1.41 08-Dec-2002  mrg fix an error message
 1.40 04-Nov-2002  mrg fix PR#18909, but not quite exactly the same as the patch provided. also,
check if the filesize causes a size_t overflow and if so, use the fallback
read/write loop method.
 1.39 03-Nov-2002  wiz Move close so that last ioctl is before close call.
Fix duplicate word in comment.
Based on patch from Christian Biere in PR 18902, with a style nit fixed.
 1.38 01-Oct-2002  mrg print the file name in verbose mode as well. avoid printing (null) for encoding.
 1.37 20-Jul-2002  grant sweep of errx/warnx, remove unnecessary trailing \n
 1.36 10-Feb-2002  mrg define: datasize == 0 means use the whole file. fixes part of PR#12809.
 1.35 05-Feb-2002  augustss Test for default device in a portable way. Thanks to Michael Ericsson
for spotting the problem.
 1.34 02-Feb-2002  jdolecek Retire -C, do all the ioctls on same audio device we do i/o
 1.33 31-Jan-2002  augustss Actually be verbose if the -V flag is given.
 1.32 31-Jan-2002  augustss Use _PATH_SOUND etc, all fall back to _PATH_SOUND0 (etc.) if that fails.
 1.31 15-Jan-2002  mrg KNF.
 1.30 15-Jan-2002  mrg flush the audio buffer on signals; from Ben Wong <hackerb9@u.washington.edu> in PR#9134
 1.29 15-Jan-2002  mrg - add rudimentary "wav" recording support: don't think it copes with
big-endian systems properly yet -- need to add RIFX support or swap
samples while writing. more on this coming soon.

- new "-F <format>" option for audiorecord. supported values of <format>
are "sun", "wav" and "none", plus a few aliases.

- split sun & wav support out into their own files.

- don't assume that WAV header elements are properly aligned for the
type of data they hold.

XXX: still need to clean up libaudio interfaces a lot.
 1.28 13-Jan-2002  ross fix regression, err() -> errx()
 1.27 13-Jan-2002  ross Rototill play_fd() to fix some original problems and some added later.
Also, fix up for and enable WARNS=2. This fixes problems playing from
pipes or standard input, and playing from funny filesystems or other
cases that can't be mmap(2)ed.
 1.26 02-May-2001  minoura X68k built-in voice synthesizer supports 4bit ADPCM.
 1.25 28-Mar-2001  simonb Fix white space and formatting nits.
 1.24 08-Mar-2001  ross lp64/printf
 1.23 04-Mar-2001  hubertf Don't play trailing garbage at end of RIFF WAVE (.wav) files
Patch sent by YAMAMOTO Takashi <takashi.yamamoto@bigfoot.com> in PR 12328
 1.22 19-Feb-2001  cgd convert to use getprogname()
 1.21 05-Feb-2001  christos fix nested extern
 1.20 19-Jan-2001  mrg - move the mmap playing code into new play() function
- be more (properly) quiet with `-q'
 1.19 22-Dec-2000  mrg de-__P()-ify
 1.18 13-Dec-2000  mrg libaudio:
- rename audio_get_sun_encoding() to audio_sun_to_encoding()
- add audio_encoding_to_sun()
play.c:
- adapt
record.c:
- convert NetBSD encoding to sun encoding if possible, otherwise don't
output a header at all.
fixes PR#10380 from Michael Eriksson <eramore@era-t.ericsson.se>.
 1.17 27-Feb-2000  mrg branches: 1.17.4;
honour -q (quiet) flag a bit more.
 1.16 08-Nov-1999  kleink When we have to print usage instructions, don't indicate success in the exit
status.
 1.15 06-Nov-1999  kleink * Don't treat failure to open a file as fatal error; print a warning to
standard error, arrange for a non-zero exit status and continue with the
next file. Addresses PR bin/8748.
* GCC vs. ANSI: a cast doesn't yield an lvalue.
* Use MAP_FAILED.
 1.14 23-Oct-1999  mrg fix bug introduced in 1.12:
only return a header length of 0 if we are using -f (force), not
in the case when we know how long the header is. this stops from
playing the audio header.
 1.13 27-Sep-1999  mrg honour -f, even if we appear to have a sun audio file. un-byte-screw the encoding for printing, too.
 1.12 13-Sep-1999  tron branches: 1.12.2;
Fix broken "-f" and "-P" options. Patches supplied by Ben Wong in
PR bin/8390.
 1.11 13-Jul-1999  kleink If not specified on the command line, attempt to fall back to the environment
variables AUDIODEVICE (for -d) and AUDIOCTLDEVICE (for -C, already used in
audioctl(1)) before falling back to _PATH_* constants.
 1.10 17-May-1999  jtk fix defect where specifying channels would also specify the same string
as the control device (missing 'break')
 1.9 13-Apr-1999  mrg try using normal read/write is mmap() fails. tell the VM system we are going to be doing sequential access via madvise().
 1.8 02-Apr-1999  augustss Fix various buglets.
 1.7 30-Mar-1999  augustss branches: 1.7.2;
Insert an AUDIO_DRAIN at the end of each file.
 1.6 28-Mar-1999  mrg add -f (force) flag to audioplay, plus -s/-P/-c/-e switches for force setting sample rate, precision, channels and encoding. fix some man pages missing .El bits (via veego)
 1.5 27-Mar-1999  mrg expand usage message to reality.
 1.4 27-Mar-1999  mrg add support to play stdin.
 1.3 26-Mar-1999  mrg add missing copyrights.
 1.2 26-Mar-1999  mrg audio paths are in <paths.h>
 1.1 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.7.2.5 11-Nov-1999  he Pull up revisions 1.15-1.16 via patch (requested by kleink):
Do not treat failure to open a file as a fatal error, fixing
PR#8748. Change two GNU C statements to valid ANSI C.
 1.7.2.4 22-Oct-1999  he Pull up revision 1.11 (requested by dmcmahill):
If not specified on the command line, attempt to fall back
to the environment variables AUDIODEVICE (for -d) and
AUDIOCTLDEVICE (for -C) before falling back to _PATH_* constants.
 1.7.2.3 27-Sep-1999  cgd pull up rev 1.13 from trunk (requested by mrg):
Honor the "-f" flag even if we appear to recognize a broken Sun audio
file, and fix an error message on little-endian hosts.
 1.7.2.2 01-Jul-1999  perry pullup 1.9->1.10 (jtk)
 1.7.2.1 13-Apr-1999  mrg pullup 1.8
 1.12.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.4.3 29-Jan-2002  he Pull up revisions 1.18-1.21,1.25-1.31 (via patch, requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.17.4.2 14-Mar-2001  he Pull up revision 1.24 (via patch, requested by he):
Fix LP64 format/type inconsistency.
 1.17.4.1 11-Mar-2001  he Pull up revision 1.23 (via patch, requested by hubertf):
Do not play trailing garbage at the end of RIFF WAVE (.wav) files.
Fixes PR#12328.
 1.42.4.1 18-Jul-2005  riz Pull up revision 1.45 (requested by mrg in ticket #5498):
play.c: allow empty files to exit gracefully rather than with an error
of "header seems really large". reported by wiz.

record.c: don't use total_size in the header if is -1 (it's initial valu
e)
 1.43.2.1 19-Jul-2005  riz Pull up revision 1.45 (requested by mrg in ticket #597):
play.c: allow empty files to exit gracefully rather than with an error
of "header seems really large". reported by wiz.
record.c: don't use total_size in the header if is -1 (it's initial value)
 1.45.2.1 19-Jun-2006  chap Sync with head.
 1.46.10.2 09-Jan-2008  matt sync with HEAD
 1.46.10.1 06-Nov-2007  matt sync with HEAD
 1.48.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.48.4.1 04-Jun-2008  yamt sync with head
 1.49.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.55.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.55.16.1 10-Jun-2019  christos Sync with HEAD
 1.55.14.1 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.55.8.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.57.2.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.61.2.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
 1.2 05-Oct-2007  lukem Convert to raise_default_signal(3).
 1.1 26-Mar-1999  mrg branches: 1.1.36;
add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.1.36.1 06-Nov-2007  matt sync with HEAD
 1.45 04-Feb-2024  mrg update my email address.
 1.44 25-Mar-2021  nia branches: 1.44.6;
Add an example for recording CD quality audio
 1.43 31-Jan-2020  sevan audioamd is in the SPARC port
 1.42 18-Mar-2014  riastradh branches: 1.42.18; 1.42.26; 1.42.28;
Merge riastradh-drm2 to HEAD.
 1.41 20-Jul-2013  wiz Use Mt for email addresses.
 1.40 29-Dec-2010  wiz branches: 1.40.6; 1.40.12; 1.40.16;
Sort some more.
 1.39 29-Dec-2010  mrg add a new "-B buffersize" flag to both audioplay and audiorecord.
suggested by jmcneill@.

sort audioplay manual some.
 1.38 02-Jul-2009  mrg note that -t can take [.dddddd]. sort -q.
from dhgutteridge@sympatico.ca in PR#36928.
 1.37 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.36 15-May-2006  gson branches: 1.36.20; 1.36.22;
Recording to standard output is specified by a file name of -,
not by omitting the file name.
 1.35 09-Jul-2004  wiz Add -q to SYNOPSIS. From Kouichirou Hiratsuka in PR 26193.
 1.34 07-Aug-2003  wiz Add arguments to options in long description.
 1.33 21-Jul-2003  mrg minor consistency nit
 1.32 25-Feb-2003  wiz .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.31 18-Dec-2002  wiz Be consistent about putting commas between items in an enumeration.
 1.30 08-Dec-2002  mrg fix the description for "-p" to match reality, new text provided in PR#18949.
 1.29 13-Oct-2002  wiz New sentence, new line. Sort options. Bump Dd for .wav-file handling.
Some nits.
 1.28 13-Oct-2002  mrg if the output file is called *.wav, output a WAV file.
 1.27 02-Sep-2002  ross + rephrase a bunch of stuff
+ fix totally bogus -i text
 1.26 26-Feb-2002  augustss Update man pages to reflect the use of /dev/sound instead of /dev/audio.
 1.25 10-Feb-2002  wiz Be more verbose in description of -e.
 1.24 08-Feb-2002  ross Generate <>& symbolically. I'm avoiding .../dist/... directories for now.
 1.23 02-Feb-2002  jdolecek Retire -C, do all the ioctls on same audio device we do i/o
 1.22 25-Jan-2002  mrg update .Dd
 1.21 15-Jan-2002  wiz Fix typos.
 1.20 15-Jan-2002  mrg note about WAV sample conversions.
 1.19 15-Jan-2002  mrg add a note about RIFF/WAVE support and one about signed/unsigned big/little conversion.
 1.18 15-Jan-2002  wiz Sort SEE ALSO.
 1.17 15-Jan-2002  mrg - add signed linear support to audiorecord's WAV support.
- swap big endian samples for WAV.
- update audioplay(1) and audiorecord(1) audio driver xrefs.

XXX fix support for unsigned linear samples -- it seems they need
to be converted to signed for WAV???
 1.16 15-Jan-2002  mrg - add rudimentary "wav" recording support: don't think it copes with
big-endian systems properly yet -- need to add RIFX support or swap
samples while writing. more on this coming soon.

- new "-F <format>" option for audiorecord. supported values of <format>
are "sun", "wav" and "none", plus a few aliases.

- split sun & wav support out into their own files.

- don't assume that WAV header elements are properly aligned for the
type of data they hold.

XXX: still need to clean up libaudio interfaces a lot.
 1.15 01-Dec-2001  wiz Sort sections, sort SEE ALSO, drop trailing '.' in SEE ALSO, use standard
headers.
 1.14 05-Jun-2001  wiz Don't give .Os an argument, not even 'NetBSD' (default includes version).
 1.13 04-May-2001  wiz Explain '-c' option.
 1.12 02-May-2001  minoura X68k built-in voice synthesizer supports 4bit ADPCM.
 1.11 31-Mar-2001  mrg cleanup. including proper fix for previous
 1.10 31-Mar-2001  pooka add missing chapter number from ym(4) crossreference

Reported by Tetsuya Isaki in bin/12513
 1.9 06-Sep-2000  msaitoh remove extra period
 1.8 02-Feb-2000  dmcmahill branches: 1.8.4;
When no -e flag is used to specify the encoding, default to "ulaw". This
fixes PR bin/9329. Thanks to Wolfgang Rupprecht (wolfgang@wsrcc.com)
for filing the PR and identifying the bug. This change is slightly different
than the one provided in the PR.

Also, document the default encoding in the manpage.

This default is consistent with the default for audiorecord under solaris.
 1.7 23-Sep-1999  dmcmahill add description of the -t option
 1.6 13-Jul-1999  kleink If not specified on the command line, attempt to fall back to the environment
variables AUDIODEVICE (for -d) and AUDIOCTLDEVICE (for -C, already used in
audioctl(1)) before falling back to _PATH_* constants.
 1.5 14-Apr-1999  mrg reword description to not be audioplay, as noted by pr#7379.
 1.4 30-Mar-1999  mrg branches: 1.4.2;
document new play -f/-s/-P-/c/-e, s/name/named/ from mason in pr#7292. update dates.
 1.3 28-Mar-1999  mrg add -f (force) flag to audioplay, plus -s/-P/-c/-e switches for force setting sample rate, precision, channels and encoding. fix some man pages missing .El bits (via veego)
 1.2 26-Mar-1999  mrg add missing copyrights.
 1.1 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.4.2.3 02-Feb-2000  he Pull up revision 1.8 (requested by dmcmahill):
When no `-e' flag is used to specify an encoding, default to
"ulaw". Fixes PR#9329. Also document the default.
 1.4.2.2 20-Oct-1999  he Pull up revisions 1.6-1.7 (requested by dmcmahill):
Document AUDIODEVICE and AUDIOCTLDEVICE environment variables
and the -t option.
 1.4.2.1 15-Apr-1999  mrg pull up 1.5
 1.8.4.1 29-Jan-2002  he Pull up revisions 1.9-1.22 (requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.36.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.36.20.1 04-Jun-2008  yamt sync with head
 1.40.16.1 23-Jul-2013  riastradh sync with HEAD
 1.40.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.40.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.42.28.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.42.26.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.42.18.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.44.6.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
 1.59 20-Mar-2024  mrg match message & conversion function name properly.

probably should make this into an array with two members.
 1.58 27-Feb-2024  gson Clean up lines containing only spaces.
 1.57 15-Apr-2023  mlelstv Add support for recording 24bit wav files.
 1.56 09-Jan-2022  mlelstv branches: 1.56.2;
Let user gracefully abort recording with SIGINT.
 1.55 01-Jun-2021  riastradh audiorecord(1): Handle read(2) return value gracefully.
 1.54 05-Aug-2015  mrg branches: 1.54.8; 1.54.18;
rename struct write_info as struct track_info, and the variable name 'wi'
as 'ti', as this info is useful for reading as well.
 1.53 30-Aug-2013  mrg move most of the header writing code from record.c into wav.c and sun.c.

introduce a struct write_info for communication between front ends and
backends.

libaudio API is still pretty ugly, and needs to stay local here for now,
but it is a little more usable for other tools now.
 1.52 21-Sep-2011  christos branches: 1.52.2; 1.52.8;
PR/45384: Henning Petersen: Swapped arguments in lseek
 1.51 28-Aug-2011  joerg ANSIfy. Add static. Add __dead.
 1.50 29-Dec-2010  wiz Sort usage.
 1.49 29-Dec-2010  jmcneill allow for buffer sizes < 32k
 1.48 29-Dec-2010  mrg add a new "-B buffersize" flag to both audioplay and audiorecord.
suggested by jmcneill@.

sort audioplay manual some.
 1.47 11-Apr-2009  lukem fix -Wsign-compare and other WARNS=4 issues
 1.46 29-May-2008  mrg branches: 1.46.6;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.45 15-Dec-2007  perry branches: 1.45.4; 1.45.6;
convert __attribute__s to applicable cdefs.h macros
 1.44 05-Oct-2007  lukem Convert to raise_default_signal(3).
 1.43 11-May-2006  mrg branches: 1.43.12;
variable signed/unsigned cleanup.
 1.42 09-May-2006  gson Do not treat all file names of length 1 as meaning standard output.
 1.41 13-Jul-2005  mrg play.c: allow empty files to exit gracefully rather than with an error
of "header seems really large". reported by wiz.

record.c: don't use total_size in the header if is -1 (it's initial value)
 1.40 05-Jul-2005  mrg move some more processing before opening the audio device. don't
default the encoding to ulaw; default it to what ever the device
has. the latter fixes PR#30612.
 1.39 05-Jul-2005  mrg check that an output file is given before doing any other work.
avoids touching the audio device and then printing an error.
 1.38 19-Jul-2004  mycroft branches: 1.38.2;
Convert 8-bit signed linear data to unsigned for .wav files.
 1.37 19-Jul-2004  mycroft Fix fencepost errors in the conversion functions (making them a bit more like
the kernel versions).
 1.36 21-Oct-2003  fvdl branches: 1.36.2;
Don't set an int to NULL.
 1.35 07-Aug-2003  wiz Sort usage, and move a word.
 1.34 21-Jul-2003  mrg fix a now-wrong comment.
 1.33 23-Jun-2003  agc Add NetBSD RCS Ids.
 1.32 27-Dec-2002  mrg - decode_int(): always use base 10, so that a time of "1:09" works.
- decode_time(): 60 seconds in a minute, really.
both from tsarna@netbsd.org.

- be verbose about the time we are going to record for, if verbose.
 1.31 13-Oct-2002  mrg if the output file is called *.wav, output a WAV file.
 1.30 20-Jul-2002  grant sweep of errx/warnx, remove unnecessary trailing \n
 1.29 20-Jul-2002  mrg fix an error message.
 1.28 21-Mar-2002  uwe _PATH_SOUND0 should be opened O_RDONLY (obvious pasto).
 1.27 10-Feb-2002  mrg - add a AUDIO_FORMAT_DEFAULT. use it. don't change functionity.

- fix the function selection in sunau conversions.

- be more verbose when given -V. (hi lennart! :)
 1.26 10-Feb-2002  mrg apply the same fix as the previous to WAV output creation.
 1.25 10-Feb-2002  mrg convert the host (non _LE or _BE) encodings we can, as well. fixes part
of PR#12809...
 1.24 05-Feb-2002  augustss Test for default device in a portable way. Thanks to Michael Ericsson
for spotting the problem.
 1.23 02-Feb-2002  jdolecek Retire -C, do all the ioctls on same audio device we do i/o
 1.22 31-Jan-2002  augustss Use _PATH_SOUND etc, all fall back to _PATH_SOUND0 (etc.) if that fails.
 1.21 15-Jan-2002  mrg - WARNS=3 (from ross@netbsd.org)
- fix a bug in WAV conversions
 1.20 15-Jan-2002  mrg WAV seems to be signed only; convert unsigned samples.
 1.19 15-Jan-2002  mrg for sun output files, if we have unsigned or little endian data, convert
it to signed big endian data. pull in a modified copy of the kernels'
auconv.[ch] to help with this (and remove some home grown code that did
some of the same things.)
 1.18 15-Jan-2002  mrg - add signed linear support to audiorecord's WAV support.
- swap big endian samples for WAV.
- update audioplay(1) and audiorecord(1) audio driver xrefs.

XXX fix support for unsigned linear samples -- it seems they need
to be converted to signed for WAV???
 1.17 15-Jan-2002  mrg - add rudimentary "wav" recording support: don't think it copes with
big-endian systems properly yet -- need to add RIFX support or swap
samples while writing. more on this coming soon.

- new "-F <format>" option for audiorecord. supported values of <format>
are "sun", "wav" and "none", plus a few aliases.

- split sun & wav support out into their own files.

- don't assume that WAV header elements are properly aligned for the
type of data they hold.

XXX: still need to clean up libaudio interfaces a lot.
 1.16 07-Jun-2001  mrg only warn about not writing the sun header once. PR#12809
 1.15 02-May-2001  minoura X68k built-in voice synthesizer supports 4bit ADPCM.
 1.14 19-Feb-2001  cgd convert to use getprogname()
 1.13 05-Feb-2001  christos fix nested extern
 1.12 22-Dec-2000  mrg de-__P()-ify
 1.11 13-Dec-2000  mrg libaudio:
- rename audio_get_sun_encoding() to audio_sun_to_encoding()
- add audio_encoding_to_sun()
play.c:
- adapt
record.c:
- convert NetBSD encoding to sun encoding if possible, otherwise don't
output a header at all.
fixes PR#10380 from Michael Eriksson <eramore@era-t.ericsson.se>.
 1.10 02-Feb-2000  dmcmahill branches: 1.10.4;
When no -e flag is used to specify the encoding, default to "ulaw". This
fixes PR bin/9329. Thanks to Wolfgang Rupprecht (wolfgang@wsrcc.com)
for filing the PR and identifying the bug. This change is slightly different
than the one provided in the PR.

Also, document the default encoding in the manpage.

This default is consistent with the default for audiorecord under solaris.
 1.9 08-Nov-1999  kleink When we have to print usage instructions, don't indicate success in the exit
status.
 1.8 27-Sep-1999  mrg run forever if no -t is specified, from dan mcmahill
 1.7 23-Sep-1999  dmcmahill branches: 1.7.2;
fix -t option
 1.6 13-Jul-1999  kleink If not specified on the command line, attempt to fall back to the environment
variables AUDIODEVICE (for -d) and AUDIOCTLDEVICE (for -C, already used in
audioctl(1)) before falling back to _PATH_* constants.
 1.5 19-Jun-1999  itohy Fix -C behavior.
 1.4 27-Mar-1999  mrg branches: 1.4.2;
expand usage message to reality.
 1.3 27-Mar-1999  mrg make recording precision/encoding setting sane.
 1.2 26-Mar-1999  mrg add missing copyrights.
 1.1 26-Mar-1999  mrg add audiorecord and audioplay tools. audioplay does .au and .wav files. audiorecord makes .au files only. uses parts of audioctl..
 1.4.2.5 02-Feb-2000  he Pull up revision 1.10 (requested by dmcmahill):
When no `-e' flag is used to specify an encoding, default to
"ulaw". Fixes PR#9329. Also document the default.
 1.4.2.4 11-Nov-1999  he Pull up revision 1.9 (requested by kleink):
Do not indicate success in the exit status if usage instructions
had to be printed.
 1.4.2.3 22-Oct-1999  he Pull up revision 1.6 (requested by dmcmahill):
If not specified on the command line, attempt to fall back
to the environment variables AUDIODEVICE (for -d) and
AUDIOCTLDEVICE (for -C) before falling back to _PATH_* constants.
 1.4.2.2 27-Sep-1999  cgd pull up revs 1.7-1.8 from trunk (requested by mrg):
Fix audiorecord(1)'s "-t" option so that it actually works.
 1.4.2.1 23-Jun-1999  perry pullup 1.4->1.5 (jtk)
 1.7.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.10.4.1 29-Jan-2002  he Pull up revisions 1.11-1.13,1.15-1.21 (via patch, requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.36.2.2 23-Jul-2004  tron branches: 1.36.2.2.2;
Pull up revision 1.38 (requested by mycroft in ticket #690):
Convert 8-bit signed linear data to unsigned for .wav files.
 1.36.2.1 23-Jul-2004  tron Pull up revision 1.37 (requested by mycroft in ticket #690):
Fix fencepost errors in the conversion functions (making them a bit more like
the kernel versions).
 1.36.2.2.2.1 18-Jul-2005  riz Pull up revisions 1.39-1.41 (requested by mrg in ticket #5498):
1.39:
check that an output file is given before doing any other work.
avoids touching the audio device and then printing an error.

1.40:
move some more processing before opening the audio device. don't
default the encoding to ulaw; default it to what ever the device
has. the latter fixes PR#30612.

1.41:
play.c: allow empty files to exit gracefully rather than with an error
of "header seems really large". reported by wiz.

record.c: don't use total_size in the header if is -1 (it's initial value)
 1.38.2.1 19-Jul-2005  riz Pull up revisions 1.39-1.41 (requested by mrg in ticket #597):
1.39:
check that an output file is given before doing any other work.
avoids touching the audio device and then printing an error.

1.40:
move some more processing before opening the audio device. don't
default the encoding to ulaw; default it to what ever the device
has. the latter fixes PR#30612.

1.41:
play.c: allow empty files to exit gracefully rather than with an error
of "header seems really large". reported by wiz.
record.c: don't use total_size in the header if is -1 (it's initial value)
 1.43.12.2 09-Jan-2008  matt sync with HEAD
 1.43.12.1 06-Nov-2007  matt sync with HEAD
 1.45.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.45.4.1 04-Jun-2008  yamt sync with head
 1.46.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.52.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.52.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.54.18.2 23-Aug-2024  martin Pull up following revision(s) (requested by mrg in ticket #1874):

usr.bin/audio/common/wav.c: revision 1.23
usr.bin/audio/record/record.c: revision 1.59

fix some sizeof() confusion.

using "const char search[4]" as a function parameter means that
"search" is actually a pointer type so "sizeof search" returns
8 on 64-bit platforms. i mis-read this and used "sizeof *search"
which is always 1, noted by rillig.

instead of trying to avoid writing "4" twice, put it in a define
and use that in various places instead. annoying.
match message & conversion function name properly.

probably should make this into an array with two members.
 1.54.18.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.54.8.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.56.2.2 23-Aug-2024  martin Pull up following revision(s) (requested by mrg in ticket #797):

usr.bin/audio/common/wav.c: revision 1.23
usr.bin/audio/record/record.c: revision 1.59

fix some sizeof() confusion.

using "const char search[4]" as a function parameter means that
"search" is actually a pointer type so "sizeof search" returns
8 on 64-bit platforms. i mis-read this and used "sizeof *search"
which is always 1, noted by rillig.

instead of trying to avoid writing "4" twice, put it in a define
and use that in various places instead. annoying.
match message & conversion function name properly.

probably should make this into an array with two members.
 1.56.2.1 12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)

RSS XML Feed