Mercurial > hg > audiodb
changeset 419:f3b5d8aebd17 api-inversion
Map out "new" audiodb_query() API.
author | mas01cr |
---|---|
date | Wed, 24 Dec 2008 10:54:51 +0000 |
parents | 9b13ea44e302 |
children | 580f696c817c |
files | audioDB_API.h |
diffstat | 1 files changed, 63 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/audioDB_API.h Wed Dec 24 10:54:48 2008 +0000 +++ b/audioDB_API.h Wed Dec 24 10:54:51 2008 +0000 @@ -18,7 +18,8 @@ /* This basically gets passed around to all of the other functions */ /* FIXME: it might be that "adb_" isn't such a good prefix to use, and - that we should prefer "audiodb_" */ + that we should prefer "audiodb_". Or else maybe we should be + calling ourselves libadb? */ typedef struct adb adb_t, *adb_ptr; struct adb_datum { @@ -74,40 +75,6 @@ }; typedef struct adbquery adb_query_t,*adb_query_ptr; -typedef struct adbresult { - const char *key; - double dist; - uint32_t qpos; - uint32_t ipos; -} adb_result_t; - -#define ADB_REFINE_KEYLIST 1 -#define ADB_REFINE_RADIUS 2 -#define ADB_REFINE_ABSOLUTE_THRESHOLD 4 -#define ADB_REFINE_RELATIVE_THRESHOLD 8 -#define ADB_REFINE_DURATION_RATIO 16 -#define ADB_REFINE_HOP_SIZE 32 - -typedef struct adbrefine { - uint32_t flags; - uint32_t nkeys; - const char **keys; - double radius; - double absolute_threshold; - double relative_threshold; - double duration_ratio; /* expandfactor */ - uint32_t hopsize; -} adb_refine_t; - -typedef struct adbqueryparameters { - uint32_t query_kind; -} adb_query_parameters_t; - -typedef struct adbqueryresults { - uint32_t nresults; - adb_result_t *results; -} adb_query_results_t; - /* ... and for getting query results back */ struct adbqueryresult { @@ -123,6 +90,65 @@ }; typedef struct adbqueryresult adb_queryresult_t, *adb_queryresult_ptr; +/* New ("new" == December 2008) query API */ + +typedef struct adbresult { + const char *key; + double dist; + uint32_t qpos; + uint32_t ipos; +} adb_result_t; + +#define ADB_REFINE_KEYLIST 1 +#define ADB_REFINE_RADIUS 2 +#define ADB_REFINE_ABSOLUTE_THRESHOLD 4 +#define ADB_REFINE_RELATIVE_THRESHOLD 8 +#define ADB_REFINE_DURATION_RATIO 16 +#define ADB_REFINE_HOP_SIZE 32 + +typedef struct adbqueryrefine { + uint32_t flags; + uint32_t nkeys; + const char **keys; + double radius; + double absolute_threshold; + double relative_threshold; + double duration_ratio; /* expandfactor */ + uint32_t hopsize; +} adb_query_refine_t; + +#define ADB_ACCUMULATION_DB 1 +#define ADB_ACCUMULATION_PER_TRACK 2 +#define ADB_ACCUMULATION_ONE_TO_ONE 3 + +#define ADB_DISTANCE_DOT_PRODUCT 1 +#define ADB_DISTANCE_EUCLIDEAN_NORMED 2 +#define ADB_DISTANCE_EUCLIDEAN 3 + +typedef struct adbqueryparameters { + uint32_t accumulation; + uint32_t distance; + uint32_t npoints; + uint32_t ntracks; +} adb_query_parameters_t; + +typedef struct adbqueryresults { + uint32_t nresults; + adb_result_t *results; +} adb_query_results_t; + +typedef struct adbqueryid { + adb_datum_t *datum; + uint32_t sequence_length; + uint32_t sequence_start; + uint32_t exhaustive; +} adb_query_id_t; + +typedef struct adbqueryspec { + adb_query_id_t qid; + adb_query_parameters_t qparms; + adb_query_refine_t qrefines; +} adb_query_spec_t; /*******************************************************************/ /* Function prototypes for API */ @@ -149,7 +175,8 @@ /* query function */ int audiodb_query(adb_ptr mydb, adb_query_ptr adbq, adb_queryresult_ptr adbqres); - +int audiodb_query_csr(adb_t *, adb_query_spec_t *, adb_query_results_t *); + /* database status */ int audiodb_status(adb_ptr mydb, adb_status_ptr status);