From: Takashi Iwai Subject: Re: Best way of adding temporary limits to capture or playback Date: Wed, 17 May 2006 11:42:26 +0200 Message-ID: References: <44696908.4070208@atmel.com> <4469ACEB.4090705@norway.atmel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <4469ACEB.4090705@norway.atmel.com> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Hans-Christian Egtvedt Cc: Hans-Christian Egtvedt , alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Tue, 16 May 2006 12:43:55 +0200, Hans-Christian Egtvedt wrote: > > Takashi Iwai wrote: > > At Tue, 16 May 2006 07:54:16 +0200, > > Hans-Christian Egtvedt wrote: > > > > >> My current plan is to change the hardware parameters in the playback > >> open and capture open callbacks if there is an active playback or > >> capture already present. And then reset this hardware limit when the > >> close callback is called. > > > > Right, that's what other drivers do, too. > > I've added restrictions to format and rate in the open callback. Is it > safe to just do changes here and ignore them in the close callback? > > AFAIK when the open callback is called again, for a later stream the > original driver formats and rates will be loaded? > > I.e. the driver does not remember that sometime in the past it was > limited to a certain hardware setup? Well, we have a couple of different implementations. In any way, the driver keeps the (global) current rate and format. For example, A) Make mixer or PCM control elements for the current rate and format, and pcm open just copies that value. You need to keep both the value being used (when a stream is actually opened) and the value to be set at the next open (the control element value). B) Initialize the current rate and format to unknown (free) state. The first hw_params sets the format and rate. When another stream is opened at the same time, open callback copies this restriction. The rate and format is then reset to uknown state when all streams are closed again. Takashi ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642