Re: [linux-audio-dev] Reborn

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Reborn
From: Kjetil S. Matheussen (k.s.matheussen_AT_notam02.no)
Date: Wed Aug 21 2002 - 12:09:16 EEST


On Tue, 20 Aug 2002, Ingo Oeser wrote:

> > /* Consumer */
> >
> > int jackprocess (nframes_t nframes, void *arg){
> > int ch,i;
> > struct Jackplay *jackplay=(struct Jackplay *)arg;
> > int numch=jackplay->fftsound->samps_per_frame;
> > sample_t *out[numch];
> >
> > for(ch=0;ch<numch;ch++){
> > out[ch]= (sample_t *) jack_port_get_buffer (jackplay->jpc[ch].output_port, nframes);
> > memset(out[ch],0.0f,nframes*sizeof(sample_t));
>
> This doesn't work and isn't needed. The second argument will be
> intepreted as a byte. You also filling the buffer all the time,
> so zero initialisation is not necessary.
>
The reason for writing 0.0f instead of 0.0 is just to make it clear that
the array out[ch] contain floats.

The reason for for nulling out the buffer each time is because
of the following test: "if(jackplay->unread==0) break; in the proceeding
for-loop". The reamining part of the procedure doesnt allways
fill the buffer.

Now, what I could have done was, of course, just to fill out the remaining
buffer that wasnt written in the proceeding for-loop. However, the higher
performance gained by doing that would probably not be noticable. The
code that sends data to the JackWritePlay() routine uses xxx times more
cpu than just the jack-things.

And most important: the code would be harder to read.

-- 


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Wed Aug 21 2002 - 12:09:42 EEST