Subject: bin/8390: -f and -P are broken in audiplay
To: None <gnats-bugs@gnats.netbsd.org>
From: None <hackerb9@u.washington.edu>
List: netbsd-bugs
Date: 09/12/1999 19:02:47
>Number:         8390
>Category:       bin
>Synopsis:       Audioplay's -f and -e options don't work as advertised.
>Confidential:   yes
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 12 18:50:00 1999
>Last-Modified:
>Originator:     Ben Wong
>Organization:
University of Washington
>Release:        NetBSD 1.4.1
>Environment:
i386, NetBSD 1.4.1
System: NetBSD ursula.wongs.net 1.4.1 NetBSD 1.4.1 (AMNESIAC) #6: Sun Sep 12 20:44:36 EDT 1999 root@ursula.wongs.net:/usr/src/sys/arch/i386/compile/AMNESIAC i386


>Description:

audioplay -f is supposed to force audioplay to play a file even if it
doesn't recognize the format. This is broken since
play.c:audioctl_write_fromhdr() returns hdr_len instead of zero. This
causes -f to be ignored and the program quits complaining that the
header is unrecognized.

audioplay -P precision is supposed to set the number of bits per
sample. Unfortunately, there is a typo in the code such that instead of
setting info.play.precision it sets info.play.encoding. This makes -P
completely useless. This bug is also in audioctl_write_fromhdr().


>How-To-Repeat:
% audioplay -f /dev/zero
  [Should play silence, instead exits with an error].

% audioplay -P 16 file.wav
  [Should set precision to 16 but instead exits with an error].

>Fix:
Change Line 347 of play.c from:
	return (hdr_len);
to
	return 0;		/* Forced play: don't skip over header */

and then

Change line 340 of play.c from:

       			info.play.encoding = precision;
to			

			info.play.precision = precision;

>Audit-Trail:
>Unformatted: