From: Takashi Iwai Subject: Re: Mix audio at different frequencies Date: Mon, 15 May 2006 15:31:04 +0200 Message-ID: References: <1147429541.26309.3.camel@jazc.fedora> <1147676786.2963.1.camel@jazc.fedora> <000601c67812$4b80e240$8ca8a8c0@gmvsistemas.es> <44687F48.7080204@superbug.co.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <44687F48.7080204@superbug.co.uk> 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: James Courtier-Dutton Cc: Juan Antonio Zapatero Campo , alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Mon, 15 May 2006 14:16:56 +0100, James Courtier-Dutton wrote: > > Takashi Iwai wrote: > > At Mon, 15 May 2006 13:25:39 +0200, > > Juan Antonio Zapatero Campo wrote: > > > >> No, it returns wrong buffer sizes. Instead of 160 samples, which is what I > >> am expecting at 8000Hz, it returns a value of 341, which I do not > >> understand. > >> > > > > You cannot get always the exactly same buffer size you requested. > > Especially dmix limits the buffer size to its own and rate plugin > > rescales the size according to the rate conversion. > > > > > > Takashi > > > I would argue that maybe we should modify the way alsa behaves, and > somehow get dmix to work with user(application) defined buffer and > period sizes. > I.e. Let alsa handle whatever buffer and period size the user > application wants, and get ALSA to translate it into the sized needed > for the hardware. > Maybe implement the use of the system timer in order to trigger the > buffer events we need. The current handling of buffers in dmix is better than the earlier version. The buffer size has an upper limit of the slave PCM, and the minimum period size is also defined from the slave PCM. But you can choose freely between them. Though, still there are rooms for improvements. Anyway, you cannot use a bigger buffer than the slave PCM without another sound daemon or extra threading, regardless of dmix or hw layer. The point of dmix is that the copy (mixing) of data is done by the application itself, not by the daemon. When an app writes a bigger chunk than slave PCM and gets sleep, you'll get underrun because no one updates/syncs the data between the slave PCM and the app buffer. The current dmix code allows you to specify a bigger buffer than slave PCM (by passing a large number to max_periods parameter), but I already hit this problem. 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