From: Paul Brossier Date: Fri, 25 Sep 2009 01:54:05 +0000 (+0200) Subject: ext/sndfileio.c: convert data from and to float if smpl_t != float X-Git-Tag: bzr2git~321 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d69e37d91c59ca538a17455ea6b5733de3ef300c;p=aubio.git ext/sndfileio.c: convert data from and to float if smpl_t != float --- diff --git a/ext/sndfileio.c b/ext/sndfileio.c index fd37bab3..ce4dc689 100644 --- a/ext/sndfileio.c +++ b/ext/sndfileio.c @@ -128,7 +128,7 @@ int aubio_sndfile_read(aubio_sndfile_t * f, int frames, fvec_t * read) { int i,j, channels = f->channels; int nsamples = frames*channels; int aread; - float *pread; + smpl_t *pread; /* allocate data for de/interleaving reallocated when needed. */ if (nsamples >= f->size) { @@ -148,9 +148,9 @@ int aubio_sndfile_read(aubio_sndfile_t * f, int frames, fvec_t * read) { /* de-interleaving data */ for (i=0; itmpdata[channels*j+i]; + pread[j] = (smpl_t)f->tmpdata[channels*j+i]; } } return aread; @@ -163,7 +163,7 @@ int aubio_sndfile_write(aubio_sndfile_t * f, int frames, fvec_t * write) { sf_count_t written_frames = 0; int i, j, channels = f->channels; int nsamples = channels*frames; - float *pwrite; + smpl_t *pwrite; /* allocate data for de/interleaving reallocated when needed. */ if (nsamples >= f->size) { @@ -178,9 +178,9 @@ int aubio_sndfile_write(aubio_sndfile_t * f, int frames, fvec_t * write) { /* interleaving data */ for (i=0; itmpdata[channels*j+i] = pwrite[j]; + f->tmpdata[channels*j+i] = (float)pwrite[j]; } } written_frames = sf_write_float (f->handle, f->tmpdata, nsamples);