I'm developing an extensible multimedia library... my audio output module based on ALSA libraries doesn't work, so I'm trying to find out the solution.

* What's the meaning of the period size and periods in PCM hardware parameters? snd_pcm_hw_params_set_{period_size,periods}; Why I should use them? Which values I use? Why?

* My sound skips seconds, my audio time cursor doesn't advance continuosly but in @1 second or less steps... I actually open the ALSA device in blocking mode, decoding audio data each cycle (filling the PCM buffer each time as much as possible) (NOTE: audio input is a wav file, so I'm in doubt that the problem is the wave data retrieval). I've used also the non-blocking mechanism with poll/select, it's sounds better; however it has the same problems... (beh... I'm not sure how control it, but I've tried) Well... bad code... because it also craches (the backtrace indicates the snd_pcm_writei!!! The buffer is the same each cycle, and the "decoder" write on it each cycle!)

I'm working on this code by 1 week (but I've worked much more to write and make it work!!!), basing also MPlayer code (effectively I'm learned a lot with that code!), but something is always dark to me. I don't include code because are multiple files, many declarations and 1000+ lines...

@10 are left.... HEEEEEEEEEEEELP!