Re: Vanilla Blocked I/O probs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Takashi

I went for this :

/*******************************************************/
void
record_block (void *buffer)
{
  int rc, needed = MAX_LEN;
  void *buf_ptr = buffer;

  do
  {
    rc = snd_pcm_readi (handle, buf_ptr, needed);
    needed -= rc;
    buf_ptr += rc * (stereo_channel ? BPSSTEREO : BPSMONO);
  }
  while (needed);

}                               /* end record_block */
/****************************************************/

I have a global variable "stereo_channel" as you see that is 0 (mono), 1 
(stereo left only) or 2 (stereo right only). If it is non-zero I 
multiply by BPSSTEREO (4) else BPSMONO (2). So "needed" counts down to 
0, and buf_ptr moves along.

It's not pretty, but it works !

Gordon
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux