From owner-freebsd-multimedia@FreeBSD.ORG Wed Dec 10 16:35:46 2003 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9443D16A4CE for ; Wed, 10 Dec 2003 16:35:46 -0800 (PST) Received: from puma.icir.org (puma.icir.org [192.150.187.73]) by mx1.FreeBSD.org (Postfix) with ESMTP id 44EA643D30 for ; Wed, 10 Dec 2003 16:35:45 -0800 (PST) (envelope-from hodson@puma.icir.org) Received: from puma.icir.org (localhost [127.0.0.1]) by puma.icir.org (8.12.9p1/8.12.3) with ESMTP id hBB0ZiNc013558; Wed, 10 Dec 2003 16:35:45 -0800 (PST) (envelope-from hodson@puma.icir.org) Message-Id: <200312110035.hBB0ZiNc013558@puma.icir.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.3 To: Michael Nottebrock From: Orion Hodson In-Reply-To: Your message of "Wed, 10 Dec 2003 22:20:57 +0100." <200312102221.03613.michaelnottebrock@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 10 Dec 2003 16:35:44 -0800 Sender: hodson@icir.org cc: multimedia@freebsd.org Subject: Fixed rate codec with vchans [ was Re: Problem with snd_ich and vchans ] X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2003 00:35:46 -0000 /-- Michael Nottebrock wrote: | | pcm0: port 0xe800-0xe83f,0xec00-0xecff irq 10 at dev= | ice=20 | 31.5 on pci0 | pcm0: | | running by default with hw.snd.pcm0.ac97rate: 48000. | | Now when I enable vchans, sound plays back to slowly (pitched down), fiddli= | ng=20 | with above sysctl doesn't have any effect. I found the following in vchan.c: | | /* XXX gross ugly hack, kill murder death */ | if (first && !err) { | err =3D chn_reset(parent, AFMT_STEREO | AFMT_S16_LE); | if (err) | printf("chn_reset: %d\n", err); | err =3D chn_setspeed(parent, 44100); | if (err) | printf("chn_setspeed: %d\n", err); | } | | When I change the 44100 to 48000 there, sound plays back normally with vcha= | ns enabled. Michael The ac97 codec is fixed rate (48kHz). The virtual channel code resamples all playback streams to 44.1kHz before mixing them and needs to arrange to plumb in a rate converter after the mixing step. Unfortunately, there's a bug in the planning code that doesn't allow this to happen correctly. The patch above is nicely avoids this problem for the case in hand. The bugs in the feeder planning code also affect recording and certain format selections (quite a lot of cases with fixed rate codecs). There's an attempted general case patch relative to -CURRENT in August: http://people.freebsd.org/~orion/files/ac97_fixed_rate_feeder.patch The patch was written at about the point I decided I wanted to take a break from the project and has not been committed. It touches quite a lot of code, but hopefully makes the feeder planning easier to reason about. Kind Regards - Orion