* Application supporting forward/rewind APIs @ 2009-09-24 7:34 Anuj Aggarwal 2009-09-24 7:37 ` Takashi Iwai 0 siblings, 1 reply; 9+ messages in thread From: Anuj Aggarwal @ 2009-09-24 7:34 UTC (permalink / raw) To: alsa-devel Hi, I want to try the forward/rewind APIs supported by the ALSA library. Can someone point to an ALSA application which exercises these APIs? Best Regards, Anuj Aggarwal ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Application supporting forward/rewind APIs 2009-09-24 7:34 Application supporting forward/rewind APIs Anuj Aggarwal @ 2009-09-24 7:37 ` Takashi Iwai 2009-09-24 7:57 ` Raymond Yau 2009-10-07 6:58 ` Raymond Yau 0 siblings, 2 replies; 9+ messages in thread From: Takashi Iwai @ 2009-09-24 7:37 UTC (permalink / raw) To: Anuj Aggarwal; +Cc: alsa-devel At Thu, 24 Sep 2009 13:04:24 +0530, Anuj Aggarwal wrote: > > Hi, > > I want to try the forward/rewind APIs supported by the ALSA library. > Can someone point to an ALSA application which exercises these APIs? Pulseaudio is using snd_pcm_rewind(). About snd_pcm_forward(), I don't know of... Takashi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Application supporting forward/rewind APIs 2009-09-24 7:37 ` Takashi Iwai @ 2009-09-24 7:57 ` Raymond Yau 2009-09-24 9:01 ` Anuj Aggarwal 2009-10-07 6:58 ` Raymond Yau 1 sibling, 1 reply; 9+ messages in thread From: Raymond Yau @ 2009-09-24 7:57 UTC (permalink / raw) To: Alsa-devel Do you mean that there is no test program to verify the implementation is correct ? Some sound card 's hardware has FIFO buffer. For example , au88x0 according to patent 6167465 Additionally, a first-in-first-out (FIFO) buffer is established for the DMA channel. Then a DMA request is generated in order to begin filling the FIFO buffer with data from the first data segment 150(0) using the information provided by CPU 210. The FIFO buffer may be any suitable size capable of handling bus latencies while small enough such that the memory requirement is not overly burdensome. In one embodiment of the present invention, the FIFO buffer is 32 samples or words in depth, which would withstand a maximum bus latency of about 4 microseconds. By way of example, if 48 DMA channels trigger simultaneously, with a trigger level set at half the buffer size (16 samples), each DMA channel can wait 16 samples (20 microseconds per sample), or approximately 320 microseconds before running out of data. It seem that alsa-lib should not allow application to rewind the application pointer to hardware pointer since you cannot write the next sample because of FIFO buffer even using mmap read/write or bug in *snd_pcm_rewindable() ?* 2009/9/24 Takashi Iwai <tiwai@suse.de> > At Thu, 24 Sep 2009 13:04:24 +0530, > Anuj Aggarwal wrote: > > > > Hi, > > > > I want to try the forward/rewind APIs supported by the ALSA library. > > Can someone point to an ALSA application which exercises these APIs? > > Pulseaudio is using snd_pcm_rewind(). > About snd_pcm_forward(), I don't know of... > > > Takashi > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Application supporting forward/rewind APIs 2009-09-24 7:57 ` Raymond Yau @ 2009-09-24 9:01 ` Anuj Aggarwal 2009-09-26 3:59 ` Raymond Yau 0 siblings, 1 reply; 9+ messages in thread From: Anuj Aggarwal @ 2009-09-24 9:01 UTC (permalink / raw) To: Raymond Yau; +Cc: Alsa-devel Yeah, I am looking for some sample application to test forward/rewind functionality. Regards, Anuj On Thu, Sep 24, 2009 at 1:27 PM, Raymond Yau <superquad.vortex2@gmail.com> wrote: > Do you mean that there is no test program to verify the implementation is > correct ? > > Some sound card 's hardware has FIFO buffer. > > For example , au88x0 > > according to patent 6167465 > > Additionally, a first-in-first-out (FIFO) buffer is established for the DMA > channel. Then a DMA request is generated in order to begin filling the FIFO > buffer with data from the first data segment 150(0) using the information > provided by CPU 210. > > > The FIFO buffer may be any suitable size capable of handling bus latencies > while small enough such that the memory requirement is not overly > burdensome. In one embodiment of the present invention, the FIFO buffer is > 32 samples or words in depth, which would withstand a maximum bus latency of > about 4 microseconds. By way of example, if 48 DMA channels trigger > simultaneously, with a trigger level set at half the buffer size (16 > samples), each DMA channel can wait 16 samples (20 microseconds per sample), > or approximately 320 microseconds before running out of data. > > > It seem that alsa-lib should not allow application to rewind the application > pointer to hardware pointer since you cannot write the next sample because > of FIFO buffer even using mmap read/write > > or bug in *snd_pcm_rewindable() ?* > > > 2009/9/24 Takashi Iwai <tiwai@suse.de> > >> At Thu, 24 Sep 2009 13:04:24 +0530, >> Anuj Aggarwal wrote: >> > >> > Hi, >> > >> > I want to try the forward/rewind APIs supported by the ALSA library. >> > Can someone point to an ALSA application which exercises these APIs? >> >> Pulseaudio is using snd_pcm_rewind(). >> About snd_pcm_forward(), I don't know of... >> >> >> Takashi >> _______________________________________________ >> Alsa-devel mailing list >> Alsa-devel@alsa-project.org >> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel >> > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > -- Best Regards, Anuj Aggarwal ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Application supporting forward/rewind APIs 2009-09-24 9:01 ` Anuj Aggarwal @ 2009-09-26 3:59 ` Raymond Yau 2009-09-29 9:13 ` Anuj Aggarwal 0 siblings, 1 reply; 9+ messages in thread From: Raymond Yau @ 2009-09-26 3:59 UTC (permalink / raw) To: alsa-devel It seem that the current implementation , it seem that the application can rewind the application pointer to hardware pointer , rewrite the next sample.for all drivers static snd_pcm_sframes_t snd_pcm_hw_rewindable(snd_pcm_t *pcm) { return snd_pcm_mmap_hw_avail(pcm); } However this is almost impossible for any sound cards since the hardware register just report the number of samples processed. this mean that the sound card is already processing the next sample. 2009/9/24 Anuj Aggarwal <anuj.aggarwal@gmail.com> > Yeah, I am looking for some sample application to test forward/rewind > functionality. > > Regards, > Anuj > > On Thu, Sep 24, 2009 at 1:27 PM, Raymond Yau > <superquad.vortex2@gmail.com> wrote: > > Do you mean that there is no test program to verify the implementation is > > correct ? > > > > Some sound card 's hardware has FIFO buffer. > > > > For example , au88x0 > > > > according to patent 6167465 > > > > Additionally, a first-in-first-out (FIFO) buffer is established for the > DMA > > channel. Then a DMA request is generated in order to begin filling the > FIFO > > buffer with data from the first data segment 150(0) using the information > > provided by CPU 210. > > > > > > The FIFO buffer may be any suitable size capable of handling bus > latencies > > while small enough such that the memory requirement is not overly > > burdensome. In one embodiment of the present invention, the FIFO buffer > is > > 32 samples or words in depth, which would withstand a maximum bus latency > of > > about 4 microseconds. By way of example, if 48 DMA channels trigger > > simultaneously, with a trigger level set at half the buffer size (16 > > samples), each DMA channel can wait 16 samples (20 microseconds per > sample), > > or approximately 320 microseconds before running out of data. > > > > > > It seem that alsa-lib should not allow application to rewind the > application > > pointer to hardware pointer since you cannot write the next sample > because > > of FIFO buffer even using mmap read/write > > > > or bug in *snd_pcm_rewindable() ?* > > > > > > 2009/9/24 Takashi Iwai <tiwai@suse.de> > > > >> At Thu, 24 Sep 2009 13:04:24 +0530, > >> Anuj Aggarwal wrote: > >> > > >> > Hi, > >> > > >> > I want to try the forward/rewind APIs supported by the ALSA library. > >> > Can someone point to an ALSA application which exercises these APIs? > >> > >> Pulseaudio is using snd_pcm_rewind(). > >> About snd_pcm_forward(), I don't know of... > >> > >> > >> Takashi > >> _______________________________________________ > >> Alsa-devel mailing list > >> Alsa-devel@alsa-project.org > >> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > >> > > _______________________________________________ > > Alsa-devel mailing list > > Alsa-devel@alsa-project.org > > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > > > > > > -- > Best Regards, > Anuj Aggarwal > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Application supporting forward/rewind APIs 2009-09-26 3:59 ` Raymond Yau @ 2009-09-29 9:13 ` Anuj Aggarwal 2009-09-29 9:42 ` Clemens Ladisch 0 siblings, 1 reply; 9+ messages in thread From: Anuj Aggarwal @ 2009-09-29 9:13 UTC (permalink / raw) To: Raymond Yau; +Cc: alsa-devel I found the solution, one can use mplayer to test forward/rewind feature of ALSA library. Regards, Anuj Aggarwal On Sat, Sep 26, 2009 at 9:29 AM, Raymond Yau <superquad.vortex2@gmail.com> wrote: > It seem that the current implementation , it seem that the application can > rewind the application pointer to hardware pointer , rewrite the next > sample.for all drivers > > > static snd_pcm_sframes_t snd_pcm_hw_rewindable(snd_pcm_t *pcm) > { > return snd_pcm_mmap_hw_avail(pcm); > } > > However this is almost impossible for any sound cards since the hardware > register just report the number of samples processed. this mean that the > sound card is already processing the next sample. > > > > > 2009/9/24 Anuj Aggarwal <anuj.aggarwal@gmail.com> > >> Yeah, I am looking for some sample application to test forward/rewind >> functionality. >> >> Regards, >> Anuj >> >> On Thu, Sep 24, 2009 at 1:27 PM, Raymond Yau >> <superquad.vortex2@gmail.com> wrote: >> > Do you mean that there is no test program to verify the implementation is >> > correct ? >> > >> > Some sound card 's hardware has FIFO buffer. >> > >> > For example , au88x0 >> > >> > according to patent 6167465 >> > >> > Additionally, a first-in-first-out (FIFO) buffer is established for the >> DMA >> > channel. Then a DMA request is generated in order to begin filling the >> FIFO >> > buffer with data from the first data segment 150(0) using the information >> > provided by CPU 210. >> > >> > >> > The FIFO buffer may be any suitable size capable of handling bus >> latencies >> > while small enough such that the memory requirement is not overly >> > burdensome. In one embodiment of the present invention, the FIFO buffer >> is >> > 32 samples or words in depth, which would withstand a maximum bus latency >> of >> > about 4 microseconds. By way of example, if 48 DMA channels trigger >> > simultaneously, with a trigger level set at half the buffer size (16 >> > samples), each DMA channel can wait 16 samples (20 microseconds per >> sample), >> > or approximately 320 microseconds before running out of data. >> > >> > >> > It seem that alsa-lib should not allow application to rewind the >> application >> > pointer to hardware pointer since you cannot write the next sample >> because >> > of FIFO buffer even using mmap read/write >> > >> > or bug in *snd_pcm_rewindable() ?* >> > >> > >> > 2009/9/24 Takashi Iwai <tiwai@suse.de> >> > >> >> At Thu, 24 Sep 2009 13:04:24 +0530, >> >> Anuj Aggarwal wrote: >> >> > >> >> > Hi, >> >> > >> >> > I want to try the forward/rewind APIs supported by the ALSA library. >> >> > Can someone point to an ALSA application which exercises these APIs? >> >> >> >> Pulseaudio is using snd_pcm_rewind(). >> >> About snd_pcm_forward(), I don't know of... >> >> >> >> >> >> Takashi >> >> _______________________________________________ >> >> Alsa-devel mailing list >> >> Alsa-devel@alsa-project.org >> >> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel >> >> >> > _______________________________________________ >> > Alsa-devel mailing list >> > Alsa-devel@alsa-project.org >> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel >> > >> >> >> >> -- >> Best Regards, >> Anuj Aggarwal >> > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > -- Best Regards, Anuj Aggarwal ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Application supporting forward/rewind APIs 2009-09-29 9:13 ` Anuj Aggarwal @ 2009-09-29 9:42 ` Clemens Ladisch 2009-10-02 3:53 ` Raymond Yau 0 siblings, 1 reply; 9+ messages in thread From: Clemens Ladisch @ 2009-09-29 9:42 UTC (permalink / raw) To: Anuj Aggarwal; +Cc: Raymond Yau, alsa-devel Anuj Aggarwal wrote: > I found the solution, one can use mplayer to test forward/rewind > feature of ALSA library. mplayer disables ALSA's underrun detection and uses snd_pcm_forward() to recover from an underrun, if it happens. (To force an underrun, press Ctrl+S (then Ctrl+Q) to prevent mplayer from updating its status line.) HTH Clemens ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Application supporting forward/rewind APIs 2009-09-29 9:42 ` Clemens Ladisch @ 2009-10-02 3:53 ` Raymond Yau 0 siblings, 0 replies; 9+ messages in thread From: Raymond Yau @ 2009-10-02 3:53 UTC (permalink / raw) To: alsa-devel Do you mean that the application can use snd_pcm_rewind() to rewind the application pointer to hardware pointer and rewrite the next sample ( behind the hardware pointer ) for usb audio driver ? ( real time mixing like pulseaudio ) 2009/9/29 Clemens Ladisch <clemens@ladisch.de> > Anuj Aggarwal wrote: > > I found the solution, one can use mplayer to test forward/rewind > > feature of ALSA library. > > mplayer disables ALSA's underrun detection and uses snd_pcm_forward() to > recover from an underrun, if it happens. > > (To force an underrun, press Ctrl+S (then Ctrl+Q) to prevent mplayer > from updating its status line.) > > > HTH > Clemens > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Application supporting forward/rewind APIs 2009-09-24 7:37 ` Takashi Iwai 2009-09-24 7:57 ` Raymond Yau @ 2009-10-07 6:58 ` Raymond Yau 1 sibling, 0 replies; 9+ messages in thread From: Raymond Yau @ 2009-10-07 6:58 UTC (permalink / raw) To: alsa-devel It seem that the difference between the application pointer and the hardware pointer is just the theoretical value which none of the sound card can achieve static snd_pcm_sframes_t snd_pcm_hw_rewindable(snd_pcm_t *pcm) { return snd_pcm_mmap_hw_avail(pcm); } To allow the application rewind the application pointer to hardware pointer and rewrite the next sample immediately at any time The audio controller have to fetch the audio data as the same rate as the sampling rate. The practical value may be the difference between the application pointer and the nearest period boundary 2009/9/24 Takashi Iwai <tiwai@suse.de> > At Thu, 24 Sep 2009 13:04:24 +0530, > Anuj Aggarwal wrote: > > > > Hi, > > > > I want to try the forward/rewind APIs supported by the ALSA library. > > Can someone point to an ALSA application which exercises these APIs? > > Pulseaudio is using snd_pcm_rewind(). > About snd_pcm_forward(), I don't know of... > > > Takashi > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-10-07 6:58 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-09-24 7:34 Application supporting forward/rewind APIs Anuj Aggarwal 2009-09-24 7:37 ` Takashi Iwai 2009-09-24 7:57 ` Raymond Yau 2009-09-24 9:01 ` Anuj Aggarwal 2009-09-26 3:59 ` Raymond Yau 2009-09-29 9:13 ` Anuj Aggarwal 2009-09-29 9:42 ` Clemens Ladisch 2009-10-02 3:53 ` Raymond Yau 2009-10-07 6:58 ` Raymond Yau
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.