On Fri, 2014-09-26 at 10:20 +0200, Cedric Roux wrote: > 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); > > } > > }
This is how the buffer is allocated. Strange to me is multi_frames = buffer_length; or multi_frames = sndfile->file->info->channels * buffer_length; gives about the same size of file. /* buffer */ devout->buffer = (signed short **) malloc(4 * sizeof(signed short*)); devout->buffer[0] = (signed short *) malloc(devout->dsp_channels * devout->buffer_size * sizeof(signed short)); devout->buffer[1] = (signed short *) malloc(devout->dsp_channels * devout->buffer_size * sizeof(signed short)); devout->buffer[2] = (signed short *) malloc(devout->dsp_channels * devout->buffer_size * sizeof(signed short)); devout->buffer[3] = (signed short *) malloc(devout->dsp_channels * devout->buffer_size * sizeof(signed short)); _______________________________________________ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev