[alsa-devel] Alsa asynchonus playnback

Martin schmidt schmidtmartin00 at googlemail.com
Tue Nov 29 12:28:33 CET 2011


Hello,

I want to play audiodata using alsa and do as it is explained in
http://alsa.opensrc.org/Asynchronous_Playback_%28Howto%29
http://equalarea.com/paul/alsa-audio.html#interruptex
1. open device
2 define a callback

void MyCallback(snd_async_handler_t *pcm_callback)   { ...  }


      err = snd_async_add_pcm_handler(&pcm_callback, pcm_handle,
MyCallback, NULL);
      if(err<0){
          fprintf (stderr, "err = %d --> snd_async_add_pcm_handler:
(%s)\n",err,snd_strerror (err));
      }

return -38 ( function is not implemented )???

i a loop I generate the audiodata

void produce_audiodata(short* left, short *right)
{

 for(int k = 0; k< max;k++){
  audio[2*k]= left[k];
  audio[2*k+1]= right[k];
  }
   Mycallback(...)  is it the right place to call it ?
}

thanks


More information about the Alsa-devel mailing list