Mercurial > hg > audiodb
view libtests/0003/prog1.c @ 693:b1723ae7675e
begin work on sampling API
This is motivated by the need to be able to sample with arbitrary feature data
(e.g. from a feature file) against a database, for the JNMR "collections" paper
revisions or possible ISMIR paper revisions. That bit doesn't work yet, but
the C-ified version of the current functionality (sample db x db and
sample key x db) works to the level of anecdotal tests.
The general approach is to mirror the _query_spec() API, where a whole heap
of knobs and twiddles are available to the user. Unlike in the _query_spec()
API, not quite all of the knobs make sense (and even fewer are actually
implemented), but the basic idea is the same.
I pity the poor chump who will have to document all this.
author | mas01cr |
---|---|
date | Thu, 22 Apr 2010 21:03:47 +0000 |
parents | bcc7a6ddb2c8 |
children |
line wrap: on
line source
#include "audioDB_API.h" #include "test_utils_lib.h" int main(int argc, char **argv) { adb_t *adb; clean_remove_db(TESTDB); if(!(adb = audiodb_create(TESTDB, 0, 0, 0))) return 1; if(audiodb_l2norm(adb)) return 1; adb_datum_t datum = {1, 1, "testfeature", (double[1]) {1}, NULL, NULL}; if(audiodb_insert_datum(adb, &datum)) return 1; adb_query_id_t qid = {0}; qid.datum = &datum; qid.sequence_length = 1; qid.sequence_start = 0; adb_query_parameters_t parms = {ADB_ACCUMULATION_DB, ADB_DISTANCE_DOT_PRODUCT, 10, 0}; adb_query_refine_t refine = {0}; adb_query_spec_t spec; spec.qid = qid; spec.params = parms; spec.refine = refine; adb_query_results_t *results = audiodb_query_spec(adb, &spec); if(!results || results->nresults != 1) return 1; result_present_or_fail(results, "testfeature", 1, 0, 0); audiodb_query_free_results(adb, &spec, results); audiodb_close(adb); return 104; }