From: Giuliano Pochini Subject: Re: alsa-lib Virtual Volume control Date: Tue, 18 Oct 2005 20:35:12 +0000 Message-ID: <20051018203512.4e03cb1e.pochini@shiny.it> References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: 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: Takashi Iwai Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org On 17-Oct-2005 Takashi Iwai wrote: >> I'm trying to create a virtual volume control that acts as >> a Line Playback Volume (or master, if you prefer). I modified >> control_hw.c in order to intercept r/w operations on the >> following controls: >> >> PCM out volume >> Monitor mixer >> Virtual volume >> >> On writes to PCM-out it has to write the values modified by vvol. >> That's ok, but how can I make alsa-lib to not deliver the events >> about PCM out when they are generated by a write to vvol ? > > I don't understand the question well, especially the relation among > the controls above. Which controls are "real" controls and which > are virtual? What kind of behavior is expected by each? They all become virtual because the real values of hw controls are not available for the user anymore. The user accesses to v_controls instead. "Virtual volume" (v_vol) is the software control I wish to add, without removing pcm and monitor volumes. All gains are expressed in dB. pcmvol and monitor (without the v_) are the real hw controls. Briefly, I want to do the following: v_vol.read(out) { return v_vol.gain[out] } v_vol.write(out, gain) { v_vol.gain[out]=gain; /**** do not deliver monitor and pcmout events here !! ****/ // v_vol acts as a master volume, so we tweak all output gains to simulate it for-each-input { monitor.write(out, in, v_monitor.gain[out][in] + v_vol.gain[out]); } pcmvol.write(out, v_pcmvol.gain[out] + v_vol.gain[out]); } v_pcmvol.read(out) { return v_pcmvol.gain[out]; } v_pcmvol.write(out, gain) { v_pcmvol.gain[out]=gain; pcmvol.write(out, v_pcmvol.gain[out] + v_vol.gain[out]); } v_monitor.read(out, in) { return v_monitor.gain[out][in]; } v_monitor.write(out, in, gain) { v_monitor.gain[out][in]=gain; monitor.write(out, in, v_monitor.gain[out][in] + v_vol.gain[out]); } -- Giuliano. ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl