Subject: kern/2589: src/sys/dev/audio.c
To: None <gnats-bugs@NetBSD.ORG>
From: None <rvb@cs.cmu.edu>
List: netbsd-bugs
Date: 07/01/1996 15:05:57
>Number:         2589
>Category:       kern
>Synopsis:       change of audio sampling rate not processes properly
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul  1 15:35:05 1996
>Last-Modified:
>Originator:     Robert V. Baron
>Organization:
	
>Release:        1.1
>Environment:
	
System: NetBSD strauss.coda.cs.cmu.edu 1.1 NetBSD 1.1 (CCODA) #14: Wed Jun 19 14:56:34 EDT 1996 bnoble@telemann.coda.cs.cmu.edu:/usr1/bnoble/kernel_tree/src/sys/arch/i386/compile/CCODA i386


>Description:
	The routine audiosetinfo() called by ioctl AUDIO_SETINFO treats 
changing the record/play sample rate incorrectly/inconsistently.  In
particular when you change the number of channels or precision, it does
                sc->sc_blksize = audio_blocksize = audio_calc_blksize(sc);
                audio_alloc_auzero(sc, sc->sc_blksize);
                bps = hw->get_precision(sc->hw_hdl) / NBBY;
                sc->sc_smpl_in_blk = sc->sc_blksize / bps;
                audio_initbufs(sc);
But this code is not invoked when the sample rate is changed.


>How-To-Repeat:
	
	You can see the problem by reading the code or by writing a
user program that prints out the audio blocksize.

>Fix:
	
Insert 
                sc->sc_blksize = audio_blocksize = audio_calc_blksize(sc);
                audio_alloc_auzero(sc, sc->sc_blksize);
                bps = hw->get_precision(sc->hw_hdl) / NBBY;
                sc->sc_smpl_in_blk = sc->sc_blksize / bps;
                audio_initbufs(sc);
at the end code which handles both the record and play sample rate adjustment.
>Audit-Trail:
>Unformatted: