From: Paul Brossier Date: Mon, 28 Nov 2016 13:57:07 +0000 (+0100) Subject: src/synth/sampler.c: also seek in table X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=886a7d80ba64281e675544d8b915dfb9efa386b0;p=aubio.git src/synth/sampler.c: also seek in table --- diff --git a/src/synth/sampler.c b/src/synth/sampler.c index ea6b0635..b9a9e8a0 100644 --- a/src/synth/sampler.c +++ b/src/synth/sampler.c @@ -684,9 +684,11 @@ aubio_sampler_seek(aubio_sampler_t * o, uint_t pos) if (!o->opened) return AUBIO_OK; if (o->source) { ret = aubio_source_seek(o->source, pos); - } else { - o->table_index = pos; + } else if (o->table && (sint_t)pos >= 0 && pos < o->table->length) { + o->table_index = pos < o->table->length ? pos : o->table->length - 1; + ret = AUBIO_OK; } + o->last_read = 0; return ret; }