On Mon, 10 Feb 2003, Maarten de Boer wrote:

> > There was a problem with refine code for pcm_plug, please, try again with 
> > latest CVS sources. Also, look to updated pcm_dmix plugin for implementing 
> > the "right" refine function.
> 
> Okay, this works fine now.
> 
> I am trying to do the following, using the mmap functionality. Let's
> start with playback.
> 
> As I understand, I can simple do a snd_pcm_mmap_hw_forward(pcm, size) in
> my snd_pcm_jack_mmap_commit op. Then, in the jack process callback, I

Nope. The snd_pcm_mmap_appl_forward(pcm, size) is the appropriate.

> can copy data from the areas = snd_pcm_mmap_areas(pcm) to the jack

Right.

> callback buffer. For this, I use the appl_ptr as the offset in the
> mmap_areas, and snd_pcm_mmap_appl_forward(pcm,n_jack_frames); to
> increase the appl_ptr. Said differently, I use the hw_ptr as the write
> index, and the appl_ptr as the read index. Is this approach correct?

I think that it should be opposite:

appl_ptr should be increased when application writes samples (commit) and
hw_ptr should be increased when jack callback processes samples

> Now, my problem is: how should I calculate the value returned my
> snd_pcm_jack_avail_update ? There are a lot of helper functions
> (mmap_avail, mmap_hw_avail, mmap_playback_avail, etc), which I suppose
> are ment for tasks like this, but I don't really understand how. I'm
> particularly confused my buffer_size vs boundary... Could you help me
> out with this?

I think that snd_pcm_mmap_avail() is ok. The boundary is a wrapper limit 
for the pointers. The pointer (appl_ptr or hw_ptr) is defined as offset in 
the ring buffer plus count of interrupts multiple the ring buffer size.

                                                Jaroslav

-----
Jaroslav Kysela <[EMAIL PROTECTED]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to