Changes in src/io/source_sndfile.c [d5745af:48ebc3b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_sndfile.c
rd5745af r48ebc3b 19 19 */ 20 20 21 22 #include "config.h" 21 #include "aubio_priv.h" 23 22 24 23 #ifdef HAVE_SNDFILE … … 26 25 #include <sndfile.h> 27 26 28 #include "aubio_priv.h"29 27 #include "fvec.h" 30 28 #include "fmat.h" … … 33 31 #include "temporal/resampler.h" 34 32 35 #define MAX_CHANNELS 636 33 #define MAX_SIZE 4096 37 #define MAX_SAMPLES MAX_CHANNELS * MAX_SIZE34 #define MAX_SAMPLES AUBIO_MAX_CHANNELS * MAX_SIZE 38 35 39 36 #if !HAVE_AUBIO_DOUBLE … … 141 138 if (s->ratio > 1) { 142 139 // we would need to add a ring buffer for these 143 if ( (uint_t) (s->input_hop_size * s->ratio + .5) != s->hop_size ) {140 if ( (uint_t)FLOOR(s->input_hop_size * s->ratio + .5) != s->hop_size ) { 144 141 AUBIO_ERR("source_sndfile: can not upsample %s from %d to %d\n", s->path, 145 142 s->input_samplerate, s->samplerate); … … 298 295 uint_t aubio_source_sndfile_seek (aubio_source_sndfile_t * s, uint_t pos) { 299 296 uint_t resampled_pos = (uint_t)ROUND(pos / s->ratio); 300 sf_count_t sf_ret = sf_seek (s->handle, resampled_pos, SEEK_SET); 297 sf_count_t sf_ret; 298 if (s->handle == NULL) { 299 AUBIO_ERR("source_sndfile: failed seeking in %s (file not opened?)\n", 300 s->path); 301 return AUBIO_FAIL; 302 } 303 if ((sint_t)pos < 0) { 304 AUBIO_ERR("source_sndfile: could not seek %s at %d (seeking position" 305 " should be >= 0)\n", s->path, pos); 306 return AUBIO_FAIL; 307 } 308 sf_ret = sf_seek (s->handle, resampled_pos, SEEK_SET); 301 309 if (sf_ret == -1) { 302 310 AUBIO_ERR("source_sndfile: Failed seeking %s at %d: %s\n", s->path, pos, sf_strerror (NULL)); … … 313 321 uint_t aubio_source_sndfile_close (aubio_source_sndfile_t *s) { 314 322 if (!s->handle) { 315 return AUBIO_ FAIL;323 return AUBIO_OK; 316 324 } 317 325 if(sf_close(s->handle)) {
Note: See TracChangeset
for help on using the changeset viewer.