struct _aubio_sampler_t {
uint_t samplerate;
uint_t blocksize;
+ uint_t duration;
// current reading mode (can be a file or an array)
uint_t reading_from;
// current interpolation mode (can be quadratic, timestretch, ...)
}
s->samplerate = samplerate;
s->blocksize = blocksize;
+ s->duration = 0;
s->source = NULL;
s->playing = 0;
s->loop = 0;
o->eof_remaining = 0;
o->opened = 1;
ret = AUBIO_OK;
+ o->duration = duration;
AUBIO_MSG("sampler: loaded %s\n", uri);
#ifdef HAVE_THREADS
if (o->waited) {
}
uint_t
+aubio_sampler_get_duration (aubio_sampler_t *o)
+{
+ if (o->duration !=0) {
+ return o->duration;
+ } else {
+ AUBIO_WRN("sampler: failed getting duration for %s\n", o->uri);
+ return 0;
+ }
+}
+
+uint_t
aubio_sampler_get_opened (aubio_sampler_t *o)
{
return o->opened; //== 1 ? AUBIO_OK : AUBIO_FAIL;
*/
uint_t aubio_sampler_get_samplerate(aubio_sampler_t * o);
+/** get duration
+
+ \param o sampler, created by new_aubio_sampler()
+
+ \return duration of the opened uri, in samples
+
+*/
+uint_t aubio_sampler_get_duration(aubio_sampler_t * o);
+
/** get the number of samples that were set to zero while opening a file
\param o sampler, created by new_aubio_sampler()