ref: eaee767f05f103638540fdd3bd31887a1aab47d6
parent: 23493b5899b2e52a43362b2945cd301b573d2857
author: Paul Brossier <[email protected]>
date: Thu Apr 21 15:30:25 EDT 2016
src/synth/sampler.c: keeps a copy of uri
--- a/src/synth/sampler.c
+++ b/src/synth/sampler.c
@@ -55,10 +55,14 @@
return NULL;
}
-uint_t aubio_sampler_load( aubio_sampler_t * o, char_t * uri )
+uint_t aubio_sampler_load( aubio_sampler_t * o, const char_t * uri )
{
if (o->source) del_aubio_source(o->source);
- o->uri = uri;
+
+ if (s->uri) AUBIO_FREE(s->uri);
+ s->uri = AUBIO_ARRAY(char_t, strnlen(uri, PATH_MAX));
+ strncpy(s->uri, uri, strnlen(uri, PATH_MAX));
+
o->source = new_aubio_source(uri, o->samplerate, o->blocksize);
if (o->source) return 0;
AUBIO_ERR("sampler: failed loading %s", uri);
@@ -65,7 +69,7 @@
return 1;
}
-void aubio_sampler_do ( aubio_sampler_t * o, fvec_t * input, fvec_t * output)
+void aubio_sampler_do ( aubio_sampler_t * o, const fvec_t * input, fvec_t * output)
{
uint_t read = 0, i;
if (o->playing) {
@@ -82,7 +86,7 @@
}
}
-void aubio_sampler_do_multi ( aubio_sampler_t * o, fmat_t * input, fmat_t * output)
+void aubio_sampler_do_multi ( aubio_sampler_t * o, const fmat_t * input, fmat_t * output)
{
uint_t read = 0, i, j;
if (o->playing) {
@@ -103,7 +107,7 @@
}
}
-uint_t aubio_sampler_get_playing ( aubio_sampler_t * o )
+uint_t aubio_sampler_get_playing ( const aubio_sampler_t * o )
{
return o->playing;
}
@@ -130,6 +134,7 @@
if (o->source) {
del_aubio_source(o->source);
}
+ if (s->uri) AUBIO_FREE(s->uri);
del_fvec(o->source_output);
del_fmat(o->source_output_multi);
AUBIO_FREE(o);