I am trying to access C values stored in the Aubio library and believe it's how I am accessing the Struct value.
The library has C Struct and fvec_get_data function:
typedef struct {
uint_t length; /**< length of buffer */
smpl_t *data; /**< data vector of length ::fvec_t.length */
} fvec_t;
//in fvec.c
smpl_t * fvec_get_data(const fvec_t *s) {
return s->data;
}
Back to swift I then read in the data as suggested:
let oout = new_fvec(n_coefs)
let c = new_aubio_mfcc(win_s, n_filters, n_coefs, samplerate);
var read: uint_t = 0
var dataStore = [smpl_t]()
while (true) {
aubio_source_do(b, a, &read)
aubio_mfcc_do(c, iin, oout)
dataStore.append(fvec_get_data(oout).pointee)
total_frames += read
if (read < hop_size) { break }
}
However this doesn't retrieve all the data, in the array only the first value. In comparison in the while loop you can call:
fvec_print(oout) // this prints out ALL values not just the first
...
Looking at the c code that does this:
void fvec_print(const fvec_t *s) {
uint_t j;
for (j=0; j< s->length; j++) {
AUBIO_MSG(AUBIO_SMPL_FMT " ", s->data[j]);
}
AUBIO_MSG("\n");
}
Any suggestions on how to get all the values into Swift greatly appreciated.