Re: [LAD] [ANN] Radium V1.9.1

From: Erik de Castro Lopo <mle+la@email-addr-hidden-nerd.com>
Date: Mon Nov 12 2012 - 00:00:29 EET

Kjetil Matheussen wrote:

> Done:
> https://github.com/erikd/libsndfile/issues/25
>
> I've linked to a reproducable test case there.

Please don't CC email on this mail list. I am subscribed.

Also, to post code in a github ticket you need to make sure whole
block is indented by 4 spaces or more.

My update from github:

> Sorry, this code:
>
> while(frames_read < sf_info.frames){
> float samples[1024*sf_info.channels];
>
> int read_now = sf_readf_float(sndfile, samples, 1024);
> printf("read_now: %d. frames_read: %d. num_frames: %d.\n",read_now,
> frames_read,(int)sf_info.frames);
>
> frames_read += read_now;
> }
>
> should be considered broken.
>
> The value in sf_info.frames can be incorrect (some validation and
> correction is done, but it is not foolproof). The correct usage is
> something like:
>
> float samples[1024*sf_info.channels];
> while((read_now = sf_readf_float(sndfile, samples, 1024)) > 0){
>
> printf("read_now: %d. frames_read: %d. num_frames: %d.\n",read_now,
> frames_read,(int)sf_info.frames);
>
> frames_read += read_now;
> }
>
> PS : The only way to ensure that sf_info.frames is correct is to read
> in the whole file and that would be slow for anything other than the
> shortest of files.

Erik

-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Mon Nov 12 00:15:05 2012

This archive was generated by hypermail 2.1.8 : Mon Nov 12 2012 - 00:15:05 EET