Re: [LAD] using libsndfile to write signed short

From: Cedric Roux <sed@email-addr-hidden>
Date: Fri Sep 26 2014 - 11:20:34 EEST

On 09/25/2014 11:50 PM, Joël Krähemann wrote:
> void
> ags_sndfile_write(AgsPlayable *playable, signed short *buffer, guint
> buffer_length)
> {
> AgsSndfile *sndfile;
> sf_count_t multi_frames, retval;
>
> sndfile = AGS_SNDFILE(playable);
>
> multi_frames = buffer_length;
> retval = sf_write_short(sndfile->file, buffer, multi_frames);

If buffer_length gives the number of bytes of the buffer,
you may be in trouble here. For sf_write_short, /usr/include/sndfile.h
says:
** All of these read/write function return number of items read/written.
See also the libsndfile FAQ:
http://www.mega-nerd.com/libsndfile/FAQ.html#Q012

HTH

>
> if(retval > multi_frames){
> // sf_seek(sndfile->file, (multi_frames - retval),
> SEEK_CUR);
> }
> }
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Fri Sep 26 12:15:02 2014

This archive was generated by hypermail 2.1.8 : Fri Sep 26 2014 - 12:15:02 EEST