* Alsa asynchonus playnback
@ 2011-11-29 11:28 Martin schmidt
2011-11-29 13:29 ` Clemens Ladisch
0 siblings, 1 reply; 3+ messages in thread
From: Martin schmidt @ 2011-11-29 11:28 UTC (permalink / raw)
To: alsa-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Alsa asynchonus playnback
2011-11-29 11:28 Alsa asynchonus playnback Martin schmidt
@ 2011-11-29 13:29 ` Clemens Ladisch
[not found] ` <CAOONfQsONoj1bokU9xnQz6MvDps=o9M_3Bfk=zOEXv=PLiQJGA@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Clemens Ladisch @ 2011-11-29 13:29 UTC (permalink / raw)
To: Martin schmidt; +Cc: alsa-devel
Martin schmidt wrote:
> 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
These links describe two different mechanisms.
> return -38 ( function is not implemented )???
This is one of the reasons why you shouldn't use async notifications.
Is there a reason why you do want to use them?
Regards,
Clemens
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Alsa asynchonus playnback
[not found] ` <CAOONfQsONoj1bokU9xnQz6MvDps=o9M_3Bfk=zOEXv=PLiQJGA@mail.gmail.com>
@ 2011-11-29 15:14 ` Clemens Ladisch
0 siblings, 0 replies; 3+ messages in thread
From: Clemens Ladisch @ 2011-11-29 15:14 UTC (permalink / raw)
To: Martin schmidt; +Cc: alsa-devel
Martin schmidt wrote:
> my problem is, the sound has an Echo (in german Hall-Effekt).
>
> int write_to_audiostream(short*buf)
> {
> memcpy(audiobuffer[audiobuffercounter],buf,audio_buffersize*sizeof(short));
> int w= snd_pcm_writei (pcm_handle, audiobuffer[audiobuffercounter], 2* audio_buffersize);
This looks correct (as long as the buffer is correctly filled).
Do you ever check w?
> audiobuffercounter = ++audiobuffercounter % 10;
It is a bad idea to disable compiler warnings, or to not heed them.
> in a Timer-Event
Why a timer? How is the timer synchronized to the sample clock?
Regards,
Clemens
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-29 15:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-29 11:28 Alsa asynchonus playnback Martin schmidt
2011-11-29 13:29 ` Clemens Ladisch
[not found] ` <CAOONfQsONoj1bokU9xnQz6MvDps=o9M_3Bfk=zOEXv=PLiQJGA@mail.gmail.com>
2011-11-29 15:14 ` Clemens Ladisch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.