You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(42) |
Aug
(91) |
Sep
(97) |
Oct
(69) |
Nov
(16) |
Dec
(32) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(74) |
Feb
(109) |
Mar
(117) |
Apr
(86) |
May
(84) |
Jun
(47) |
Jul
(30) |
Aug
(25) |
Sep
(39) |
Oct
(59) |
Nov
(42) |
Dec
(38) |
2010 |
Jan
(30) |
Feb
(43) |
Mar
(59) |
Apr
(67) |
May
(29) |
Jun
(47) |
Jul
(48) |
Aug
(22) |
Sep
(22) |
Oct
(36) |
Nov
(40) |
Dec
(3) |
2011 |
Jan
(39) |
Feb
(21) |
Mar
(36) |
Apr
(35) |
May
(8) |
Jun
|
Jul
(14) |
Aug
(4) |
Sep
(10) |
Oct
(27) |
Nov
(1) |
Dec
|
2012 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(9) |
May
(1) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(15) |
Oct
(1) |
Nov
(3) |
Dec
(6) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
(5) |
May
|
Jun
(2) |
Jul
|
Aug
(5) |
Sep
(15) |
Oct
|
Nov
|
Dec
(1) |
2014 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2015 |
Jan
|
Feb
(5) |
Mar
|
Apr
(4) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
(19) |
Oct
|
Nov
|
Dec
(1) |
2016 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
|
Dec
(2) |
2017 |
Jan
(16) |
Feb
(8) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(7) |
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(5) |
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
(7) |
Apr
(14) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(8) |
Nov
(3) |
Dec
|
2023 |
Jan
(1) |
Feb
|
Mar
(12) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <di...@us...> - 2008-08-08 17:13:10
|
Revision: 1857 http://ftm.svn.sourceforge.net/ftm/?rev=1857&view=rev Author: diemo Date: 2008-08-08 17:13:18 +0000 (Fri, 08 Aug 2008) Log Message: ----------- print full status and modes protect against no sigma Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-08-07 13:14:09 UTC (rev 1856) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-08-08 17:13:18 UTC (rev 1857) @@ -33,6 +33,9 @@ #define MAX_FLOAT 0x7FFFFFFF +const char *kdtree_dmodestr[] = { "orthogonal", "hyperplane", "pca" }; +const char *kdtree_mmodestr[] = { "mean", "middle", "median" }; + fts_symbol_t kdtree_symbol = 0; fts_class_t *kdtree_class = 0; @@ -123,17 +126,20 @@ (t->dmode == dmode_orthogonal ? 1 : 2)); fts_post("\nTree Info:\n"); - fts_post("ndim = %i\n", t->ndim); - fts_post("ndata = %i (%.3f MB extern alloc size)\n", t->ndata, mbdata); - fts_post("nalloc = %i (%.3f MB index)\n", t->dataalloc, mbindex); - fts_post("maxheight = %i\n", t->maxheight); - fts_post("givenheight = %i\n", t->givenheight); - fts_post("height = %i\n", t->height); - fts_post("nnodes = %i (%.3f MB node struct)\n", t->nnodes, mbnodes); - fts_post("inner nodes = %i (%.3f MB node vectors)\n", t->ninner, mbinner); - fts_post("stack = %i (%.3f MB)\n", t->stack.alloc, mbstack); + fts_post("ndim = %d\n", t->ndim); + fts_post("ndata = %d (%.3f MB extern alloc size)\n", t->ndata, mbdata); + fts_post("nalloc = %d (%.3f MB index)\n", t->dataalloc, mbindex); + fts_post("maxheight = %d\n", t->maxheight); + fts_post("givenheight = %d\n", t->givenheight); + fts_post("height = %d\n", t->height); + fts_post("nnodes = %d (%.3f MB node struct)\n", t->nnodes, mbnodes); + fts_post("inner nodes = %d (%.3f MB node vectors)\n", t->ninner, mbinner); + fts_post("stack = %d (%.3f MB)\n", t->stack.alloc, mbstack); fts_post("total size = %.3f MB\n", MB(sizeof(kdtree_t)) + mbnodes + mbinner + mbindex + mbstack); + fts_post("sort mode = %d\n", t->sort); + fts_post("decomposition = %s\n", kdtree_dmodestr[t->dmode]); + fts_post("mean vector = %s\n", kdtree_mmodestr[t->mmode]); } void kdtree_raw_display (kdtree_t* t) @@ -159,7 +165,7 @@ for (l = 0; l < t->height; l++) { - fts_post("Level #%i nodes %d..%d splitdim %d\n", + fts_post("Level #%d nodes %d..%d splitdim %d\n", l, pow2(l) - 1, pow2(l+1) - 2, t->nodes[pow2(l) - 1].splitdim); for (n = pow2(l) - 1; n < pow2(l+1) - 1; n++) { Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-08-07 13:14:09 UTC (rev 1856) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-08-08 17:13:18 UTC (rev 1857) @@ -122,6 +122,10 @@ FTS_API fts_symbol_t kdtree_symbol; FTS_API fts_class_t *kdtree_class; +FTS_API const char *kdtree_dmodestr[]; +FTS_API const char *kdtree_mmodestr[]; + + /* get data element via indirection order array */ #define kdtree_get_element(t, i, j) fmat_get_element(t->data, t->dataindex[i], j) Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-07 13:14:09 UTC (rev 1856) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-08 17:13:18 UTC (rev 1857) @@ -175,7 +175,7 @@ /* determine dimension to split at (for the moment simply cycling through dimensions by tree level, skipping degenerate dimensions) */ - if (use_sigma) + if (use_sigma && t->sigma_nnz > 0) { splitdim = t->sigma_indnz[level % t->sigma_nnz]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-08-07 13:25:58
|
Revision: 1856 http://ftm.svn.sourceforge.net/ftm/?rev=1856&view=rev Author: diemo Date: 2008-08-07 13:14:09 +0000 (Thu, 07 Aug 2008) Log Message: ----------- use sigma weighting for building tree index search non-degenerate dimension with sigma > 0 if use_sigma flag is set Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-08-06 11:04:18 UTC (rev 1855) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-08-07 13:14:09 UTC (rev 1856) @@ -227,7 +227,7 @@ } -void kdtree_set (kdtree_t *self, fmat_t *data, fmat_t *sigma) +void kdtree_set (kdtree_t *self, fmat_t *data, fmat_t *sigma, int use_sigma) { int maxheight = floor(log2(fmat_get_m(data))); int givenheight = self->givenheight; @@ -250,10 +250,22 @@ kdtree_set_sigma(self, sigma); kdtree_init_data(self, height, fmat_get_m(data), fmat_get_n(data)); - kdtree_build(self); + kdtree_build(self, use_sigma); } +/* update non-zero sigma index list */ +int kdtree_update_sigmanz (kdtree_t *self) +{ + float *sigmaptr = fmat_get_ptr(self->sigma); + int j, nnz = 0; + for (j = 0; j < self->ndim; j++) + if (sigmaptr[j] != 0) + self->sigma_indnz[nnz++] = j; + self->sigma_nnz = nnz; + return nnz; +} + void kdtree_set_sigma (kdtree_t *self, fmat_t *sigma) { if (self->sigma) @@ -271,6 +283,7 @@ self->sigma_indnz = fts_realloc(self->sigma_indnz, fmat_get_n(self->sigma) * sizeof(*self->sigma)); + kdtree_update_sigmanz(self); } @@ -287,7 +300,7 @@ kdtree_t *self = (kdtree_t *) o; fmat_t *data = (fmat_t *) fts_get_object(at); - kdtree_set(self, data, self->sigma); + kdtree_set(self, data, self->sigma, 1); fts_set_object(ret, o); return fts_ok; Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-08-06 11:04:18 UTC (rev 1855) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-08-07 13:14:09 UTC (rev 1856) @@ -151,9 +151,10 @@ void kdtree_set_decomposition(kdtree_t *t, kdtree_dmode_t mode, void *param); void kdtree_clear_nodes (kdtree_t *self); -void kdtree_set (kdtree_t *self, fmat_t *data, fmat_t *sigma); +void kdtree_set (kdtree_t *self, fmat_t *data, fmat_t *sigma, int use_sigma); void kdtree_set_sigma (kdtree_t *self, fmat_t *sigma); -void kdtree_build (kdtree_t* t); +int kdtree_update_sigmanz (kdtree_t *self); +void kdtree_build (kdtree_t* t, int use_sigma); void kdtree_init_data (kdtree_t* t, int h, int vect_num, int dim); int kdtree_search_knn (kdtree_t *t, float* x, int stride, int k, float r, float *y, float *d); Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-06 11:04:18 UTC (rev 1855) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-07 13:14:09 UTC (rev 1856) @@ -159,26 +159,60 @@ } -/* return: 1 if node is well-behaved, 0 if node is degenerate, - i.e. all vectors have same distance (usually 0) to splitplane */ -static int decompose_node (kdtree_t *t, int node, int level) +/* determine hyperplane that splits node n in two child nodes + + return: 1 if node is well-behaved, 0 if node is degenerate, + i.e. all vectors have same distance (usually 0) to splitplane +*/ +static int decompose_node (kdtree_t *t, int node, int level, int use_sigma) { + int i, nice_node = 0, splitdim; + float *sigmaptr = use_sigma ? fmat_get_ptr(t->sigma) : NULL; + #if PROFILE_BUILD t->profile.mean++; #endif /* determine dimension to split at - (for the moment simply cycling through dimensions by tree level) */ - t->nodes[node].splitdim = level % t->ndim; + (for the moment simply cycling through dimensions by tree level, + skipping degenerate dimensions) */ + if (use_sigma) + { + splitdim = t->sigma_indnz[level % t->sigma_nnz]; + + for (i = 1; i < t->sigma_nnz; i++) /* try each dim at most once */ + { + if ((nice_node = check_node(t, node, splitdim))) + break; + + /* step shifted by height, to use extra dimensions */ + splitdim = t->sigma_indnz[(level + i) % t->sigma_nnz]; + } + } + else + { + splitdim = level % t->ndim; + for (i = 0; i < t->ndim; i++) /* try each dim at most once */ + { + if ((nice_node = check_node(t, node, splitdim))) + break; + + /* step shifted by height, to use extra dimensions */ + splitdim = (splitdim + t->height) % t->ndim; + } + } + t->nodes[node].splitdim = splitdim; + if (!nice_node) fts_post("warning: can't find non-degenerate dimension to split node %d at level %d, using dimension %d\n", node, level, splitdim); + /* always create node mean vector */ - t->nodes[node].mean = fmat_create(t->ndim, 1); + t->nodes[node].mean = fmat_create(t->ndim, 1); fts_object_refer((fts_object_t *) t->nodes[node].mean); switch (t->mmode) - { + { /* N.B.: middle and mean are only linearly affected by sigma */ case mmode_mean: if (t->dmode == dmode_orthogonal) - compute_mean(t, node, t->nodes[node].splitdim); + compute_mean(t, node, splitdim); else compute_mean(t, node, -1); /* all dimensions */ break; @@ -189,7 +223,7 @@ */ case mmode_middle: if (t->dmode == dmode_orthogonal) - compute_middle(t, node, t->nodes[node].splitdim); + compute_middle(t, node, splitdim); else compute_middle(t, node, -1); /* all dimensions */ break; @@ -198,7 +232,7 @@ /* compute and create node splitting hyperplane */ compute_splitplane(t, node, level); - return check_node(t, node, t->nodes[node].splitdim); + return nice_node; } @@ -364,12 +398,12 @@ t->ndata = i; t->nodes[0].endind = t->ndata - 1; - kdtree_build(t); + kdtree_build(t, 1); } #endif -void kdtree_build (kdtree_t* t) +void kdtree_build (kdtree_t* t, int use_sigma) { int l; // current level number int n; // current node number @@ -397,7 +431,7 @@ #endif for (n = nstart; n < nend; n++) { /* for all nodes at tree level l */ - if (decompose_node(t, n, l)) + if (decompose_node(t, n, l, use_sigma)) { /* well-behaved node */ #if DEBUG_KDTREEBUILD fts_post("Node #%i (%i..%i): mean = ", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-08-06 11:04:10
|
Revision: 1855 http://ftm.svn.sourceforge.net/ftm/?rev=1855&view=rev Author: diemo Date: 2008-08-06 11:04:18 +0000 (Wed, 06 Aug 2008) Log Message: ----------- use weighting also for node distance Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c trunk/ftm/ftmlib/classes/kdtreesearch.c Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-08-05 17:30:14 UTC (rev 1854) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-08-06 11:04:18 UTC (rev 1855) @@ -146,6 +146,7 @@ /* vector to node distance */ float distV2N (kdtree_t* t, const float *x, const int node); float distV2N_stride (kdtree_t* t, const float *x, int stride, const int node); +float distV2N_weighted (kdtree_t* t, const float *x, int stride, const float *sigma, const int node); void kdtree_set_decomposition(kdtree_t *t, kdtree_dmode_t mode, void *param); Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-05 17:30:14 UTC (rev 1854) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-06 11:04:18 UTC (rev 1855) @@ -211,37 +211,61 @@ { return vect[dim * stride] - mean[dim]; } +static float distV2orthoH_weighted (const float* vect, int stride, + float* mean, const float *sigma, int dim) +{ +#if DEBUG_KDTREEBUILD > 1 + fts_post("distV2orthoH_weighted on dim %d: (%f - %f) / %f = %f\n", + dim, vect[dim * stride], mean[dim], sigma[dim], + sigma[dim] > 0 ? (vect[dim * stride] - mean[dim]) / sigma[dim] : 0); +#endif + return sigma[dim] > 0 ? (vect[dim * stride] - mean[dim]) / sigma[dim] + : 0; +} /* vector to general plane node distance */ static float distV2H (const float* vect, float* plane, float* mean, - int vectDim, float norm) + int ndim, float norm) { // standard algebra computing int i; float dotprod = 0; - for(i = 0; i < vectDim; i++) + for(i = 0; i < ndim; i++) { dotprod += (vect[i] - mean[i]) * plane[i]; } return (dotprod / norm); } static float distV2H_stride (const float* vect, int stride, float* plane, - float* mean, int vectDim, float norm) + float* mean, int ndim, float norm) { // standard algebra computing int i, iv; float dotprod = 0; - for(i = 0, iv = 0; i < vectDim; i++, iv += stride) + for(i = 0, iv = 0; i < ndim; i++, iv += stride) { dotprod += (vect[iv] - mean[i]) * plane[i]; } return (dotprod / norm); } +static float distV2H_weighted (const float* vect, int stride, float* plane, + float* mean, const float *sigma, int ndim, float norm) +{ + // standard algebra computing + int i, iv; + float dotprod = 0; + for (i = 0, iv = 0; i < ndim; i++, iv += stride) + if (sigma[i] > 0) + dotprod += (vect[iv] - mean[i]) / sigma[i] * plane[i]; + return (dotprod / norm); +} + + /* vector to node distance */ float distV2N (kdtree_t* t, const float *x, const int node) { @@ -264,31 +288,21 @@ } } -float distV2N_stride (kdtree_t* t, const float *x, int stride, const int node) +float distV2N_weighted (kdtree_t* t, const float *x, int stride, + const float *sigma, const int node) { - node_t *n = &t->nodes[node]; + node_t *n = &t->nodes[node]; + float *mean = fmat_get_ptr(n->mean); #if PROFILE_BUILD t->profile.v2n++; #endif -#if DEBUG_KDTREEBUILD - if (node > t->ninner || - (n->split == NULL && t->dmode != dmode_orthogonal) || - (n->split != NULL && fmat_get_ptr(n->split) == NULL) || - n->splitdim < 0 || n->splitdim > t->ndim) - { - fts_post("error in distV2N!\n"); - return 0; - } -#endif - switch (t->dmode) { case dmode_orthogonal: - return distV2orthoH_stride(x, stride, fmat_get_ptr(n->mean), n->splitdim); + return distV2orthoH_weighted(x, stride, mean, sigma, n->splitdim); case dmode_hyperplane: - return distV2H_stride(x, stride, fmat_get_ptr(n->split), - fmat_get_ptr(n->mean), t->ndim, n->splitnorm); + return distV2H_weighted(x, stride, fmat_get_ptr(n->split), mean, sigma, t->ndim, n->splitnorm); default: fts_post("error: unknown mode %d", t->dmode); return 0; Modified: trunk/ftm/ftmlib/classes/kdtreesearch.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-08-05 17:30:14 UTC (rev 1854) +++ trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-08-06 11:04:18 UTC (rev 1855) @@ -5,7 +5,7 @@ #ifdef DEBUG -#define DEBUG_KDTREESEARCH 2 +#define DEBUG_KDTREESEARCH 0 #else #define DEBUG_KDTREESEARCH 0 #endif @@ -109,12 +109,12 @@ return sum; } -static float weighted_euclidean_distance (float* v1, int stride1, float* v2, float *sigma, int dim) +static float weighted_euclidean_distance (float* v1, int stride1, float* v2, float *sigma, int ndim) { int i, i1; float sum = 0; - for (i = 0, i1 = 0; i < dim; i++, i1 += stride1) + for (i = 0, i1 = 0; i < ndim; i++, i1 += stride1) if (sigma[i] > 0) { float diff = (v2[i] - v1[i1]) / sigma[i]; @@ -134,6 +134,7 @@ int kmax = 0; /* index of current kth neighbour */ int leaves_start = t->ninner; /* first leaf node */ float sentinel = (r == 0 ? MAX_FLOAT : r); + float *sigmaptr = fmat_get_ptr(t->sigma); float dxx; /* distance between 2 vectors */ int i; /* current processed vector */ @@ -169,7 +170,6 @@ { if (cur.node >= leaves_start) { /* leaf node: search through vectors linearly */ - float *sigmaptr = fmat_get_ptr(t->sigma); int istart = t->nodes[cur.node].startind; int iend = t->nodes[cur.node].endind; int i; @@ -209,8 +209,7 @@ /* insert into sorted list of distance */ while (pos > 0 && dxx < dist[pos - 1]) - { - /* move up */ + { /* move up */ dist[pos] = dist[pos - 1]; indx[pos] = indx[pos - 1]; pos--; @@ -230,7 +229,7 @@ } else { // branched node - float d = distV2N_stride(t, vector, stride, cur.node); + float d = distV2N_weighted(t, vector, stride, sigmaptr, cur.node); #if DEBUG_KDTREESEARCH fts_post("Inner node %d d %f cur.dist %f --> push max %f\n", cur.node, d, cur.dist, MAX(cur.dist, d*d)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-08-05 17:30:06
|
Revision: 1854 http://ftm.svn.sourceforge.net/ftm/?rev=1854&view=rev Author: diemo Date: 2008-08-05 17:30:14 +0000 (Tue, 05 Aug 2008) Log Message: ----------- check for degenerate dimensions -> swap loop is safe better printing Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c trunk/ftm/ftmlib/classes/kdtreesearch.c Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-08-05 10:25:58 UTC (rev 1853) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-08-05 17:30:14 UTC (rev 1854) @@ -126,13 +126,13 @@ fts_post("ndim = %i\n", t->ndim); fts_post("ndata = %i (%.3f MB extern alloc size)\n", t->ndata, mbdata); fts_post("nalloc = %i (%.3f MB index)\n", t->dataalloc, mbindex); - fts_post("height = %i\n", t->height); fts_post("maxheight = %i\n", t->maxheight); fts_post("givenheight = %i\n", t->givenheight); + fts_post("height = %i\n", t->height); fts_post("nnodes = %i (%.3f MB node struct)\n", t->nnodes, mbnodes); fts_post("inner nodes = %i (%.3f MB node vectors)\n", t->ninner, mbinner); fts_post("stack = %i (%.3f MB)\n", t->stack.alloc, mbstack); - fts_post("total size = %.3f MB)\n", + fts_post("total size = %.3f MB\n", MB(sizeof(kdtree_t)) + mbnodes + mbinner + mbindex + mbstack); } @@ -149,8 +149,9 @@ } } -void kdtree_data_display(kdtree_t* t) +void kdtree_data_display(kdtree_t* t, int print_data) { + float plane[t->ndim]; int l, n, i; fts_post("\nTree Data:\n"); @@ -158,21 +159,45 @@ for (l = 0; l < t->height; l++) { - fts_post("Level #%i nodes %d..%d\n", l, pow2(l) - 1, pow2(l+1) - 1); + fts_post("Level #%i nodes %d..%d splitdim %d\n", + l, pow2(l) - 1, pow2(l+1) - 2, t->nodes[pow2(l) - 1].splitdim); for (n = pow2(l) - 1; n < pow2(l+1) - 1; n++) { - fts_post(" node %d size %d <%d..%d> = (", - n, t->nodes[n].endind - t->nodes[n].startind + 1, - t->nodes[n].startind, t->nodes[n].endind); - for (i = t->nodes[n].startind; i <= t->nodes[n].endind; i++) + node_t *node = &t->nodes[n]; + + if (n < t->ninner) + { + fts_post(" inner node %d size %d <%d..%d> splitdim %d splitplane ", + n, node->size, node->startind, node->endind, node->splitdim); + + if (t->dmode == dmode_orthogonal) + { /* splitplane implicit orthogonal to splitdim */ + bzero(plane, t->ndim * sizeof(float)); + plane[node->splitdim] = 1; + vec_post(plane, 1, t->ndim, ""); + } + else + vec_post(fmat_get_ptr(node->split), 1, t->ndim, ""); + } + else + fts_post(" leaf node %d size %d <%d..%d> ", + n, node->size, node->startind, node->endind); + + if (print_data) + { + fts_post(" = ("); + for (i = node->startind; i <= node->endind; i++) { - fts_post("vec %d = ", t->dataindex[i]); + fts_post("%svec %d = ", (print_data >= 2 ? "\n " : ""), + t->dataindex[i]); vec_post(kdtree_get_vector(t, i), 1, t->ndim, - i < t->nodes[n].endind ? ", " : ""); + i < node->endind ? ", " : ""); } - fts_post(")\n"); - } - } + fts_post(")"); + } + fts_post("\n"); + } /* end for nodes n */ + } /* end for level l */ } @@ -369,7 +394,7 @@ else if (func == s_hyper) fts_set_object(ret, node->split); else if (func == fts_s_size) - fts_set_int(ret, node->endind - node->startind + 1); + fts_set_int(ret, node->size); else if (ac > 2 && fts_is_number(at + 2)) { int i = fts_get_number_int(at + 2); /* node-data vector to inspect */ @@ -412,7 +437,7 @@ kdtree_t *self = (kdtree_t *) o; kdtree_info_display(self); - kdtree_data_display(self); + kdtree_data_display(self, 1); return fts_ok; } Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-08-05 10:25:58 UTC (rev 1853) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-08-05 17:30:14 UTC (rev 1854) @@ -53,6 +53,7 @@ { int startind; /* index of first vector in node in dataindex array */ int endind; /* index of last vector in node in dataindex array */ + int size; /* number of vectors in node */ int splitdim; /* for dmode othogonal, dimension along which node is split*/ fmat_t *mean; /* mean vector (todo: median), always present */ @@ -135,7 +136,7 @@ void vec_post (float *v, int stride, int n, const char *suffix); void kdtree_info_display (kdtree_t* t); void kdtree_raw_display (kdtree_t* t); -void kdtree_data_display (kdtree_t* t); +void kdtree_data_display (kdtree_t* t, int print_data); void profile_clear (kdtree_t *t); void kdtree_stack_init (kdtree_stack_t *s, int size); Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-05 10:25:58 UTC (rev 1853) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-05 17:30:14 UTC (rev 1854) @@ -23,12 +23,12 @@ int i, j; if (dim < 0) - { + { /* all dimensions */ dstart = 0; dend = t->ndim; } else - { + { /* calculate mean only over given dimension */ dstart = dim; dend = dim + 1; #if DEBUG_KDTREEBUILD @@ -48,7 +48,7 @@ } #if DEBUG_KDTREEBUILD - fts_post("mean vect for node %d = ", node); + fts_post("mean vect for node %d (size %d) = ", node, nvector); vec_post(mean_ptr, 1, t->ndim, "\n"); #endif } @@ -91,7 +91,7 @@ if (x > max) max = x; } - mean_ptr[j] = (max + min) / 2.; + mean_ptr[j] = (max + min) / 2.; } #if DEBUG_KDTREEBUILD @@ -100,7 +100,30 @@ #endif } +/* return 1 if node is well-behaved, 0 if node is degenerate */ +static int check_node (kdtree_t *t, int node, int dim) +{ + int nstart = t->nodes[node].startind; + int nend = t->nodes[node].endind; + float min, max; + int i; + min = max = kdtree_get_element(t, nstart, dim); + + for (i = nstart + 1; i <= nend; i++) + { + float x = kdtree_get_element(t, i, dim); + + if (x < min) + min = x; + if (x > max) + max = x; + } + + return max != min; +} + + static int compare(float* currentVect, float* mean, int component) { // fts_post("compare %f and %f\n", mean[component], currentVect[component]); @@ -136,7 +159,9 @@ } -static void decompose_node (kdtree_t *t, int node, int level) +/* return: 1 if node is well-behaved, 0 if node is degenerate, + i.e. all vectors have same distance (usually 0) to splitplane */ +static int decompose_node (kdtree_t *t, int node, int level) { #if PROFILE_BUILD t->profile.mean++; @@ -172,6 +197,8 @@ /* compute and create node splitting hyperplane */ compute_splitplane(t, node, level); + + return check_node(t, node, t->nodes[node].splitdim); } @@ -335,10 +362,12 @@ int i, j; // loop counters /* Maximum length is equal to pow2(height-1) */ - if (pow2(t->height - 1) > t->ndata) + if (pow2(t->height - 1) > t->ndata || t->ndim == 0) { if (t->ndata == 0) - fts_post("tree is empty! \n"); + fts_post("tree is empty!\n"); + else if (t->ndim == 0) + fts_post("tree has 0 dimensions! Can't build!\n"); else fts_post("error: can't build this tree, try with a smaller height: %d > %d\n", pow2(t->height-1), t->ndata); @@ -354,37 +383,52 @@ #endif for (n = nstart; n < nend; n++) { /* for all nodes at tree level l */ - decompose_node(t, n, l); - + if (decompose_node(t, n, l)) + { /* well-behaved node */ #if DEBUG_KDTREEBUILD - fts_post("Node #%i (%i..%i): mean = ", - n, t->nodes[n].startind, t->nodes[n].endind); - vec_post(fmat_get_ptr(t->nodes[n].mean), 1, t->ndim, "\n"); + fts_post("Node #%i (%i..%i): mean = ", + n, t->nodes[n].startind, t->nodes[n].endind); + vec_post(fmat_get_ptr(t->nodes[n].mean), 1, t->ndim, "\n"); #endif - i = t->nodes[n].startind; - j = t->nodes[n].endind; + i = t->nodes[n].startind; + j = t->nodes[n].endind; - while (j > i) - { /* sort node vectors by distance to splitplane */ - while (distV2N(t, kdtree_get_vector(t, i), n) <= 0) - { - i++; // fts_post("i=%i\n", i); + while (i < j) + { /* sort node vectors by distance to splitplane */ + while (distV2N(t, kdtree_get_vector(t, i), n) <= 0) + { + i++; if (i >= t->ndata) fts_post("n %d: i=%d\n", n, i); + } + while (distV2N(t, kdtree_get_vector(t, j), n) > 0) + { + j--; if (j < 0) fts_post("n %d: j=%d\n", n, j); + } + if (i < j) + { + swap(t, i, j); // fts_post("swap %i and %i\n", i ,j); + } } - while (distV2N(t, kdtree_get_vector(t, j), n) > 0) - { - j--; // fts_post("j=%i\n", j); - } - if (j > i) - { - swap(t, i, j); // fts_post("swap %i and %i\n", i ,j); - } } + else + { /* degenerate node: all points on splitplane -> halve */ + int middle = (t->nodes[n].startind + t->nodes[n].endind) >> 1; + j = middle; + i = middle + 1; +#if DEBUG_KDTREEBUILD + fts_post("degenerate Node #%i (%i..%i): splitting at %d, %d mean = ", + n, t->nodes[n].startind, t->nodes[n].endind, j, i); + vec_post(fmat_get_ptr(t->nodes[n].mean), 1, t->ndim, "\n"); +#endif + } assert(2*n+2 < t->nnodes); t->nodes[2*n+1].startind = t->nodes[n].startind; // start index of left child of node n t->nodes[2*n+1].endind = j; // end index of left child of node n + t->nodes[2*n+1].size = j - t->nodes[n].startind + 1; + t->nodes[2*n+2].startind = i; // start index of right child of node n t->nodes[2*n+2].endind = t->nodes[n].endind; // end index of right child of node n + t->nodes[2*n+2].size = t->nodes[n].endind - i + 1; } } } @@ -408,6 +452,7 @@ { /* init root node */ t->nodes[0].startind = 0; t->nodes[0].endind = t->ndata - 1; + t->nodes[0].size = t->ndata; } /* init index list */ Modified: trunk/ftm/ftmlib/classes/kdtreesearch.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-08-05 10:25:58 UTC (rev 1853) +++ trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-08-05 17:30:14 UTC (rev 1854) @@ -5,7 +5,7 @@ #ifdef DEBUG -#define DEBUG_KDTREESEARCH 0 +#define DEBUG_KDTREESEARCH 2 #else #define DEBUG_KDTREESEARCH 0 #endif @@ -30,7 +30,7 @@ fts_free(s->buffer); } -static int stack_realloc (kdtree_stack_t *stack, int alloc) +static void stack_realloc (kdtree_stack_t *stack, int alloc) { #if DEBUG_KDTREESEARCH fts_post("kdtree: grow stack from d to %d\n", stack->alloc, alloc); @@ -62,9 +62,9 @@ if (s->size == 0) fts_post("stack empty\n"); else - for (i = s->size; i >= 0; i--) + for (i = s->size - 1; i >= 0; i--) { - fts_post("stack pos %d: node %3d, dist %f\n", + fts_post(" stack pos %d: node %3d, square dist %f\n", i, s->buffer[i].node, s->buffer[i].dist); } } @@ -131,14 +131,14 @@ int kdtree_search_knn (kdtree_t *t, float* vector, int stride, int k, const float r, /* out */ float *indx, float *dist) { - int i; // current processed vector - float dxx; // dxx = distance between 2 vectors - int kmax = 0; // index of current Kth neighbour + int kmax = 0; /* index of current kth neighbour */ int leaves_start = t->ninner; /* first leaf node */ - float sentinel = r == 0 ? MAX_FLOAT : r + 1e-6; + float sentinel = (r == 0 ? MAX_FLOAT : r); + float dxx; /* distance between 2 vectors */ + int i; /* current processed vector */ - kdtree_stack_t *s = &t->stack; - kdtree_stack_elem_t cur; // current (node, dist) couple + kdtree_stack_t *s = &t->stack; + kdtree_stack_elem_t cur; /* current (node, dist) couple */ if (t->ndata == 0) return 0; @@ -147,10 +147,8 @@ k = 1; // Init distances - for(i = 0; i < k; i++) - { + for (i = 0; i < k; i++) dist[i] = sentinel; - } // Init Search Stack stack_clear(s); @@ -167,7 +165,7 @@ #endif stack_pop(s, &cur); - if (cur.dist < dist[kmax]) // elimination rule + if (cur.dist <= dist[kmax]) // elimination rule { if (cur.node >= leaves_start) { /* leaf node: search through vectors linearly */ @@ -177,23 +175,21 @@ int i; #if DEBUG_KDTREESEARCH - fts_post("Leaf node p = %d cur.dist %f\n", - cur.node, cur.dist); + fts_post("Leaf node p = %d cur.dist %f\n", cur.node, cur.dist); #endif for (i = istart; i <= iend; i++) { dxx = weighted_euclidean_distance(vector, stride, - kdtree_get_vector(t, i), - sigmaptr, t->ndim); + kdtree_get_vector(t, i), sigmaptr, t->ndim); #if PROFILE_SEARCH t->profile.v2v++; #endif #if DEBUG_KDTREESEARCH - fts_post("distance = %f between vector %d ", dxx, i); + fts_post(" distance = %f between vector %d ", dxx, i); vec_post(kdtree_get_vector(t, i), 1, t->ndim, " and x "); vec_post(vector, stride, t->ndim, "\n"); #endif - if (dxx < dist[kmax]) + if (dxx <= dist[kmax]) { /* return original index in data and distance */ if (k == 1) { @@ -236,8 +232,8 @@ { // branched node float d = distV2N_stride(t, vector, stride, cur.node); #if DEBUG_KDTREESEARCH - fts_post("Inner node %d d %f cur.dist %f\n", - cur.node, d, cur.dist); + fts_post("Inner node %d d %f cur.dist %f --> push max %f\n", + cur.node, d, cur.dist, MAX(cur.dist, d*d)); #endif if (d < 0) { @@ -254,12 +250,8 @@ #if DEBUG_KDTREESEARCH else /* node can be eliminated from search */ { - if (cur.dist > dist[kmax]) - fts_post("eleminate node %d: dist %f > dist[kmax=%d] = %f\n", - cur.node, cur.dist, kmax, dist[kmax]); - else - fts_post("eleminate node %d: dist %f > r = %f\n", - cur.node, cur.dist, r); + fts_post("eliminate node %d (size %d): cur.dist %f > dist[kmax=%d] = %f\n", + cur.node, t->nodes[cur.node].size, cur.dist, kmax, dist[kmax]); } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-08-05 10:25:55
|
Revision: 1853 http://ftm.svn.sourceforge.net/ftm/?rev=1853&view=rev Author: borghesi Date: 2008-08-05 10:25:58 +0000 (Tue, 05 Aug 2008) Log Message: ----------- ftm.editor: ScoreEditor with images, waiting for a way to load ttf font Modified Paths: -------------- trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj trunk/ftm/externals/max/ftm.editor.cpp trunk/ftm/gui/Juce/common/EditorContainer.cpp trunk/ftm/gui/Juce/common/EditorContainer.h trunk/ftm/gui/Juce/common/ScoreEditor.cpp trunk/ftm/gui/Juce/common/imtrjuce.h trunk/ftm/patches/max/help/ftm.editor.help Added Paths: ----------- trunk/ftm/gui/Juce/common/EditorRuler.cpp trunk/ftm/gui/Juce/common/ImtrEditorData.cpp trunk/ftm/gui/Juce/common/ImtrEditorData.h Modified: trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj =================================================================== --- trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj 2008-08-04 18:10:32 UTC (rev 1852) +++ trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj 2008-08-05 10:25:58 UTC (rev 1853) @@ -192,9 +192,12 @@ 3B4E71160CC8E399006DFB5A /* MarkersTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B4E71150CC8E399006DFB5A /* MarkersTableView.cpp */; }; 3B7073BE0713F12300764C51 /* ftm.list.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B7073BD0713F04500764C51 /* ftm.list.c */; }; 3B8DE0FC0E10F962000757BC /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B8DE0FB0E10F962000757BC /* AppKit.framework */; }; + 3B95E85C0E40A49000B545D0 /* ImtrEditorData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B95E85A0E40A49000B545D0 /* ImtrEditorData.cpp */; }; + 3B95E85D0E40A49000B545D0 /* ImtrEditorData.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B95E85B0E40A49000B545D0 /* ImtrEditorData.h */; }; 3B99E1280E349FB3000AF43F /* MatrixEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B99E1270E349FB3000AF43F /* MatrixEditor.cpp */; }; 3B9D37B30E1CD6CC002ED38C /* EditorContainerListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B9D37B10E1CD6CC002ED38C /* EditorContainerListener.h */; }; 3B9D37B40E1CD6CC002ED38C /* InfoPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B9D37B20E1CD6CC002ED38C /* InfoPanel.cpp */; }; + 3BA14D210E4755C500F1A083 /* EditorRuler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BA14D200E4755C500F1A083 /* EditorRuler.cpp */; }; 3BA9E3B80E2513A500B88643 /* ScoreEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BA9E3B60E2513A500B88643 /* ScoreEditor.cpp */; }; 3BA9E3B90E2513A500B88643 /* ScoreTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BA9E3B70E2513A500B88643 /* ScoreTableView.cpp */; }; 3BBD0E020E261F6D0074EE11 /* BpfTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BBD0E010E261F6D0074EE11 /* BpfTableView.cpp */; }; @@ -614,9 +617,12 @@ 3B4E71150CC8E399006DFB5A /* MarkersTableView.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MarkersTableView.cpp; sourceTree = "<group>"; }; 3B7073BD0713F04500764C51 /* ftm.list.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ftm.list.c; sourceTree = "<group>"; }; 3B8DE0FB0E10F962000757BC /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; + 3B95E85A0E40A49000B545D0 /* ImtrEditorData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImtrEditorData.cpp; sourceTree = "<group>"; }; + 3B95E85B0E40A49000B545D0 /* ImtrEditorData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImtrEditorData.h; sourceTree = "<group>"; }; 3B99E1270E349FB3000AF43F /* MatrixEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MatrixEditor.cpp; sourceTree = "<group>"; }; 3B9D37B10E1CD6CC002ED38C /* EditorContainerListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorContainerListener.h; sourceTree = "<group>"; }; 3B9D37B20E1CD6CC002ED38C /* InfoPanel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InfoPanel.cpp; sourceTree = "<group>"; }; + 3BA14D200E4755C500F1A083 /* EditorRuler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditorRuler.cpp; sourceTree = "<group>"; }; 3BA9E3B60E2513A500B88643 /* ScoreEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScoreEditor.cpp; sourceTree = "<group>"; }; 3BA9E3B70E2513A500B88643 /* ScoreTableView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScoreTableView.cpp; sourceTree = "<group>"; }; 3BBD0E010E261F6D0074EE11 /* BpfTableView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BpfTableView.cpp; sourceTree = "<group>"; }; @@ -1136,6 +1142,9 @@ 3B35E1920C05AD2600567CE9 /* Juce */ = { isa = PBXGroup; children = ( + 3BA14D200E4755C500F1A083 /* EditorRuler.cpp */, + 3B95E85A0E40A49000B545D0 /* ImtrEditorData.cpp */, + 3B95E85B0E40A49000B545D0 /* ImtrEditorData.h */, 3BBD0E010E261F6D0074EE11 /* BpfTableView.cpp */, 3B9D37B10E1CD6CC002ED38C /* EditorContainerListener.h */, 3B9D37B20E1CD6CC002ED38C /* InfoPanel.cpp */, @@ -1320,6 +1329,7 @@ 3BE7C48D0DEC385D00A0B7A5 /* ImtrEditor.h in Headers */, 3BE7C48E0DEC385D00A0B7A5 /* ImtrEditorListener.h in Headers */, 3B9D37B30E1CD6CC002ED38C /* EditorContainerListener.h in Headers */, + 3B95E85D0E40A49000B545D0 /* ImtrEditorData.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3146,6 +3156,8 @@ 3BA9E3B90E2513A500B88643 /* ScoreTableView.cpp in Sources */, 3BBD0E020E261F6D0074EE11 /* BpfTableView.cpp in Sources */, 3B99E1280E349FB3000AF43F /* MatrixEditor.cpp in Sources */, + 3B95E85C0E40A49000B545D0 /* ImtrEditorData.cpp in Sources */, + 3BA14D210E4755C500F1A083 /* EditorRuler.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: trunk/ftm/externals/max/ftm.editor.cpp =================================================================== --- trunk/ftm/externals/max/ftm.editor.cpp 2008-08-04 18:10:32 UTC (rev 1852) +++ trunk/ftm/externals/max/ftm.editor.cpp 2008-08-05 10:25:58 UTC (rev 1853) @@ -718,6 +718,18 @@ } } + void setRulerProperty(fts_symbol_t prop, int ac, fts_atom_t *at) + { + if(prop == fts_s_visible) + { + if(ac == 1 && fts_is_number(at)) + editorContainer->setRulerVisible((fts_get_number_int(at) == 1)); + } + else if(prop == fts_s_style) + { + post("waring: message 'style' for infopanel not yet implemented!"); + } + } void setDomain(fts_symbol_t prop, int ac, fts_atom_t *at) { @@ -1438,6 +1450,19 @@ } } static void +ftmeditor_set_ruler(t_object *o, Symbol *s, short ac, Atom *at) +{ + ftmeditor_t *self = (ftmeditor_t*)o; + if(self->container != NULL && ac > 0) + { + if(ac > 1 && fts_is_symbol(at)) + { + self->container->setRulerProperty(fts_get_symbol(at), ac-1, at+1); + qelem_set(self->x_qelem); + } + } +} +static void ftmeditor_set_layout(t_object *o, Symbol *s, short ac, Atom *at) { ftmeditor_t *self = (ftmeditor_t*)o; @@ -1715,6 +1740,7 @@ addmess((method)ftmeditor_get_editor_property, "get", A_GIMME, 0); addmess((method)ftmeditor_set_infopanel, "infopanel", A_GIMME, 0); + addmess((method)ftmeditor_set_ruler, "ruler", A_GIMME, 0); addmess((method)ftmeditor_set_layout, "layout", A_GIMME, 0); addmess((method)ftmeditor_set_split, "split", A_GIMME, 0); addmess((method)ftmeditor_set_orientation, "orientation", A_GIMME, 0); Modified: trunk/ftm/gui/Juce/common/EditorContainer.cpp =================================================================== --- trunk/ftm/gui/Juce/common/EditorContainer.cpp 2008-08-04 18:10:32 UTC (rev 1852) +++ trunk/ftm/gui/Juce/common/EditorContainer.cpp 2008-08-05 10:25:58 UTC (rev 1853) @@ -314,6 +314,7 @@ dscroll = NULL; infoPanel = NULL; + editorRuler = NULL; backcolor = /*JUCE_EDITOR_NAMESPACE::Colour(126, 132, 178)*/JUCE_EDITOR_NAMESPACE::Colours::white; selectionColorAsBackground = true; regionSelectionColor = backcolor.brighter(); @@ -334,6 +335,7 @@ infopanel_size = INFOPANEL_DEFAULT_SIZE; initInfoPanel(); + initEditorRuler(); InitContainer(); InitTools(); } @@ -618,6 +620,17 @@ addAndMakeVisible(infoPanel); } +void +EditorContainer::initEditorRuler() +{ + editorRuler = createEditorRuler(this); + editorRuler->setBoundsRelative(0.0f, 0.0f, 0.2f, 1.0f); + + if(ruler_visible) + addAndMakeVisible(editorRuler); +} + + JUCE_EDITOR_NAMESPACE::Colour EditorContainer::getDScrollColor() { @@ -967,6 +980,16 @@ else infoPanel->setBounds(0, 0, rect.getWidth(), infopanel_size); } + if(ruler_visible) + { + if(editorRuler == NULL) + initEditorRuler(); + + if(orientation == horizontal) + editorRuler->setBounds(0, 0, rect.getWidth(), RULER_DEFAULT_SIZE); + else + editorRuler->setBounds(0, 0, RULER_DEFAULT_SIZE, rect.getHeight()); + } if(layout == juxtaposed) { @@ -974,8 +997,8 @@ if(orientation == horizontal) { - float height = rect.getHeight(); - float y = 0.0f; + float height = (ruler_visible) ? rect.getHeight() - RULER_DEFAULT_SIZE : rect.getHeight(); + float y = (ruler_visible) ? RULER_DEFAULT_SIZE : 0.0f; float editor_x = (infopanel_visible) ? infopanel_size : 0; float editor_w = (infopanel_visible) ? rect.getWidth()-infopanel_size : rect.getWidth(); for(i = 0; i < editors.size(); i++) @@ -993,7 +1016,7 @@ } else { - float width = (float)rect.getWidth(); + float width = (ruler_visible) ? (float)rect.getWidth() - RULER_DEFAULT_SIZE : (float)rect.getWidth(); float x = width; float editor_y = (infopanel_visible) ? infopanel_size : 0; float editor_h = (infopanel_visible) ? rect.getHeight()-infopanel_size : rect.getHeight(); @@ -1019,9 +1042,12 @@ if(orientation == horizontal) { int editor_x = (infopanel_visible) ? infopanel_size : 0; + int editor_y = (ruler_visible) ? RULER_DEFAULT_SIZE : 0; int editor_w = (infopanel_visible) ? rect.getWidth()-infopanel_size : rect.getWidth(); int editor_h = (dscroll_visible) ? (rect.getHeight() - dscroll_size) : rect.getHeight(); - tabbedContainer->setBounds(editor_x, 0, editor_w, editor_h); + if(ruler_visible) editor_h = editor_h - RULER_DEFAULT_SIZE; + + tabbedContainer->setBounds(editor_x, editor_y, editor_w, editor_h); } else { @@ -1029,6 +1055,9 @@ int editor_x = (dscroll_visible) ? dscroll_size : 0; int editor_y = (infopanel_visible) ? infopanel_size : 0; int editor_h = (infopanel_visible) ? rect.getHeight() -infopanel_size : rect.getHeight(); + + if(ruler_visible) editor_w = editor_w - RULER_DEFAULT_SIZE; + tabbedContainer->setBounds(editor_x, editor_y, editor_w, editor_h); } } @@ -1406,6 +1435,25 @@ } /******************************************* + ________ editor Ruler _________________________ + ********************************************/ +void +EditorContainer::setRulerVisible(bool vis) +{ + if(editorRuler != NULL) + { + ruler_visible = vis; + + if(ruler_visible) + addAndMakeVisible(editorRuler); + else + removeChildComponent(editorRuler); + + resized(); + } +} + +/******************************************* ________ view _________________________ ********************************************/ Modified: trunk/ftm/gui/Juce/common/EditorContainer.h =================================================================== --- trunk/ftm/gui/Juce/common/EditorContainer.h 2008-08-04 18:10:32 UTC (rev 1852) +++ trunk/ftm/gui/Juce/common/EditorContainer.h 2008-08-05 10:25:58 UTC (rev 1853) @@ -426,6 +426,22 @@ int getInfoPanelSize(){return infopanel_size;} /** @} InfoPanel properties */ + /** @name Ruler properties + * @{ */ + /** + * @brief hide/show the ruler + * @param vis whether to show or hide the ruler + * @ingroup EditorContainer + */ + void setRulerVisible(bool vis); + /** + * @brief returns true is ruler is visible + * @return if the ruler is visible + * @ingroup EditorContainer + */ + bool isRulerVisible(){return ruler_visible;} + /** @} InfoPanel properties */ + /** @name Domain * @{ */ /** @@ -780,6 +796,7 @@ void createScrollBar(); void initInfoPanel(); + void initEditorRuler(); void paint (JUCE_EDITOR_NAMESPACE::Graphics& g); void resized(); @@ -818,6 +835,11 @@ int infopanel_size; bool infopanel_visible; static const int INFOPANEL_DEFAULT_SIZE = /*55*/35; + + /* ruler */ + JUCE_EDITOR_NAMESPACE::Component *editorRuler; + bool ruler_visible; + static const int RULER_DEFAULT_SIZE = 15; /* tabs */ EditorTabbedContainer *tabbedContainer; Added: trunk/ftm/gui/Juce/common/EditorRuler.cpp =================================================================== --- trunk/ftm/gui/Juce/common/EditorRuler.cpp (rev 0) +++ trunk/ftm/gui/Juce/common/EditorRuler.cpp 2008-08-05 10:25:58 UTC (rev 1853) @@ -0,0 +1,67 @@ +/* + * IMTR EDITOR + * Copyright (C) 2004 by IRCAM-Centre Georges Pompidou, Paris, France. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * See file COPYING.LIB + for further informations on licensing terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifdef DISABLE_JUCE_NAMESPACE +#define DONT_SET_USING_JUCE_NAMESPACE 1 +#endif + +#include "juce.h" +#include "imtrjuce.h" + +#include "juce.h" +#include "imtrjuce.h" + +class EditorRuler : public JUCE_EDITOR_NAMESPACE::Component, public EditorContainerListener +{ + EditorContainer *container; + +public: + EditorRuler(EditorContainer *container): container(container) + { + setOpaque(true); + setBufferedToImage(true); + + container->addEditorContainerListener(this); + } + + ~EditorRuler() + { + } + + void paint(JUCE_EDITOR_NAMESPACE::Graphics& g) + { + g.fillAll(container->getBackgroundColor()); + } + + void resized(){} + + void containerChanged() + { + repaint(); + } +}; + +JUCE_EDITOR_NAMESPACE::Component *createEditorRuler(EditorContainer *container) +{ + return new EditorRuler(container); +} \ No newline at end of file Property changes on: trunk/ftm/gui/Juce/common/EditorRuler.cpp ___________________________________________________________________ Added: svn:executable + * Added: trunk/ftm/gui/Juce/common/ImtrEditorData.cpp =================================================================== --- trunk/ftm/gui/Juce/common/ImtrEditorData.cpp (rev 0) +++ trunk/ftm/gui/Juce/common/ImtrEditorData.cpp 2008-08-05 10:25:58 UTC (rev 1853) @@ -0,0 +1,8105 @@ +#include "ImtrEditorData.h" + +//============================================================================== +// Binary resources - be careful not to edit any of these sections! + +// JUCER_RESOURCE: violin_h_png, 3314, "../../violin_h.png" +static const unsigned char score_violin_h_png[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,56,0,0,0,21,8,6,0,0,0,19,180,45,246,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11, +19,1,0,154,156,24,0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32,112,114,111,102,105,108,101,0,0,120,218,157,83,103,84,83,233,22,61,247,222,244,66,75,136,128,148,75,111,82,21, +8,32,82,66,139,128,20,145,38,42,33,9,16,74,136,33,161,217,21,81,193,17,69,69,4,27,200,160,136,3,142,142,128,140,21,81,44,12,138,10,216,7,228,33,162,142,131,163,136,138,202,251,225,123,163,107,214,188, +247,230,205,254,181,215,62,231,172,243,157,179,207,7,192,8,12,150,72,51,81,53,128,12,169,66,30,17,224,131,199,196,198,225,228,46,64,129,10,36,112,0,16,8,179,100,33,115,253,35,1,0,248,126,60,60,43,34,192, +7,190,0,1,120,211,11,8,0,192,77,155,192,48,28,135,255,15,234,66,153,92,1,128,132,1,192,116,145,56,75,8,128,20,0,64,122,142,66,166,0,64,70,1,128,157,152,38,83,0,160,4,0,96,203,99,98,227,0,80,45,0,96,39, +127,230,211,0,128,157,248,153,123,1,0,91,148,33,21,1,160,145,0,32,19,101,136,68,0,104,59,0,172,207,86,138,69,0,88,48,0,20,102,75,196,57,0,216,45,0,48,73,87,102,72,0,176,183,0,192,206,16,11,178,0,8,12, +0,48,81,136,133,41,0,4,123,0,96,200,35,35,120,0,132,153,0,20,70,242,87,60,241,43,174,16,231,42,0,0,120,153,178,60,185,36,57,69,129,91,8,45,113,7,87,87,46,30,40,206,73,23,43,20,54,97,2,97,154,64,46,194, +121,153,25,50,129,52,15,224,243,204,0,0,160,145,21,17,224,131,243,253,120,206,14,174,206,206,54,142,182,14,95,45,234,191,6,255,34,98,98,227,254,229,207,171,112,64,0,0,225,116,126,209,254,44,47,179,26, +128,59,6,128,109,254,162,37,238,4,104,94,11,160,117,247,139,102,178,15,64,181,0,160,233,218,87,243,112,248,126,60,60,69,161,144,185,217,217,229,228,228,216,74,196,66,91,97,202,87,125,254,103,194,95,192, +87,253,108,249,126,60,252,247,245,224,190,226,36,129,50,93,129,71,4,248,224,194,204,244,76,165,28,207,146,9,132,98,220,230,143,71,252,183,11,255,252,29,211,34,196,73,98,185,88,42,20,227,81,18,113,142, +68,154,140,243,50,165,34,137,66,146,41,197,37,210,255,100,226,223,44,251,3,62,223,53,0,176,106,62,1,123,145,45,168,93,99,3,246,75,39,16,88,116,192,226,247,0,0,242,187,111,193,212,40,8,3,128,104,131,225, +207,119,255,239,63,253,71,160,37,0,128,102,73,146,113,0,0,94,68,36,46,84,202,179,63,199,8,0,0,68,160,129,42,176,65,27,244,193,24,44,192,6,28,193,5,220,193,11,252,96,54,132,66,36,196,194,66,16,66,10,100, +128,28,114,96,41,172,130,66,40,134,205,176,29,42,96,47,212,64,29,52,192,81,104,134,147,112,14,46,194,85,184,14,61,112,15,250,97,8,158,193,40,188,129,9,4,65,200,8,19,97,33,218,136,1,98,138,88,35,142,8, +23,153,133,248,33,193,72,4,18,139,36,32,201,136,20,81,34,75,145,53,72,49,82,138,84,32,85,72,29,242,61,114,2,57,135,92,70,186,145,59,200,0,50,130,252,134,188,71,49,148,129,178,81,61,212,12,181,67,185,168, +55,26,132,70,162,11,208,100,116,49,154,143,22,160,155,208,114,180,26,61,140,54,161,231,208,171,104,15,218,143,62,67,199,48,192,232,24,7,51,196,108,48,46,198,195,66,177,56,44,9,147,99,203,177,34,172,12, +171,198,26,176,86,172,3,187,137,245,99,207,177,119,4,18,129,69,192,9,54,4,119,66,32,97,30,65,72,88,76,88,78,216,72,168,32,28,36,52,17,218,9,55,9,3,132,81,194,39,34,147,168,75,180,38,186,17,249,196,24, +98,50,49,135,88,72,44,35,214,18,143,19,47,16,123,136,67,196,55,36,18,137,67,50,39,185,144,2,73,177,164,84,210,18,210,70,210,110,82,35,233,44,169,155,52,72,26,35,147,201,218,100,107,178,7,57,148,44,32, +43,200,133,228,157,228,195,228,51,228,27,228,33,242,91,10,157,98,64,113,164,248,83,226,40,82,202,106,74,25,229,16,229,52,229,6,101,152,50,65,85,163,154,82,221,168,161,84,17,53,143,90,66,173,161,182,82, +175,81,135,168,19,52,117,154,57,205,131,22,73,75,165,173,162,149,211,26,104,23,104,247,105,175,232,116,186,17,221,149,30,78,151,208,87,210,203,233,71,232,151,232,3,244,119,12,13,134,21,131,199,136,103, +40,25,155,24,7,24,103,25,119,24,175,152,76,166,25,211,139,25,199,84,48,55,49,235,152,231,153,15,153,111,85,88,42,182,42,124,21,145,202,10,149,74,149,38,149,27,42,47,84,169,170,166,170,222,170,11,85,243, +85,203,84,143,169,94,83,125,174,70,85,51,83,227,169,9,212,150,171,85,170,157,80,235,83,27,83,103,169,59,168,135,170,103,168,111,84,63,164,126,89,253,137,6,89,195,76,195,79,67,164,81,160,177,95,227,188, +198,32,11,99,25,179,120,44,33,107,13,171,134,117,129,53,196,38,177,205,217,124,118,42,187,152,253,29,187,139,61,170,169,161,57,67,51,74,51,87,179,82,243,148,102,63,7,227,152,113,248,156,116,78,9,231,40, +167,151,243,126,138,222,20,239,41,226,41,27,166,52,76,185,49,101,92,107,170,150,151,150,88,171,72,171,81,171,71,235,189,54,174,237,167,157,166,189,69,187,89,251,129,14,65,199,74,39,92,39,71,103,143,206, +5,157,231,83,217,83,221,167,10,167,22,77,61,58,245,174,46,170,107,165,27,161,187,68,119,191,110,167,238,152,158,190,94,128,158,76,111,167,222,121,189,231,250,28,125,47,253,84,253,109,250,167,245,71,12, +88,6,179,12,36,6,219,12,206,24,60,197,53,113,111,60,29,47,199,219,241,81,67,93,195,64,67,165,97,149,97,151,225,132,145,185,209,60,163,213,70,141,70,15,140,105,198,92,227,36,227,109,198,109,198,163,38, +6,38,33,38,75,77,234,77,238,154,82,77,185,166,41,166,59,76,59,76,199,205,204,205,162,205,214,153,53,155,61,49,215,50,231,155,231,155,215,155,223,183,96,90,120,90,44,182,168,182,184,101,73,178,228,90,166, +89,238,182,188,110,133,90,57,89,165,88,85,90,93,179,70,173,157,173,37,214,187,173,187,167,17,167,185,78,147,78,171,158,214,103,195,176,241,182,201,182,169,183,25,176,229,216,6,219,174,182,109,182,125, +97,103,98,23,103,183,197,174,195,238,147,189,147,125,186,125,141,253,61,7,13,135,217,14,171,29,90,29,126,115,180,114,20,58,86,58,222,154,206,156,238,63,125,197,244,150,233,47,103,88,207,16,207,216,51, +227,182,19,203,41,196,105,157,83,155,211,71,103,23,103,185,115,131,243,136,139,137,75,130,203,46,151,62,46,155,27,198,221,200,189,228,74,116,245,113,93,225,122,210,245,157,155,179,155,194,237,168,219, +175,238,54,238,105,238,135,220,159,204,52,159,41,158,89,51,115,208,195,200,67,224,81,229,209,63,11,159,149,48,107,223,172,126,79,67,79,129,103,181,231,35,47,99,47,145,87,173,215,176,183,165,119,170,247, +97,239,23,62,246,62,114,159,227,62,227,60,55,222,50,222,89,95,204,55,192,183,200,183,203,79,195,111,158,95,133,223,67,127,35,255,100,255,122,255,209,0,167,128,37,1,103,3,137,129,65,129,91,2,251,248,122, +124,33,191,142,63,58,219,101,246,178,217,237,65,140,160,185,65,21,65,143,130,173,130,229,193,173,33,104,200,236,144,173,33,247,231,152,206,145,206,105,14,133,80,126,232,214,208,7,97,230,97,139,195,126, +12,39,133,135,133,87,134,63,142,112,136,88,26,209,49,151,53,119,209,220,67,115,223,68,250,68,150,68,222,155,103,49,79,57,175,45,74,53,42,62,170,46,106,60,218,55,186,52,186,63,198,46,102,89,204,213,88, +157,88,73,108,75,28,57,46,42,174,54,110,108,190,223,252,237,243,135,226,157,226,11,227,123,23,152,47,200,93,112,121,161,206,194,244,133,167,22,169,46,18,44,58,150,64,76,136,78,56,148,240,65,16,42,168, +22,140,37,242,19,119,37,142,10,121,194,29,194,103,34,47,209,54,209,136,216,67,92,42,30,78,242,72,42,77,122,146,236,145,188,53,121,36,197,51,165,44,229,185,132,39,169,144,188,76,13,76,221,155,58,158,22, +154,118,32,109,50,61,58,189,49,131,146,145,144,113,66,170,33,77,147,182,103,234,103,230,102,118,203,172,101,133,178,254,197,110,139,183,47,30,149,7,201,107,179,144,172,5,89,45,10,182,66,166,232,84,90, +40,215,42,7,178,103,101,87,102,191,205,137,202,57,150,171,158,43,205,237,204,179,202,219,144,55,156,239,159,255,237,18,194,18,225,146,182,165,134,75,87,45,29,88,230,189,172,106,57,178,60,113,121,219,10, +227,21,5,43,134,86,6,172,60,184,138,182,42,109,213,79,171,237,87,151,174,126,189,38,122,77,107,129,94,193,202,130,193,181,1,107,235,11,85,10,229,133,125,235,220,215,237,93,79,88,47,89,223,181,97,250,134, +157,27,62,21,137,138,174,20,219,23,151,21,127,216,40,220,120,229,27,135,111,202,191,153,220,148,180,169,171,196,185,100,207,102,210,102,233,230,222,45,158,91,14,150,170,151,230,151,14,110,13,217,218,180, +13,223,86,180,237,245,246,69,219,47,151,205,40,219,187,131,182,67,185,163,191,60,184,188,101,167,201,206,205,59,63,84,164,84,244,84,250,84,54,238,210,221,181,97,215,248,110,209,238,27,123,188,246,52,236, +213,219,91,188,247,253,62,201,190,219,85,1,85,77,213,102,213,101,251,73,251,179,247,63,174,137,170,233,248,150,251,109,93,173,78,109,113,237,199,3,210,3,253,7,35,14,182,215,185,212,213,29,210,61,84,82, +143,214,43,235,71,14,199,31,190,254,157,239,119,45,13,54,13,85,141,156,198,226,35,112,68,121,228,233,247,9,223,247,30,13,58,218,118,140,123,172,225,7,211,31,118,29,103,29,47,106,66,154,242,154,70,155, +83,154,251,91,98,91,186,79,204,62,209,214,234,222,122,252,71,219,31,15,156,52,60,89,121,74,243,84,201,105,218,233,130,211,147,103,242,207,140,157,149,157,125,126,46,249,220,96,219,162,182,123,231,99,206, +223,106,15,111,239,186,16,116,225,210,69,255,139,231,59,188,59,206,92,242,184,116,242,178,219,229,19,87,184,87,154,175,58,95,109,234,116,234,60,254,147,211,79,199,187,156,187,154,174,185,92,107,185,238, +122,189,181,123,102,247,233,27,158,55,206,221,244,189,121,241,22,255,214,213,158,57,61,221,189,243,122,111,247,197,247,245,223,22,221,126,114,39,253,206,203,187,217,119,39,238,173,188,79,188,95,244,64, +237,65,217,67,221,135,213,63,91,254,220,216,239,220,127,106,192,119,160,243,209,220,71,247,6,133,131,207,254,145,245,143,15,67,5,143,153,143,203,134,13,134,235,158,56,62,57,57,226,63,114,253,233,252,167, +67,207,100,207,38,158,23,254,162,254,203,174,23,22,47,126,248,213,235,215,206,209,152,209,161,151,242,151,147,191,109,124,165,253,234,192,235,25,175,219,198,194,198,30,190,201,120,51,49,94,244,86,251, +237,193,119,220,119,29,239,163,223,15,79,228,124,32,127,40,255,104,249,177,245,83,208,167,251,147,25,147,147,255,4,3,152,243,252,99,51,45,219,0,0,0,32,99,72,82,77,0,0,122,37,0,0,128,131,0,0,249,255,0, +0,128,233,0,0,117,48,0,0,234,96,0,0,58,152,0,0,23,111,146,95,197,70,0,0,2,29,73,68,65,84,120,218,220,87,209,109,227,48,12,125,28,193,43,104,5,221,8,234,8,185,17,188,130,58,66,86,80,71,72,71,240,141,96, +143,144,142,224,140,224,251,121,6,8,86,146,165,75,147,43,42,64,136,99,91,148,30,223,35,77,202,182,109,248,201,67,68,228,43,237,13,0,78,0,60,0,7,32,240,254,7,231,31,0,239,188,126,26,194,175,152,131,136, +68,17,89,69,100,107,152,103,174,193,19,230,221,12,122,0,23,94,191,3,88,0,220,212,51,79,86,237,184,1,120,5,240,246,157,25,244,100,45,30,188,231,68,36,21,216,156,30,201,102,78,102,19,15,19,26,192,93,249, +219,227,144,57,3,114,237,180,211,13,208,23,226,39,85,22,207,34,114,250,199,120,77,5,144,227,35,0,14,100,162,148,16,114,155,142,25,240,187,2,102,35,191,88,144,96,234,216,239,46,128,123,246,187,20,54,140, +5,246,92,70,174,37,39,149,164,220,2,210,81,41,145,103,156,212,60,243,126,168,1,156,148,129,22,128,142,0,45,96,205,84,238,179,177,118,130,76,116,204,213,128,42,57,114,229,26,103,1,174,60,208,144,73,0,185, +24,12,230,254,88,145,149,207,100,76,45,233,80,113,236,86,97,102,224,158,135,170,3,61,226,204,194,88,201,106,193,176,122,148,109,45,128,11,247,220,195,34,82,65,57,38,231,134,79,136,43,100,230,184,3,76, +157,129,29,120,176,163,207,193,200,24,153,51,135,118,133,117,169,35,126,45,163,185,175,192,176,31,248,218,1,208,198,160,87,89,117,86,82,60,43,249,218,50,173,135,113,29,46,53,54,83,198,49,131,126,152,26, +217,59,43,38,44,152,156,167,79,13,89,57,231,196,75,5,168,207,48,120,53,123,12,182,22,141,172,25,247,106,255,198,238,192,169,154,114,239,8,60,215,252,110,168,6,39,213,85,0,192,11,109,180,12,199,51,5,99, +99,175,101,23,85,243,46,180,251,166,106,225,79,197,246,110,208,241,165,155,50,180,152,182,104,38,192,165,114,192,4,96,84,255,23,0,191,238,40,157,29,167,30,31,213,246,235,142,42,97,172,148,87,129,210,125, +74,189,249,200,118,105,36,75,80,178,243,100,216,202,233,229,128,237,111,219,240,250,12,91,154,181,103,54,183,15,105,120,117,124,4,197,222,98,154,223,255,50,254,14,0,115,139,38,255,8,42,38,36,0,0,0,0,73, +69,78,68,174,66,96,130,0,0}; + +// JUCER_RESOURCE: violin_v_png, 3390, "../../violin_v.png" +static const unsigned char score_violin_v_png[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,21,0,0,0,56,8,6,0,0,0,18,37,179,126,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11, +19,1,0,154,156,24,0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32,112,114,111,102,105,108,101,0,0,120,218,157,83,103,84,83,233,22,61,247,222,244,66,75,136,128,148,75,111,82,21, +8,32,82,66,139,128,20,145,38,42,33,9,16,74,136,33,161,217,21,81,193,17,69,69,4,27,200,160,136,3,142,142,128,140,21,81,44,12,138,10,216,7,228,33,162,142,131,163,136,138,202,251,225,123,163,107,214,188, +247,230,205,254,181,215,62,231,172,243,157,179,207,7,192,8,12,150,72,51,81,53,128,12,169,66,30,17,224,131,199,196,198,225,228,46,64,129,10,36,112,0,16,8,179,100,33,115,253,35,1,0,248,126,60,60,43,34,192, +7,190,0,1,120,211,11,8,0,192,77,155,192,48,28,135,255,15,234,66,153,92,1,128,132,1,192,116,145,56,75,8,128,20,0,64,122,142,66,166,0,64,70,1,128,157,152,38,83,0,160,4,0,96,203,99,98,227,0,80,45,0,96,39, +127,230,211,0,128,157,248,153,123,1,0,91,148,33,21,1,160,145,0,32,19,101,136,68,0,104,59,0,172,207,86,138,69,0,88,48,0,20,102,75,196,57,0,216,45,0,48,73,87,102,72,0,176,183,0,192,206,16,11,178,0,8,12, +0,48,81,136,133,41,0,4,123,0,96,200,35,35,120,0,132,153,0,20,70,242,87,60,241,43,174,16,231,42,0,0,120,153,178,60,185,36,57,69,129,91,8,45,113,7,87,87,46,30,40,206,73,23,43,20,54,97,2,97,154,64,46,194, +121,153,25,50,129,52,15,224,243,204,0,0,160,145,21,17,224,131,243,253,120,206,14,174,206,206,54,142,182,14,95,45,234,191,6,255,34,98,98,227,254,229,207,171,112,64,0,0,225,116,126,209,254,44,47,179,26, +128,59,6,128,109,254,162,37,238,4,104,94,11,160,117,247,139,102,178,15,64,181,0,160,233,218,87,243,112,248,126,60,60,69,161,144,185,217,217,229,228,228,216,74,196,66,91,97,202,87,125,254,103,194,95,192, +87,253,108,249,126,60,252,247,245,224,190,226,36,129,50,93,129,71,4,248,224,194,204,244,76,165,28,207,146,9,132,98,220,230,143,71,252,183,11,255,252,29,211,34,196,73,98,185,88,42,20,227,81,18,113,142, +68,154,140,243,50,165,34,137,66,146,41,197,37,210,255,100,226,223,44,251,3,62,223,53,0,176,106,62,1,123,145,45,168,93,99,3,246,75,39,16,88,116,192,226,247,0,0,242,187,111,193,212,40,8,3,128,104,131,225, +207,119,255,239,63,253,71,160,37,0,128,102,73,146,113,0,0,94,68,36,46,84,202,179,63,199,8,0,0,68,160,129,42,176,65,27,244,193,24,44,192,6,28,193,5,220,193,11,252,96,54,132,66,36,196,194,66,16,66,10,100, +128,28,114,96,41,172,130,66,40,134,205,176,29,42,96,47,212,64,29,52,192,81,104,134,147,112,14,46,194,85,184,14,61,112,15,250,97,8,158,193,40,188,129,9,4,65,200,8,19,97,33,218,136,1,98,138,88,35,142,8, +23,153,133,248,33,193,72,4,18,139,36,32,201,136,20,81,34,75,145,53,72,49,82,138,84,32,85,72,29,242,61,114,2,57,135,92,70,186,145,59,200,0,50,130,252,134,188,71,49,148,129,178,81,61,212,12,181,67,185,168, +55,26,132,70,162,11,208,100,116,49,154,143,22,160,155,208,114,180,26,61,140,54,161,231,208,171,104,15,218,143,62,67,199,48,192,232,24,7,51,196,108,48,46,198,195,66,177,56,44,9,147,99,203,177,34,172,12, +171,198,26,176,86,172,3,187,137,245,99,207,177,119,4,18,129,69,192,9,54,4,119,66,32,97,30,65,72,88,76,88,78,216,72,168,32,28,36,52,17,218,9,55,9,3,132,81,194,39,34,147,168,75,180,38,186,17,249,196,24, +98,50,49,135,88,72,44,35,214,18,143,19,47,16,123,136,67,196,55,36,18,137,67,50,39,185,144,2,73,177,164,84,210,18,210,70,210,110,82,35,233,44,169,155,52,72,26,35,147,201,218,100,107,178,7,57,148,44,32, +43,200,133,228,157,228,195,228,51,228,27,228,33,242,91,10,157,98,64,113,164,248,83,226,40,82,202,106,74,25,229,16,229,52,229,6,101,152,50,65,85,163,154,82,221,168,161,84,17,53,143,90,66,173,161,182,82, +175,81,135,168,19,52,117,154,57,205,131,22,73,75,165,173,162,149,211,26,104,23,104,247,105,175,232,116,186,17,221,149,30,78,151,208,87,210,203,233,71,232,151,232,3,244,119,12,13,134,21,131,199,136,103, +40,25,155,24,7,24,103,25,119,24,175,152,76,166,25,211,139,25,199,84,48,55,49,235,152,231,153,15,153,111,85,88,42,182,42,124,21,145,202,10,149,74,149,38,149,27,42,47,84,169,170,166,170,222,170,11,85,243, +85,203,84,143,169,94,83,125,174,70,85,51,83,227,169,9,212,150,171,85,170,157,80,235,83,27,83,103,169,59,168,135,170,103,168,111,84,63,164,126,89,253,137,6,89,195,76,195,79,67,164,81,160,177,95,227,188, +198,32,11,99,25,179,120,44,33,107,13,171,134,117,129,53,196,38,177,205,217,124,118,42,187,152,253,29,187,139,61,170,169,161,57,67,51,74,51,87,179,82,243,148,102,63,7,227,152,113,248,156,116,78,9,231,40, +167,151,243,126,138,222,20,239,41,226,41,27,166,52,76,185,49,101,92,107,170,150,151,150,88,171,72,171,81,171,71,235,189,54,174,237,167,157,166,189,69,187,89,251,129,14,65,199,74,39,92,39,71,103,143,206, +5,157,231,83,217,83,221,167,10,167,22,77,61,58,245,174,46,170,107,165,27,161,187,68,119,191,110,167,238,152,158,190,94,128,158,76,111,167,222,121,189,231,250,28,125,47,253,84,253,109,250,167,245,71,12, +88,6,179,12,36,6,219,12,206,24,60,197,53,113,111,60,29,47,199,219,241,81,67,93,195,64,67,165,97,149,97,151,225,132,145,185,209,60,163,213,70,141,70,15,140,105,198,92,227,36,227,109,198,109,198,163,38, +6,38,33,38,75,77,234,77,238,154,82,77,185,166,41,166,59,76,59,76,199,205,204,205,162,205,214,153,53,155,61,49,215,50,231,155,231,155,215,155,223,183,96,90,120,90,44,182,168,182,184,101,73,178,228,90,166, +89,238,182,188,110,133,90,57,89,165,88,85,90,93,179,70,173,157,173,37,214,187,173,187,167,17,167,185,78,147,78,171,158,214,103,195,176,241,182,201,182,169,183,25,176,229,216,6,219,174,182,109,182,125, +97,103,98,23,103,183,197,174,195,238,147,189,147,125,186,125,141,253,61,7,13,135,217,14,171,29,90,29,126,115,180,114,20,58,86,58,222,154,206,156,238,63,125,197,244,150,233,47,103,88,207,16,207,216,51, +227,182,19,203,41,196,105,157,83,155,211,71,103,23,103,185,115,131,243,136,139,137,75,130,203,46,151,62,46,155,27,198,221,200,189,228,74,116,245,113,93,225,122,210,245,157,155,179,155,194,237,168,219, +175,238,54,238,105,238,135,220,159,204,52,159,41,158,89,51,115,208,195,200,67,224,81,229,209,63,11,159,149,48,107,223,172,126,79,67,79,129,103,181,231,35,47,99,47,145,87,173,215,176,183,165,119,170,247, +97,239,23,62,246,62,114,159,227,62,227,60,55,222,50,222,89,95,204,55,192,183,200,183,203,79,195,111,158,95,133,223,67,127,35,255,100,255,122,255,209,0,167,128,37,1,103,3,137,129,65,129,91,2,251,248,122, +124,33,191,142,63,58,219,101,246,178,217,237,65,140,160,185,65,21,65,143,130,173,130,229,193,173,33,104,200,236,144,173,33,247,231,152,206,145,206,105,14,133,80,126,232,214,208,7,97,230,97,139,195,126, +12,39,133,135,133,87,134,63,142,112,136,88,26,209,49,151,53,119,209,220,67,115,223,68,250,68,150,68,222,155,103,49,79,57,175,45,74,53,42,62,170,46,106,60,218,55,186,52,186,63,198,46,102,89,204,213,88, +157,88,73,108,75,28,57,46,42,174,54,110,108,190,223,252,237,243,135,226,157,226,11,227,123,23,152,47,200,93,112,121,161,206,194,244,133,167,22,169,46,18,44,58,150,64,76,136,78,56,148,240,65,16,42,168, +22,140,37,242,19,119,37,142,10,121,194,29,194,103,34,47,209,54,209,136,216,67,92,42,30,78,242,72,42,77,122,146,236,145,188,53,121,36,197,51,165,44,229,185,132,39,169,144,188,76,13,76,221,155,58,158,22, +154,118,32,109,50,61,58,189,49,131,146,145,144,113,66,170,33,77,147,182,103,234,103,230,102,118,203,172,101,133,178,254,197,110,139,183,47,30,149,7,201,107,179,144,172,5,89,45,10,182,66,166,232,84,90, +40,215,42,7,178,103,101,87,102,191,205,137,202,57,150,171,158,43,205,237,204,179,202,219,144,55,156,239,159,255,237,18,194,18,225,146,182,165,134,75,87,45,29,88,230,189,172,106,57,178,60,113,121,219,10, +227,21,5,43,134,86,6,172,60,184,138,182,42,109,213,79,171,237,87,151,174,126,189,38,122,77,107,129,94,193,202,130,193,181,1,107,235,11,85,10,229,133,125,235,220,215,237,93,79,88,47,89,223,181,97,250,134, +157,27,62,21,137,138,174,20,219,23,151,21,127,216,40,220,120,229,27,135,111,202,191,153,220,148,180,169,171,196,185,100,207,102,210,102,233,230,222,45,158,91,14,150,170,151,230,151,14,110,13,217,218,180, +13,223,86,180,237,245,246,69,219,47,151,205,40,219,187,131,182,67,185,163,191,60,184,188,101,167,201,206,205,59,63,84,164,84,244,84,250,84,54,238,210,221,181,97,215,248,110,209,238,27,123,188,246,52,236, +213,219,91,188,247,253,62,201,190,219,85,1,85,77,213,102,213,101,251,73,251,179,247,63,174,137,170,233,248,150,251,109,93,173,78,109,113,237,199,3,210,3,253,7,35,14,182,215,185,212,213,29,210,61,84,82, +143,214,43,235,71,14,199,31,190,254,157,239,119,45,13,54,13,85,141,156,198,226,35,112,68,121,228,233,247,9,223,247,30,13,58,218,118,140,123,172,225,7,211,31,118,29,103,29,47,106,66,154,242,154,70,155, +83,154,251,91,98,91,186,79,204,62,209,214,234,222,122,252,71,219,31,15,156,52,60,89,121,74,243,84,201,105,218,233,130,211,147,103,242,207,140,157,149,157,125,126,46,249,220,96,219,162,182,123,231,99,206, +223,106,15,111,239,186,16,116,225,210,69,255,139,231,59,188,59,206,92,242,184,116,242,178,219,229,19,87,184,87,154,175,58,95,109,234,116,234,60,254,147,211,79,199,187,156,187,154,174,185,92,107,185,238, +122,189,181,123,102,247,233,27,158,55,206,221,244,189,121,241,22,255,214,213,158,57,61,221,189,243,122,111,247,197,247,245,223,22,221,126,114,39,253,206,203,187,217,119,39,238,173,188,79,188,95,244,64, +237,65,217,67,221,135,213,63,91,254,220,216,239,220,127,106,192,119,160,243,209,220,71,247,6,133,131,207,254,145,245,143,15,67,5,143,153,143,203,134,13,134,235,158,56,62,57,57,226,63,114,253,233,252,167, +67,207,100,207,38,158,23,254,162,254,203,174,23,22,47,126,248,213,235,215,206,209,152,209,161,151,242,151,147,191,109,124,165,253,234,192,235,25,175,219,198,194,198,30,190,201,120,51,49,94,244,86,251, +237,193,119,220,119,29,239,163,223,15,79,228,124,32,127,40,255,104,249,177,245,83,208,167,251,147,25,147,147,255,4,3,152,243,252,99,51,45,219,0,0,0,32,99,72,82,77,0,0,122,37,0,0,128,131,0,0,249,255,0, +0,128,233,0,0,117,48,0,0,234,96,0,0,58,152,0,0,23,111,146,95,197,70,0,0,2,105,73,68,65,84,120,218,172,88,237,145,163,48,12,149,152,109,192,87,2,91,130,91,224,74,160,5,95,9,180,64,74,224,74,32,37,144,18, +160,4,167,132,80,130,239,143,152,245,106,37,35,135,99,38,147,25,227,60,235,227,233,73,14,166,148,160,105,26,168,120,28,125,239,234,142,148,18,32,162,245,51,32,98,66,196,136,136,78,219,87,3,122,0,30,159, +65,221,107,116,191,5,128,40,172,255,18,195,96,180,116,98,86,22,173,181,130,190,50,160,23,29,18,17,113,121,23,180,203,0,215,44,65,142,14,120,11,52,79,80,203,222,45,194,26,52,21,188,188,3,192,83,73,226, +183,199,2,234,233,251,81,120,87,13,10,153,165,28,208,93,1,125,10,124,12,87,202,116,22,168,227,10,201,51,89,186,9,107,35,243,162,218,253,167,16,203,80,72,158,201,253,150,170,231,112,59,254,175,50,141,84, +89,43,171,253,246,10,168,36,40,243,21,61,13,138,66,181,239,130,134,26,201,179,128,106,128,211,89,184,52,80,207,52,212,12,168,129,58,5,48,33,98,111,1,253,16,168,59,11,66,241,151,138,160,53,41,5,179,116, +40,184,220,149,104,164,185,47,185,61,9,97,169,2,29,13,228,142,37,126,242,190,207,251,250,6,0,191,5,13,157,41,174,15,122,183,137,162,66,150,242,88,122,129,98,139,194,136,149,239,63,64,151,2,23,125,129, +98,249,44,224,57,104,84,106,154,75,221,25,176,203,65,181,228,72,67,217,74,37,220,11,33,25,37,208,65,24,22,120,156,71,2,149,100,241,133,136,142,199,180,99,160,210,97,225,176,72,57,188,107,180,230,37,148, +105,78,55,62,68,220,242,30,214,176,142,233,148,78,186,179,181,142,237,123,228,123,154,204,146,93,176,224,94,56,204,107,6,52,204,133,94,81,167,96,0,253,178,154,9,74,20,24,224,51,26,149,146,149,142,73,134, +75,159,231,213,193,128,58,86,182,188,245,120,77,249,61,89,124,166,242,137,25,18,44,61,106,37,98,107,82,183,82,5,70,22,154,211,43,79,200,146,180,81,210,60,201,159,39,118,252,225,18,89,115,143,106,217,208, +22,8,236,118,245,26,201,111,45,203,149,27,159,246,68,0,248,188,50,243,107,3,241,143,34,248,56,249,81,200,74,244,86,0,221,172,49,157,12,35,79,47,13,107,26,104,167,180,12,47,236,27,173,23,137,94,89,239, +132,219,160,179,38,74,155,153,118,97,223,211,202,211,65,233,239,78,40,213,214,26,211,124,174,154,233,16,39,36,114,172,157,164,15,181,122,81,150,29,89,21,104,125,122,247,63,20,71,92,237,136,143,59,245, +163,187,122,49,3,128,127,3,0,139,9,138,209,217,244,10,10,0,0,0,0,73,69,78,68,174,66,96,130,0,0}; + +// JUCER_RESOURCE: bass_h_png, 3091, "../../bass_h.png" +static const unsigned char score_bass_h_png[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,27,0,0,0,19,8,6,0,0,0,97,135,118,56,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19, +1,0,154,156,24,0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32,112,114,111,102,105,108,101,0,0,120,218,157,83,103,84,83,233,22,61,247,222,244,66,75,136,128,148,75,111,82,21,8, +32,82,66,139,128,20,145,38,42,33,9,16,74,136,33,161,217,21,81,193,17,69,69,4,27,200,160,136,3,142,142,128,140,21,81,44,12,138,10,216,7,228,33,162,142,131,163,136,138,202,251,225,123,163,107,214,188,247, +230,205,254,181,215,62,231,172,243,157,179,207,7,192,8,12,150,72,51,81,53,128,12,169,66,30,17,224,131,199,196,198,225,228,46,64,129,10,36,112,0,16,8,179,100,33,115,253,35,1,0,248,126,60,60,43,34,192,7, +190,0,1,120,211,11,8,0,192,77,155,192,48,28,135,255,15,234,66,153,92,1,128,132,1,192,116,145,56,75,8,128,20,0,64,122,142,66,166,0,64,70,1,128,157,152,38,83,0,160,4,0,96,203,99,98,227,0,80,45,0,96,39,127, +230,211,0,128,157,248,153,123,1,0,91,148,33,21,1,160,145,0,32,19,101,136,68,0,104,59,0,172,207,86,138,69,0,88,48,0,20,102,75,196,57,0,216,45,0,48,73,87,102,72,0,176,183,0,192,206,16,11,178,0,8,12,0,48, +81,136,133,41,0,4,123,0,96,200,35,35,120,0,132,153,0,20,70,242,87,60,241,43,174,16,231,42,0,0,120,153,178,60,185,36,57,69,129,91,8,45,113,7,87,87,46,30,40,206,73,23,43,20,54,97,2,97,154,64,46,194,121, +153,25,50,129,52,15,224,243,204,0,0,160,145,21,17,224,131,243,253,120,206,14,174,206,206,54,142,182,14,95,45,234,191,6,255,34,98,98,227,254,229,207,171,112,64,0,0,225,116,126,209,254,44,47,179,26,128, +59,6,128,109,254,162,37,238,4,104,94,11,160,117,247,139,102,178,15,64,181,0,160,233,218,87,243,112,248,126,60,60,69,161,144,185,217,217,229,228,228,216,74,196,66,91,97,202,87,125,254,103,194,95,192,87, +253,108,249,126,60,252,247,245,224,190,226,36,129,50,93,129,71,4,248,224,194,204,244,76,165,28,207,146,9,132,98,220,230,143,71,252,183,11,255,252,29,211,34,196,73,98,185,88,42,20,227,81,18,113,142,68, +154,140,243,50,165,34,137,66,146,41,197,37,210,255,100,226,223,44,251,3,62,223,53,0,176,106,62,1,123,145,45,168,93,99,3,246,75,39,16,88,116,192,226,247,0,0,242,187,111,193,212,40,8,3,128,104,131,225,207, +119,255,239,63,253,71,160,37,0,128,102,73,146,113,0,0,94,68,36,46,84,202,179,63,199,8,0,0,68,160,129,42,176,65,27,244,193,24,44,192,6,28,193,5,220,193,11,252,96,54,132,66,36,196,194,66,16,66,10,100,128, +28,114,96,41,172,130,66,40,134,205,176,29,42,96,47,212,64,29,52,192,81,104,134,147,112,14,46,194,85,184,14,61,112,15,250,97,8,158,193,40,188,129,9,4,65,200,8,19,97,33,218,136,1,98,138,88,35,142,8,23,153, +133,248,33,193,72,4,18,139,36,32,201,136,20,81,34,75,145,53,72,49,82,138,84,32,85,72,29,242,61,114,2,57,135,92,70,186,145,59,200,0,50,130,252,134,188,71,49,148,129,178,81,61,212,12,181,67,185,168,55,26, +132,70,162,11,208,100,116,49,154,143,22,160,155,208,114,180,26,61,140,54,161,231,208,171,104,15,218,143,62,67,199,48,192,232,24,7,51,196,108,48,46,198,195,66,177,56,44,9,147,99,203,177,34,172,12,171,198, +26,176,86,172,3,187,137,245,99,207,177,119,4,18,129,69,192,9,54,4,119,66,32,97,30,65,72,88,76,88,78,216,72,168,32,28,36,52,17,218,9,55,9,3,132,81,194,39,34,147,168,75,180,38,186,17,249,196,24,98,50,49, +135,88,72,44,35,214,18,143,19,47,16,123,136,67,196,55,36,18,137,67,50,39,185,144,2,73,177,164,84,210,18,210,70,210,110,82,35,233,44,169,155,52,72,26,35,147,201,218,100,107,178,7,57,148,44,32,43,200,133, +228,157,228,195,228,51,228,27,228,33,242,91,10,157,98,64,113,164,248,83,226,40,82,202,106,74,25,229,16,229,52,229,6,101,152,50,65,85,163,154,82,221,168,161,84,17,53,143,90,66,173,161,182,82,175,81,135, +168,19,52,117,154,57,205,131,22,73,75,165,173,162,149,211,26,104,23,104,247,105,175,232,116,186,17,221,149,30,78,151,208,87,210,203,233,71,232,151,232,3,244,119,12,13,134,21,131,199,136,103,40,25,155, +24,7,24,103,25,119,24,175,152,76,166,25,211,139,25,199,84,48,55,49,235,152,231,153,15,153,111,85,88,42,182,42,124,21,145,202,10,149,74,149,38,149,27,42,47,84,169,170,166,170,222,170,11,85,243,85,203,84, +143,169,94,83,125,174,70,85,51,83,227,169,9,212,150,171,85,170,157,80,235,83,27,83,103,169,59,168,135,170,103,168,111,84,63,164,126,89,253,137,6,89,195,76,195,79,67,164,81,160,177,95,227,188,198,32,11, +99,25,179,120,44,33,107,13,171,134,117,129,53,196,38,177,205,217,124,118,42,187,152,253,29,187,139,61,170,169,161,57,67,51,74,51,87,179,82,243,148,102,63,7,227,152,113,248,156,116,78,9,231,40,167,151, +243,126,138,222,20,239,41,226,41,27,166,52,76,185,49,101,92,107,170,150,151,150,88,171,72,171,81,171,71,235,189,54,174,237,167,157,166,189,69,187,89,251,129,14,65,199,74,39,92,39,71,103,143,206,5,157, +231,83,217,83,221,167,10,167,22,77,61,58,245,174,46,170,107,165,27,161,187,68,119,191,110,167,238,152,158,190,94,128,158,76,111,167,222,121,189,231,250,28,125,47,253,84,253,109,250,167,245,71,12,88,6, +179,12,36,6,219,12,206,24,60,197,53,113,111,60,29,47,199,219,241,81,67,93,195,64,67,165,97,149,97,151,225,132,145,185,209,60,163,213,70,141,70,15,140,105,198,92,227,36,227,109,198,109,198,163,38,6,38, +33,38,75,77,234,77,238,154,82,77,185,166,41,166,59,76,59,76,199,205,204,205,162,205,214,153,53,155,61,49,215,50,231,155,231,155,215,155,223,183,96,90,120,90,44,182,168,182,184,101,73,178,228,90,166,89, +238,182,188,110,133,90,57,89,165,88,85,90,93,179,70,173,157,173,37,214,187,173,187,167,17,167,185,78,147,78,171,158,214,103,195,176,241,182,201,182,169,183,25,176,229,216,6,219,174,182,109,182,125,97, +103,98,23,103,183,197,174,195,238,147,189,147,125,186,125,141,253,61,7,13,135,217,14,171,29,90,29,126,115,180,114,20,58,86,58,222,154,206,156,238,63,125,197,244,150,233,47,103,88,207,16,207,216,51,227, +182,19,203,41,196,105,157,83,155,211,71,103,23,103,185,115,131,243,136,139,137,75,130,203,46,151,62,46,155,27,198,221,200,189,228,74,116,245,113,93,225,122,210,245,157,155,179,155,194,237,168,219,175, +238,54,238,105,238,135,220,159,204,52,159,41,158,89,51,115,208,195,200,67,224,81,229,209,63,11,159,149,48,107,223,172,126,79,67,79,129,103,181,231,35,47,99,47,145,87,173,215,176,183,165,119,170,247,97, +239,23,62,246,62,114,159,227,62,227,60,55,222,50,222,89,95,204,55,192,183,200,183,203,79,195,111,158,95,133,223,67,127,35,255,100,255,122,255,209,0,167,128,37,1,103,3,137,129,65,129,91,2,251,248,122,124, +33,191,142,63,58,219,101,246,178,217,237,65,140,160,185,65,21,65,143,130,173,130,229,193,173,33,104,200,236,144,173,33,247,231,152,206,145,206,105,14,133,80,126,232,214,208,7,97,230,97,139,195,126,12, +39,133,135,133,87,134,63,142,112,136,88,26,209,49,151,53,119,209,220,67,115,223,68,250,68,150,68,222,155,103,49,79,57,175,45,74,53,42,62,170,46,106,60,218,55,186,52,186,63,198,46,102,89,204,213,88,157, +88,73,108,75,28,57,46,42,174,54,110,108,190,223,252,237,243,135,226,157,226,11,227,123,23,152,47,200,93,112,121,161,206,194,244,133,167,22,169,46,18,44,58,150,64,76,136,78,56,148,240,65,16,42,168,22,140, +37,242,19,119,37,142,10,121,194,29,194,103,34,47,209,54,209,136,216,67,92,42,30,78,242,72,42,77,122,146,236,145,188,53,121,36,197,51,165,44,229,185,132,39,169,144,188,76,13,76,221,155,58,158,22,154,118, +32,109,50,61,58,189,49,131,146,145,144,113,66,170,33,77,147,182,103,234,103,230,102,118,203,172,101,133,178,254,197,110,139,183,47,30,149,7,201,107,179,144,172,5,89,45,10,182,66,166,232,84,90,40,215,42, +7,178,103,101,87,102,191,205,137,202,57,150,171,158,43,205,237,204,179,202,219,144,55,156,239,159,255,237,18,194,18,225,146,182,165,134,75,87,45,29,88,230,189,172,106,57,178,60,113,121,219,10,227,21,5, +43,134,86,6,172,60,184,138,182,42,109,213,79,171,237,87,151,174,126,189,38,122,77,107,129,94,193,202,130,193,181,1,107,235,11,85,10,229,133,125,235,220,215,237,93,79,88,47,89,223,181,97,250,134,157,27, +62,21,137,138,174,20,219,23,151,21,127,216,40,220,120,229,27,135,111,202,191,153,220,148,180,169,171,196,185,100,207,102,210,102,233,230,222,45,158,91,14,150,170,151,230,151,14,110,13,217,218,180,13,223, +86,180,237,245,246,69,219,47,151,205,40,219,187,131,182,67,185,163,191,60,184,188,101,167,201,206,205,59,63,84,164,84,244,84,250,84,54,238,210,221,181,97,215,248,110,209,238,27,123,188,246,52,236,213, +219,91,188,247,253,62,201,190,219,85,1,85,77,213,102,213,101,251,73,251,179,247,63,174,137,170,233,248,150,251,109,93,173,78,109,113,237,199,3,210,3,253,7,35,14,182,215,185,212,213,29,210,61,84,82,143, +214,43,235,71,14,199,31,190,254,157,239,119,45,13,54,13,85,141,156,198,226,35,112,68,121,228,233,247,9,223,247,30,13,58,218,118,140,123,172,225,7,211,31,118,29,103,29,47,106,66,154,242,154,70,155,83,154, +251,91,98,91,186,79,204,62,209,214,234,222,122,252,71,219,31,15,156,52,60,89,121,74,243,84,201,105,218,233,130,211,147,103,242,207,140,157,149,157,125,126,46,249,220,96,219,162,182,123,231,99,206,223, +106,15,111,239,186,16,116,225,210,69,255,139,231,59,188,59,206,92,242,184,116,242,178,219,229,19,87,184,87,154,175,58,95,109,234,116,234,60,254,147,211,79,199,187,156,187,154,174,185,92,107,185,238,122, +189,181,123,102,247,233,27,158,55,206,221,244,189,121,241,22,255,214,213,158,57,61,221,189,243,122,111,247,197,247,245,223,22,221,126,114,39,253,206,203,187,217,119,39,238,173,188,79,188,95,244,64,237, +65,217,67,221,135,213,63,91,254,220,216,239,220,127,106,192,119,160,243,209,220,71,247,6,133,131,207,254,145,245,143,15,67,5,143,153,143,203,134,13,134,235,158,56,62,57,57,226,63,114,253,233,252,167,67, +207,100,207,38,158,23,254,162,254,203,174,23,22,47,126,248,213,235,215,206,209,152,209,161,151,242,151,147,191,109,124,165,253,234,192,235,25,175,219,198,194,198,30,190,201,120,51,49,94,244,86,251,237, +193,119,220,119,29,239,163,223,15,79,228,124,32,127,40,255,104,249,177,245,83,208,167,251,147,25,147,147,255,4,3,152,243,252,99,51,45,219,0,0,0,32,99,72,82,77,0,0,122,37,0,0,128,131,0,0,249,255,0,0,128, +233,0,0,117,48,0,0,234,96,0,0,58,152,0,0,23,111,146,95,197,70,0,0,1,62,73,68,65,84,120,218,164,149,235,113,131,64,12,132,191,77,7,180,64,11,164,4,82,130,91,160,5,82,130,93,2,41,1,151,112,46,193,148,224, +148,0,37,144,63,194,115,17,28,195,67,51,59,195,160,19,210,174,116,66,146,90,224,6,116,156,179,50,122,238,128,97,118,66,82,46,233,37,41,147,196,1,20,22,63,58,52,254,155,31,192,47,240,3,4,32,59,192,168, +5,114,247,238,219,216,5,160,136,153,77,8,134,61,172,202,5,70,163,189,199,152,133,137,97,28,152,75,234,141,254,214,100,121,34,89,229,100,110,124,50,36,213,41,189,87,208,184,68,207,133,216,151,21,38,223, +131,6,168,76,243,175,197,169,154,91,97,211,56,0,247,133,152,0,60,150,42,205,172,186,209,100,45,15,78,169,103,86,167,156,113,194,81,210,245,196,213,168,166,62,174,29,242,9,123,235,233,214,164,89,52,3,163, +164,124,75,64,147,184,176,181,73,156,185,201,187,152,191,119,202,176,85,138,139,11,222,131,103,188,65,182,216,29,248,180,77,179,199,110,22,55,219,32,123,46,242,213,245,115,116,189,109,236,156,143,213, +201,101,79,17,237,212,97,245,239,113,98,211,183,134,34,49,84,193,122,253,246,29,77,22,34,217,66,98,229,77,96,239,128,120,139,165,122,172,248,58,167,162,206,244,138,68,143,114,195,191,66,254,6,0,126,149, +120,206,190,115,158,185,0,0,0,0,73,69,78,68,174,66,96,130,0,0}; + +// JUCER_RESOURCE: bass_v_png, 3093, "../../bass_v.png" +static const unsigned char score_bass_v_png[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,19,0,0,0,27,8,6,0,0,0,158,3,180,161,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19, +1,0,154,156,24,0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32,112,114,111,102,105,108,101,0,0,120,218,157,83,103,84,83,233,22,61,247,222,244,66,75,136,128,148,75,111,82,21,8, +32,82,66,139,128,20,145,38,42,33,9,16,74,136,33,161,217,21,81,193,17,69,69,4,27,200,160,136,3,142,142,128,140,21,81,44,12,138,10,216,7,228,33,162,142,131,163,136,138,202,251,225,123,163,107,214,188,247, +230,205,254,181,215,62,231,172,243,157,179,207,7,192,8,12,150,72,51,81,53,128,12,169,66,30,17,224,131,199,196,198,225,228,46,64,129,10,36,112,0,16,8,179,100,33,115,253,35,1,0,248,126,60,60,43,34,192,7, +190,0,1,120,211,11,8,0,192,77,155,192,48,28,135,255,15,234,66,153,92,1,128,132,1,192,116,145,56,75,8,128,20,0,64,122,142,66,166,0,64,70,1,128,157,152,38,83,0,160,4,0,96,203,99,98,227,0,80,45,0,96,39,127, +230,211,0,128,157,248,153,123,1,0,91,148,33,21,1,160,145,0,32,19,101,136,68,0,104,59,0,172,207,86,138,69,0,88,48,0,20,102,75,196,57,0,216,45,0,48,73,87,102,72,0,176,183,0,192,206,16,11,178,0,8,12,0,48, +81,136,133,41,0,4,123,0,96,200,35,35,120,0,132,153,0,20,70,242,87,60,241,43,174,16,231,42,0,0,120,153,178,60,185,36,57,69,129,91,8,45,113,7,87,87,46,30,40,206,73,23,43,20,54,97,2,97,154,64,46,194,121, +153,25,50,129,52,15,224,243,204,0,0,160,145,21,17,224,131,243,253,120,206,14,174,206,206,54,142,182,14,95,45,234,191,6,255,34,98,98,227,254,229,207,171,112,64,0,0,225,116,126,209,254,44,47,179,26,128, +59,6,128,109,254,162,37,238,4,104,94,11,160,117,247,139,102,178,15,64,181,0,160,233,218,87,243,112,248,126,60,60,69,161,144,185,217,217,229,228,228,216,74,196,66,91,97,202,87,125,254,103,194,95,192,87, +253,108,249,126,60,252,247,245,224,190,226,36,129,50,93,129,71,4,248,224,194,204,244,76,165,28,207,146,9,132,98,220,230,143,71,252,183,11,255,252,29,211,34,196,73,98,185,88,42,20,227,81,18,113,142,68, +154,140,243,50,165,34,137,66,146,41,197,37,210,255,100,226,223,44,251,3,62,223,53,0,176,106,62,1,123,145,45,168,93,99,3,246,75,39,16,88,116,192,226,247,0,0,242,187,111,193,212,40,8,3,128,104,131,225,207, +119,255,239,63,253,71,160,37,0,128,102,73,146,113,0,0,94,68,36,46,84,202,179,63,199,8,0,0,68,160,129,42,176,65,27,244,193,24,44,192,6,28,193,5,220,193,11,252,96,54,132,66,36,196,194,66,16,66,10,100,128, +28,114,96,41,172,130,66,40,134,205,176,29,42,96,47,212,64,29,52,192,81,104,134,147,112,14,46,194,85,184,14,61,112,15,250,97,8,158,193,40,188,129,9,4,65,200,8,19,97,33,218,136,1,98,138,88,35,142,8,23,153, +133,248,33,193,72,4,18,139,36,32,201,136,20,81,34,75,145,53,72,49,82,138,84,32,85,72,29,242,61,114,2,57,135,92,70,186,145,59,200,0,50,130,252,134,188,71,49,148,129,178,81,61,212,12,181,67,185,168,55,26, +132,70,162,11,208,100,116,49,154,143,22,160,155,208,114,180,26,61,140,54,161,231,208,171,104,15,218,143,62,67,199,48,192,232,24,7,51,196,108,48,46,198,195,66,177,56,44,9,147,99,203,177,34,172,12,171,198, +26,176,86,172,3,187,137,245,99,207,177,119,4,18,129,69,192,9,54,4,119,66,32,97,30,65,72,88,76,88,78,216,72,168,32,28,36,52,17,218,9,55,9,3,132,81,194,39,34,147,168,75,180,38,186,17,249,196,24,98,50,49, +135,88,72,44,35,214,18,143,19,47,16,123,136,67,196,55,36,18,137,67,50,39,185,144,2,73,177,164,84,210,18,210,70,210,110,82,35,233,44,169,155,52,72,26,35,147,201,218,100,107,178,7,57,148,44,32,43,200,133, +228,157,228,195,228,51,228,27,228,33,242,91,10,157,98,64,113,164,248,83,226,40,82,202,106,74,25,229,16,229,52,229,6,101,152,50,65,85,163,154,82,221,168,161,84,17,53,143,90,66,173,161,182,82,175,81,135, +168,19,52,117,154,57,205,131,22,73,75,165,173,162,149,211,26,104,23,104,247,105,175,232,116,186,17,221,149,30,78,151,208,87,210,203,233,71,232,151,232,3,244,119,12,13,134,21,131,199,136,103,40,25,155, +24,7,24,103,25,119,24,175,152,76,166,25,211,139,25,199,84,48,55,49,235,152,231,153,15,153,111,85,88,42,182,42,124,21,145,202,10,149,74,149,38,149,27,42,47,84,169,170,166,170,222,170,11,85,243,85,203,84, +143,169,94,83,125,174,70,85,51,83,227,169,9,212,150,171,85,170,157,80,235,83,27,83,103,169,59,168,135,170,103,168,111,84,63,164,126,89,253,137,6,89,195,76,195,79,67,164,81,160,177,95,227,188,198,32,11, +99,25,179,120,44,33,107,13,171,134,117,129,53,196,38,177,205,217,124,118,42,187,152,253,29,187,139,61,170,169,161,57,67,51,74,51,87,179,82,243,148,102,63,7,227,152,113,248,156,116,78,9,231,40,167,151, +243,126,138,222,20,239,41,226,41,27,166,52,76,185,49,101,92,107,170,150,151,150,88,171,72,171,81,171,71,235,189,54,174,237,167,157,166,189,69,187,89,251,129,14,65,199,74,39,92,39,71,103,143,206,5,157, +231,83,217,83,221,167,10,167,22,77,61,58,245,174,46,170,107,165,27,161,187,68,119,191,110,167,238,152,158,190,94,128,158,76,111,167,222,121,189,231,250,28,125,47,253,84,253,109,250,167,245,71,12,88,6, +179,12,36,6,219,12,206,24,60,197,53,113,111,60,29,47,199,219,241,81,67,93,195,64,67,165,97,149,97,151,225,132,145,185,209,60,163,213,70,141,70,15,140,105,198,92,227,36,227,109,198,109,198,163,38,6,38, +33,38,75,77,234,77,238,154,82,77,185,166,41,166,59,76,59,76,199,205,204,205,162,205,214,153,53,155,61,49,215,50,231,155,231,155,215,155,223,183,96,90,120,90,44,182,168,182,184,101,73,178,228,90,166,89, +238,182,188,110,133,90,57,89,165,88,85,90,93,179,70,173,157,173,37,214,187,173,187,167,17,167,185,78,147,78,171,158,214,103,195,176,241,182,201,182,169,183,25,176,229,216,6,219,174,182,109,182,125,97, +103,98,23,103,183,197,174,195,238,147,189,147,125,186,125,141,253,61,7,13,135,217,14,171,29,90,29,126,115,180,114,20,58,86,58,222,154,206,156,238,63,125,197,244,150,233,47,103,88,207,16,207,216,51,227, +182,19,203,41,196,105,157,83,155,211,71,103,23,103,185,115,131,243,136,139,137,75,130,203,46,151,62,46,155,27,198,221,200,189,228,74,116,245,113,93,225,122,210,245,157,155,179,155,194,237,168,219,175, +238,54,238,105,238,135,220,159,204,52,159,41,158,89,51,115,208,195,200,67,224,81,229,209,63,11,159,149,48,107,223,172,126,79,67,79,129,103,181,231,35,47,99,47,145,87,173,215,176,183,165,119,170,247,97, +239,23,62,246,62,114,159,227,62,227,60,55,222,50,222,89,95,204,55,192,183,200,183,203,79,195,111,158,95,133,223,67,127,35,255,100,255,122,255,209,0,167,128,37,1,103,3,137,129,65,129,91,2,251,248,122,124, +33,191,142,63,58,219,101,246,178,217,237,65,140,160,185,65,21,65,143,130,173,130,229,193,173,33,104,200,236,144,173,33,247,231,152,206,145,206,105,14,133,80,126,232,214,208,7,97,230,97,139,195,126,12, +39,133,135,133,87,134,63,142,112,136,88,26,209,49,151,53,119,209,220,67,115,223,68,250,68,150,68,222,155,103,49,79,57,175,45,74,53,42,62,170,46,106,60,218,55,186,52,186,63,198,46,102,89,204,213,88,157, +88,73,108,75,28,57,46,42,174,54,110,108,190,223,252,237,243,135,226,157,226,11,227,123,23,152,47,200,93,112,121,161,206,194,244,133,167,22,169,46,18,44,58,150,64,76,136,78,56,148,240,65,16,42,168,22,140, +37,242,19,119,37,142,10,121,194,29,194,103,34,47,209,54,209,136,216,67,92,42,30,78,242,72,42,77,122,146,236,145,188,53,121,36,197,51,165,44,229,185,132,39,169,144,188,76,13,76,221,155,58,158,22,154,118, +32,109,50,61,58,189,49,131,146,145,144,113,66,170,33,77,147,182,103,234,103,230,102,118,203,172,101,133,178,254,197,110,139,183,47,30,149,7,201,107,179,144,172,5,89,45,10,182,66,166,232,84,90,40,215,42, +7,178,103,101,87,102,191,205,137,202,57,150,171,158,43,205,237,204,179,202,219,144,55,156,239,159,255,237,18,194,18,225,146,182,165,134,75,87,45,29,88,230,189,172,106,57,178,60,113,121,219,10,227,21,5, +43,134,86,6,172,60,184,138,182,42,109,213,79,171,237,87,151,174,126,189,38,122,77,107,129,94,193,202,130,193,181,1,107,235,11,85,10,229,133,125,235,220,215,237,93,79,88,47,89,223,181,97,250,134,157,27, +62,21,137,138,174,20,219,23,151,21,127,216,40,220,120,229,27,135,111,202,191,153,220,148,180,169,171,196,185,100,207,102,210,102,233,230,222,45,158,91,14,150,170,151,230,151,14,110,13,217,218,180,13,223, +86,180,237,245,246,69,219,47,151,205,40,219,187,131,182,67,185,163,191,60,184,188,101,167,201,206,205,59,63,84,164,84,244,84,250,84,54,238,210,221,181,97,215,248,110,209,238,27,123,188,246,52,236,213, +219,91,188,247,253,62,201,190,219,85,1,85,77,213,102,213,101,251,73,251,179,247,63,174,137,170,233,248,150,251,109,93,173,78,109,113,237,199,3,210,3,253,7,35,14,182,215,185,212,213,29,210,61,84,82,143, +214,43,235,71,14,199,31,190,254,157,239,119,45,13,54,13,85,141,156,198,226,35,112,68,121,228,233,247,9,223,247,30,13,58,218,118,140,123,172,225,7,211,31,118,29,103,29,47,106,66,154,242,154,70,155,83,154, +251,91,98,91,186,79,204,62,209,214,234,222,122,252,71,219,31,15,156,52,60,89,121,74,243,84,201,105,218,233,130,211,147,103,242,207,140,157,149,157,125,126,46,249,220,96,219,162,182,123,231,99,206,223, +106,15,111,239,186,16,116,225,210,69,255,139,231,59,188,59,206,92,242,184,116,242,178,219,229,19,87,184,87,154,175,58,95,109,234,116,234,60,254,147,211,79,199,187,156,187,154,174,185,92,107,185,238,122, +189,181,123,102,247,233,27,158,55,206,221,244,189,121,241,22,255,214,213,158,57,61,221,189,243,122,111,247,197,247,245,223,22,221,126,114,39,253,206,203,187,217,119,39,238,173,188,79,188,95,244,64,237, +65,217,67,221,135,213,63,91,254... [truncated message content] |
From: <di...@us...> - 2008-08-04 18:10:31
|
Revision: 1852 http://ftm.svn.sourceforge.net/ftm/?rev=1852&view=rev Author: diemo Date: 2008-08-04 18:10:32 +0000 (Mon, 04 Aug 2008) Log Message: ----------- optimise radius by using it as sentinel upper limit Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtreebuild.c trunk/ftm/ftmlib/classes/kdtreesearch.c Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-04 18:02:51 UTC (rev 1851) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-04 18:10:32 UTC (rev 1852) @@ -4,7 +4,11 @@ #include <math.h> -#define DEBUG_KDTREEBUILD 1 +#ifdef DEBUG +#define DEBUG_KDTREEBUILD 0 +#else +#define DEBUG_KDTREEBUILD 0 +#endif static void compute_mean (kdtree_t *t, int node, int dim) Modified: trunk/ftm/ftmlib/classes/kdtreesearch.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-08-04 18:02:51 UTC (rev 1851) +++ trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-08-04 18:10:32 UTC (rev 1852) @@ -4,7 +4,11 @@ #include <math.h> -#define DEBUG_KDTREESEARCH 2 +#ifdef DEBUG +#define DEBUG_KDTREESEARCH 0 +#else +#define DEBUG_KDTREESEARCH 0 +#endif /* @@ -131,6 +135,7 @@ float dxx; // dxx = distance between 2 vectors int kmax = 0; // index of current Kth neighbour int leaves_start = t->ninner; /* first leaf node */ + float sentinel = r == 0 ? MAX_FLOAT : r + 1e-6; kdtree_stack_t *s = &t->stack; kdtree_stack_elem_t cur; // current (node, dist) couple @@ -144,7 +149,7 @@ // Init distances for(i = 0; i < k; i++) { - dist[i] = MAX_FLOAT; + dist[i] = sentinel; } // Init Search Stack @@ -162,8 +167,7 @@ #endif stack_pop(s, &cur); - if (cur.dist < dist[kmax] && - (r == 0 || cur.dist <= r )) // elimination rule + if (cur.dist < dist[kmax]) // elimination rule { if (cur.node >= leaves_start) { /* leaf node: search through vectors linearly */ @@ -189,7 +193,7 @@ vec_post(kdtree_get_vector(t, i), 1, t->ndim, " and x "); vec_post(vector, stride, t->ndim, "\n"); #endif - if (dxx < dist[kmax] && (r == 0 || dxx <= r)) + if (dxx < dist[kmax]) { /* return original index in data and distance */ if (k == 1) { @@ -266,10 +270,10 @@ #endif #if DEBUG_KDTREESEARCH fts_post("kdtree_search found %d vectors < radius %f\n", - kmax + (dist[kmax] < MAX_FLOAT), r); + kmax + (dist[kmax] < sentinel), r); #endif /* return actual number of found neighbours, can be less than k, then kmax is the index of the next one to find */ - return kmax + (dist[kmax] < MAX_FLOAT); + return kmax + (dist[kmax] < sentinel); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-08-04 18:02:47
|
Revision: 1851 http://ftm.svn.sourceforge.net/ftm/?rev=1851&view=rev Author: diemo Date: 2008-08-04 18:02:51 +0000 (Mon, 04 Aug 2008) Log Message: ----------- properly distinguish and calculate inner nodes sketch insert, append use radius fix return of 0 nearest neighbours Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c trunk/ftm/ftmlib/classes/kdtreesearch.c Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-07-30 17:19:31 UTC (rev 1850) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-08-04 18:02:51 UTC (rev 1851) @@ -116,23 +116,24 @@ float mbdata = MB(FLT(t->dataalloc)); float mbindex = MB(t->dataalloc * sizeof(int)); float mbstack = MB(t->stack.alloc * sizeof(kdtree_stack_elem_t)); - float mbnodes = MB(t->nnodes * sizeof(node_t) + - ((t->nnodes + 1) / 2 - 1) * FLT(t->ndim) * - (t->dmode == dmode_orthogonal ? 1 : 2) - /* inner nodes' mean vectors and splitplanes - (these only in hyperplane mode) */); + float mbnodes = MB(t->nnodes * sizeof(node_t)); + /* inner nodes' mean vectors and splitplanes + (these only in hyperplane mode) */ + float mbinner = MB(t->ninner * FLT(t->ndim) * + (t->dmode == dmode_orthogonal ? 1 : 2)); fts_post("\nTree Info:\n"); fts_post("ndim = %i\n", t->ndim); - fts_post("ndata = %i (%.3f MB extern)\n", t->ndata, mbdata); + fts_post("ndata = %i (%.3f MB extern alloc size)\n", t->ndata, mbdata); fts_post("nalloc = %i (%.3f MB index)\n", t->dataalloc, mbindex); fts_post("height = %i\n", t->height); fts_post("maxheight = %i\n", t->maxheight); fts_post("givenheight = %i\n", t->givenheight); - fts_post("nnodes = %i (%.3f MB)\n", t->nnodes, mbnodes); + fts_post("nnodes = %i (%.3f MB node struct)\n", t->nnodes, mbnodes); + fts_post("inner nodes = %i (%.3f MB node vectors)\n", t->ninner, mbinner); fts_post("stack = %i (%.3f MB)\n", t->stack.alloc, mbstack); fts_post("total size = %.3f MB)\n", - MB(sizeof(kdtree_t)) + mbnodes + mbindex + mbstack); + MB(sizeof(kdtree_t)) + mbnodes + mbinner + mbindex + mbstack); } void kdtree_raw_display (kdtree_t* t) Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-07-30 17:19:31 UTC (rev 1850) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-08-04 18:02:51 UTC (rev 1851) @@ -55,8 +55,9 @@ int endind; /* index of last vector in node in dataindex array */ int splitdim; /* for dmode othogonal, dimension along which node is split*/ - fmat_t *mean; /* mean vector (todo: median) */ - fmat_t *split; /* hyperplane A1*X1 + A2*X2 +...+ An*Xn + An+1 = 0 */ + fmat_t *mean; /* mean vector (todo: median), always present */ + fmat_t *split; /* hyperplane A1*X1 + A2*X2 +...+ An*Xn + An+1 = 0, + or NULL in dmode_orthogonal */ float splitnorm; /* length of split vector */ } node_t; @@ -99,6 +100,7 @@ int maxheight; /* Maximal height of the kdtree */ int givenheight; /* Height given by user, subtract from max if <= 0 */ int nnodes; /* Number of nodes (must be a power of 2) */ + int ninner; /* Number of inner nodes (=index of first leaf node)*/ node_t *nodes; /* nodes (nnodes) */ int sort; /* sort search result by distance */ Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-30 17:19:31 UTC (rev 1850) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-08-04 18:02:51 UTC (rev 1851) @@ -4,7 +4,7 @@ #include <math.h> -#define DEBUG_KDTREEBUILD 0 +#define DEBUG_KDTREEBUILD 1 static void compute_mean (kdtree_t *t, int node, int dim) @@ -45,7 +45,7 @@ #if DEBUG_KDTREEBUILD fts_post("mean vect for node %d = ", node); - vec_post(mean_ptr, t->ndim, "\n"); + vec_post(mean_ptr, 1, t->ndim, "\n"); #endif } @@ -92,7 +92,7 @@ #if DEBUG_KDTREEBUILD fts_post("middle vect for node %d = ", node); - vec_post(mean_ptr, t->ndim, "\n"); + vec_post(mean_ptr, 1, t->ndim, "\n"); #endif } @@ -103,6 +103,7 @@ return (currentVect[component] - mean[component]); } +/* compute and create node-splitting hyperplane */ static void compute_splitplane (kdtree_t* t, int node, int level) { node_t *n = &t->nodes[node]; @@ -113,20 +114,20 @@ switch (t->dmode) { case dmode_hyperplane: - // compute hyperplane orthogonal to the base vector number b + /* compute hyperplane orthogonal to the base vector number b */ n->split = fmat_create(t->ndim, 1); fts_object_refer((fts_object_t *) n->split); - fmat_set_const(n->split, 0); + fmat_set_const (n->split, 0); fmat_set_element(n->split, n->splitdim, 0, 1); #if DEBUG_KDTREEBUILD fts_post("Splitplane of node %i: ", node); - vec_post(fmat_get_ptr(n->split), t->ndim, "\n"); + vec_post(fmat_get_ptr(n->split), 1, t->ndim, "\n"); #endif /* FALLTHROUGH */ case dmode_orthogonal: - n->splitnorm = 1; + n->splitnorm = 1; /* splitplane implicit orthogonal to splitdim */ } } @@ -136,8 +137,11 @@ #if PROFILE_BUILD t->profile.mean++; #endif - + /* determine dimension to split at + (for the moment simply cycling through dimensions by tree level) */ t->nodes[node].splitdim = level % t->ndim; + + /* always create node mean vector */ t->nodes[node].mean = fmat_create(t->ndim, 1); fts_object_refer((fts_object_t *) t->nodes[node].mean); @@ -162,6 +166,7 @@ break; } + /* compute and create node splitting hyperplane */ compute_splitplane(t, node, level); } @@ -221,7 +226,7 @@ return distV2orthoH(x, fmat_get_ptr(n->mean), n->splitdim); case dmode_hyperplane: return distV2H(x, fmat_get_ptr(n->split), - fmat_get_ptr(n->mean), t->ndim, n->splitnorm); + fmat_get_ptr(n->mean), t->ndim, n->splitnorm); default: fts_post("error: unknown mode %d", t->dmode); return 0; @@ -236,7 +241,9 @@ t->profile.v2n++; #endif #if DEBUG_KDTREEBUILD - if (node > t->nnodes || fmat_get_ptr(n->split) == NULL || + if (node > t->ninner || + (n->split == NULL && t->dmode != dmode_orthogonal) || + (n->split != NULL && fmat_get_ptr(n->split) == NULL) || n->splitdim < 0 || n->splitdim > t->ndim) { fts_post("error in distV2N!\n"); @@ -269,8 +276,26 @@ } +/* (re-)insert num data vector into tree. + If index < ndata, move to correct node, + otherwise insert and increment ndata */ +void kdtree_insert (kdtree_t* t, int index, int num) +{ + /* find nearest node to new vector */ + + + /* insert into that node: shift vector indices and node start/end + in parent and right siblings */ + + /* 1: move from insert node up to root */ + + /* 2: traverse right siblings */ +} + + #if 0 -void reBalance(kdtree_t* t) +/* regenerate nodes on already sorted data vectors */ +void kdtree_rebuild (kdtree_t* t) { int i = 0; int j = t->ndata - 1; @@ -330,7 +355,7 @@ #if DEBUG_KDTREEBUILD fts_post("Node #%i (%i..%i): mean = ", n, t->nodes[n].startind, t->nodes[n].endind); - vec_post(fmat_get_ptr(t->nodes[n].mean), t->ndim, "\n"); + vec_post(fmat_get_ptr(t->nodes[n].mean), 1, t->ndim, "\n"); #endif i = t->nodes[n].startind; j = t->nodes[n].endind; @@ -370,7 +395,8 @@ t->height = h; /* init nodes */ - t->nnodes = pow2(h) - 1; + t->nnodes = pow2(h) - 1; + t->ninner = pow2(h - 1) - 1; t->nodes = fts_realloc(t->nodes, t->nnodes * sizeof(node_t)); bzero(t->nodes, t->nnodes * sizeof(node_t)); @@ -387,6 +413,7 @@ for (i = 0; i < t->ndata; i++) t->dataindex[i] = i; - /* init search stack size according to tree height */ + /* init search stack size according to tree height + (with heuristic margin of 4 times) */ kdtree_stack_grow(&t->stack, t->height * 4); } Modified: trunk/ftm/ftmlib/classes/kdtreesearch.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-30 17:19:31 UTC (rev 1850) +++ trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-08-04 18:02:51 UTC (rev 1851) @@ -4,9 +4,13 @@ #include <math.h> -#define DEBUG_KDTREESEARCH 0 +#define DEBUG_KDTREESEARCH 2 +/* + * optimised search stack + */ + void kdtree_stack_init (kdtree_stack_t *s, int size) { s->alloc = size; @@ -47,6 +51,26 @@ #define stack_empty(s) ((s)->size == 0) +static void kdtree_stack_display (kdtree_stack_t *s) +{ + int i; + + if (s->size == 0) + fts_post("stack empty\n"); + else + for (i = s->size; i >= 0; i--) + { + fts_post("stack pos %d: node %3d, dist %f\n", + i, s->buffer[i].node, s->buffer[i].dist); + } +} + + + +/* + * support routines + */ + #define MAX(a, b) ((a) > (b) ? (a) : (b)) static int maxArr (float* array, int size) @@ -100,13 +124,13 @@ /* out: y[K] = index of the Kth nearest neighbour (in float for interfacing reasons) d[K] = distance of the Kth nearest neighbour return: actual number of found neighbours */ -int kdtree_search_knn (kdtree_t *t, float* vector, int stride, int k, float r, +int kdtree_search_knn (kdtree_t *t, float* vector, int stride, int k, const float r, /* out */ float *indx, float *dist) { int i; // current processed vector float dxx; // dxx = distance between 2 vectors int kmax = 0; // index of current Kth neighbour - int leaves_start = (pow2(t->height - 1) - 1); /* first leaf node */ + int leaves_start = t->ninner; /* first leaf node */ kdtree_stack_t *s = &t->stack; kdtree_stack_elem_t cur; // current (node, dist) couple @@ -129,8 +153,8 @@ while (!stack_empty(s)) { -#if DEBUG_KDTREESEARCH -/* displayStack(t->s);*/ +#if DEBUG_KDTREESEARCH >= 2 + kdtree_stack_display(s); #endif #if PROFILE_SEARCH if (s->size > t->profile.maxstack) @@ -142,7 +166,7 @@ (r == 0 || cur.dist <= r )) // elimination rule { if (cur.node >= leaves_start) - { // leaf node + { /* leaf node: search through vectors linearly */ float *sigmaptr = fmat_get_ptr(t->sigma); int istart = t->nodes[cur.node].startind; int iend = t->nodes[cur.node].endind; @@ -162,10 +186,10 @@ #endif #if DEBUG_KDTREESEARCH fts_post("distance = %f between vector %d ", dxx, i); - vec_post(kdtree_get_vector(t, i), t->ndim, " and x "); - vec_post(vector, stride, t->ndim, "\n"); + vec_post(kdtree_get_vector(t, i), 1, t->ndim, " and x "); + vec_post(vector, stride, t->ndim, "\n"); #endif - if (dxx < dist[kmax]) + if (dxx < dist[kmax] && (r == 0 || dxx <= r)) { /* return original index in data and distance */ if (k == 1) { @@ -223,11 +247,29 @@ } } } - /* else: node can be eliminated from search */ +#if DEBUG_KDTREESEARCH + else /* node can be eliminated from search */ + { + if (cur.dist > dist[kmax]) + fts_post("eleminate node %d: dist %f > dist[kmax=%d] = %f\n", + cur.node, cur.dist, kmax, dist[kmax]); + else + fts_post("eleminate node %d: dist %f > r = %f\n", + cur.node, cur.dist, r); + } +#endif + } #if PROFILE_SEARCH t->profile.searches++; t->profile.neighbours += kmax + 1; #endif - return kmax + 1; /* return actual number of found neighbours */ +#if DEBUG_KDTREESEARCH + fts_post("kdtree_search found %d vectors < radius %f\n", + kmax + (dist[kmax] < MAX_FLOAT), r); +#endif + + /* return actual number of found neighbours, can be less than k, + then kmax is the index of the next one to find */ + return kmax + (dist[kmax] < MAX_FLOAT); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-30 17:19:23
|
Revision: 1850 http://ftm.svn.sourceforge.net/ftm/?rev=1850&view=rev Author: diemo Date: 2008-07-30 17:19:31 +0000 (Wed, 30 Jul 2008) Log Message: ----------- some functions to macros, proper and optimised stack implementation --> now crossover with mahalanobis at 70-100 elements fixed memory usage and leak for nodes print memory use Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c trunk/ftm/ftmlib/classes/kdtreesearch.c Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-07-30 11:40:18 UTC (rev 1849) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-07-30 17:19:31 UTC (rev 1850) @@ -43,46 +43,6 @@ fts_symbol_t s_getknni; -/* for the search algorithm */ -typedef struct stack_elem -{ - int node; - double dist; -} stack_elem_t; - -static void stack_push (fts_stack_t *s, int p, double d) -{ -/* doesn't work with CodeWorrior - stack_elem_t _new = { p, d }; - fts_stack_push(s, stack_elem_t, _new); - */ -} - -static int stack_pop (fts_stack_t *s, int *p, double *d) -{ - int top = fts_stack_top(s); - - if (top >= 0) - { - stack_elem_t *_tmp = ((stack_elem_t *) fts_stack_base(s)) + top; - - *p = _tmp->node; - *d = _tmp->dist; - - fts_stack_pop(s, 1); - return 1; - } - else - return 0; -} - - -int pow2 (int x) -{ - return 1 << x; -} - - #if PROFILE void profile_clear (kdtree_t *t) { @@ -92,6 +52,7 @@ t->profile.hyper = 0; t->profile.searches = 0; t->profile.neighbours = 0; + t->profile.maxstack = 0; } #endif @@ -136,29 +97,6 @@ } -/* - @return number of vectors found n, n <= k - list of n indices in result -*/ -#if 0 -static int kdtree_search (kdtree_t *tree, fmat_t *x, int k, int *result) -{ - fts_stack_t stack; - - fts_stack_init(&stack, stack_elem_t); - - stack_push(&stack, 0, 0); - - /* one element access */ -/* fmat_get_element(x, 0, i); */ - - /* testing: */ - result[0] = 0; - return 1; -} -#endif - - void vec_post (float *v, int stride, int n, const char *suffix) { int i, ii; @@ -172,15 +110,29 @@ void kdtree_info_display (kdtree_t* t) { - int i; +# define MB(b) ((float) (b) / (float) (1024 * 1024)) +# define FLT(b) ((b) * sizeof(float)) + + float mbdata = MB(FLT(t->dataalloc)); + float mbindex = MB(t->dataalloc * sizeof(int)); + float mbstack = MB(t->stack.alloc * sizeof(kdtree_stack_elem_t)); + float mbnodes = MB(t->nnodes * sizeof(node_t) + + ((t->nnodes + 1) / 2 - 1) * FLT(t->ndim) * + (t->dmode == dmode_orthogonal ? 1 : 2) + /* inner nodes' mean vectors and splitplanes + (these only in hyperplane mode) */); + fts_post("\nTree Info:\n"); fts_post("ndim = %i\n", t->ndim); - fts_post("ndata = %i\n", t->ndata); - fts_post("nalloc = %i\n", t->dataalloc); + fts_post("ndata = %i (%.3f MB extern)\n", t->ndata, mbdata); + fts_post("nalloc = %i (%.3f MB index)\n", t->dataalloc, mbindex); fts_post("height = %i\n", t->height); fts_post("maxheight = %i\n", t->maxheight); fts_post("givenheight = %i\n", t->givenheight); - fts_post("nnodes = %i\n", t->nnodes); + fts_post("nnodes = %i (%.3f MB)\n", t->nnodes, mbnodes); + fts_post("stack = %i (%.3f MB)\n", t->stack.alloc, mbstack); + fts_post("total size = %.3f MB)\n", + MB(sizeof(kdtree_t)) + mbnodes + mbindex + mbstack); } void kdtree_raw_display (kdtree_t* t) @@ -232,6 +184,23 @@ } +/* free nodes */ +void kdtree_clear_nodes (kdtree_t *self) +{ + int i; + + for (i = 0; i < self->nnodes; i++) + { + if (self->nodes[i].mean) fts_object_release(self->nodes[i].mean); + if (self->nodes[i].split) fts_object_release(self->nodes[i].split); +#if DEBUG + self->nodes[i].mean = NULL; + self->nodes[i].split = NULL; +#endif + } +} + + void kdtree_set (kdtree_t *self, fmat_t *data, fmat_t *sigma) { int maxheight = floor(log2(fmat_get_m(data))); @@ -245,6 +214,8 @@ height = 1; /* minimum: just one node, linear search */ self->maxheight = maxheight; + kdtree_clear_nodes(self); + if (self->data) fts_object_release((fts_object_t *) self->data); @@ -253,9 +224,6 @@ kdtree_set_sigma(self, sigma); kdtree_init_data(self, height, fmat_get_m(data), fmat_get_n(data)); - - /* kdtree_clear and rebuild: */ - /* kdtree_clear(self);*/ kdtree_build(self); } @@ -482,6 +450,8 @@ fts_object_refer((fts_object_t *) self->data); fts_object_refer((fts_object_t *) self->sigma); + kdtree_stack_init(&self->stack, 0); + #if PROFILE_BUILD profile_clear(self); #endif @@ -501,17 +471,7 @@ kdtree_t *self = (kdtree_t *) o; int i; -/* todo: move to kdtree_clear */ - /* free nodes */ - for (i = 0; i < self->nnodes; i++) - { - fts_object_release(self->nodes[i].mean); - fts_object_release(self->nodes[i].split); -#if DEBUG - self->nodes[i].mean = NULL; - self->nodes[i].split = NULL; -#endif - } + kdtree_clear_nodes(self); /* free data */ fts_object_release(self->data); /* release stored vectors */ @@ -519,8 +479,10 @@ /* free structure */ if (self->dataindex) fts_free(self->dataindex); if (self->nodes) fts_free(self->nodes); - if(self->sigma_indnz != NULL) fts_free(self->sigma_indnz); + if (self->sigma_indnz != NULL) fts_free(self->sigma_indnz); + kdtree_stack_free(&self->stack); + #if DEBUG self->data = NULL; self->dataindex = NULL; Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-07-30 11:40:18 UTC (rev 1849) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-07-30 17:19:31 UTC (rev 1850) @@ -35,17 +35,18 @@ #define MAX_NODES 100 /* stack elements for search algorithm */ -typedef struct coupleNodeDist +typedef struct _elem { - int node; + int node; float dist; -} couple; +} kdtree_stack_elem_t; -typedef struct searchStack +typedef struct _stack { - couple c[MAX_NODES]; - int sp; -} stack; + int size; + int alloc; + kdtree_stack_elem_t *buffer; +} kdtree_stack_t; typedef struct node @@ -101,7 +102,7 @@ node_t *nodes; /* nodes (nnodes) */ int sort; /* sort search result by distance */ - stack s; + kdtree_stack_t stack; struct { int v2v; /* vector to vector distances */ @@ -110,6 +111,7 @@ int hyper; /* split plane calculations */ int searches; /* searches performed */ int neighbours; /* neighbours found */ + int maxstack; /* highest stack size */ } profile; } kdtree_t; @@ -125,21 +127,27 @@ #define fmat_get_row_ptr(f, i) (fmat_get_ptr(f) + (i) * fmat_get_n(f)) +#define pow2(x) (1 << (x)) -int pow2(int x); + void vec_post (float *v, int stride, int n, const char *suffix); void kdtree_info_display (kdtree_t* t); void kdtree_raw_display (kdtree_t* t); void kdtree_data_display (kdtree_t* t); void profile_clear (kdtree_t *t); +void kdtree_stack_init (kdtree_stack_t *s, int size); +void kdtree_stack_free (kdtree_stack_t *s); +void kdtree_stack_grow (kdtree_stack_t *stack, int alloc); + /* vector to node distance */ float distV2N (kdtree_t* t, const float *x, const int node); float distV2N_stride (kdtree_t* t, const float *x, int stride, const int node); void kdtree_set_decomposition(kdtree_t *t, kdtree_dmode_t mode, void *param); -void kdtree_set (kdtree_t *self, fmat_t *data, fmat_t *sigma); +void kdtree_clear_nodes (kdtree_t *self); +void kdtree_set (kdtree_t *self, fmat_t *data, fmat_t *sigma); void kdtree_set_sigma (kdtree_t *self, fmat_t *sigma); void kdtree_build (kdtree_t* t); void kdtree_init_data (kdtree_t* t, int h, int vect_num, int dim); Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-30 11:40:18 UTC (rev 1849) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-30 17:19:31 UTC (rev 1850) @@ -110,17 +110,24 @@ #if PROFILE_BUILD t->profile.hyper++; #endif + switch (t->dmode) + { + case dmode_hyperplane: + // compute hyperplane orthogonal to the base vector number b + n->split = fmat_create(t->ndim, 1); + fts_object_refer((fts_object_t *) n->split); + + fmat_set_const(n->split, 0); + fmat_set_element(n->split, n->splitdim, 0, 1); - /* case dmode_orthogonal */ - // compute hyperplane orthogonal to the base vector number b - fmat_set_const(n->split, 0); - fmat_set_element(n->split, n->splitdim, 0, 1); - n->splitnorm = 1; - #if DEBUG_KDTREEBUILD fts_post("Splitplane of node %i: ", node); vec_post(fmat_get_ptr(n->split), t->ndim, "\n"); #endif + /* FALLTHROUGH */ + case dmode_orthogonal: + n->splitnorm = 1; + } } @@ -131,6 +138,8 @@ #endif t->nodes[node].splitdim = level % t->ndim; + t->nodes[node].mean = fmat_create(t->ndim, 1); + fts_object_refer((fts_object_t *) t->nodes[node].mean); switch (t->mmode) { @@ -205,14 +214,6 @@ #if PROFILE_BUILD t->profile.v2n++; #endif -#if DEBUG_KDTREEBUILD - if (node > t->nnodes || fmat_get_ptr(n->split) == NULL || - n->splitdim < 0 || n->splitdim > t->ndim) - { - fts_post("error in distV2N!\n"); - return 0; - } -#endif switch (t->dmode) { @@ -373,15 +374,6 @@ t->nodes = fts_realloc(t->nodes, t->nnodes * sizeof(node_t)); bzero(t->nodes, t->nnodes * sizeof(node_t)); - for (i = 0; i < t->nnodes; i++) - { - t->nodes[i].mean = fmat_create(dim, 1); - t->nodes[i].split = fmat_create(dim, 1); - - fts_object_refer((fts_object_t *) t->nodes[i].mean); - fts_object_refer((fts_object_t *) t->nodes[i].split); - } - if (t->nnodes > 0) { /* init root node */ t->nodes[0].startind = 0; @@ -394,4 +386,7 @@ for (i = 0; i < t->ndata; i++) t->dataindex[i] = i; + + /* init search stack size according to tree height */ + kdtree_stack_grow(&t->stack, t->height * 4); } Modified: trunk/ftm/ftmlib/classes/kdtreesearch.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-30 11:40:18 UTC (rev 1849) +++ trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-30 17:19:31 UTC (rev 1850) @@ -7,77 +7,61 @@ #define DEBUG_KDTREESEARCH 0 -static void initStack(stack* s) +void kdtree_stack_init (kdtree_stack_t *s, int size) { - s->sp = -1; + s->alloc = size; + s->buffer = (kdtree_stack_elem_t *) fts_malloc(s->alloc * sizeof(kdtree_stack_elem_t)); + s->size = 0; } -static int isEmpty(stack s) -{ - if(s.sp < 0) return 1; - return 0; -} +#define stack_clear(s) ((s)->size = 0) -static void push(stack* s, couple c) +void kdtree_stack_free (kdtree_stack_t *s) { - s->sp++; - if(s->sp >= MAX_NODES) - fts_post("Warning: Stack capacity is attented [sp = %i]\n", s->sp); - s->c[s->sp].node = c.node; - s->c[s->sp].dist = c.dist; + if (s->buffer) + fts_free(s->buffer); } -static couple pop(stack* s) +static int stack_realloc (kdtree_stack_t *stack, int alloc) { - if(s->sp < 0) - fts_post("Warning: Stack is empty, popped values may be inderteminated [sp = %i]\n", - s->sp); - couple tmp = s->c[s->sp]; - s->sp--; - return tmp; +#if DEBUG_KDTREESEARCH + fts_post("kdtree: grow stack from d to %d\n", stack->alloc, alloc); +#endif + stack->buffer = (kdtree_stack_elem_t *) fts_realloc( stack->buffer, alloc * sizeof(kdtree_stack_elem_t)); + stack->alloc = alloc; } - -static void displayStack(stack s) +void kdtree_stack_grow (kdtree_stack_t *stack, int alloc) { - int i = s.sp; - if(s.sp < 0) fts_post("Stack is empty\n"); - else - { - fts_post("TOS (size %d) --------------\n", s.sp + 1); - while(i >= 0) - { - fts_post("stack pos %d (node %d, dist %f)\n", i, s.c[i].node, s.c[i].dist); - i--; - } - } + if (alloc > stack->alloc) + stack_realloc (stack, alloc); } -static void displayCouple(couple c) -{ - fts_post("Couple( %i, %f)\n", c.node, c.dist); -} +#define stack_push(s, n, d) ((((s)->size >= (s)->alloc) ? stack_realloc((s), 2 * (s)->alloc) : 0), \ + ((s)->buffer)[(s)->size].node = (n), \ + ((s)->buffer)[(s)->size++].dist = (d)) -static void coupleBuild(couple* c, int n, float d) -{ - c->node = n; - c->dist = d; -} +#define stack_pop_safe(s, elem) (((s)->size > 0) ? (elem = s->buffer[--((s)->size)]) : 0) -static float max(float a, float b) -{ - return (a > b)? a : b; -} +#define stack_pop(s, elem) (*elem = s->buffer[--((s)->size)]) +#define stack_empty(s) ((s)->size == 0) -static int maxArr(float* array, int size) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +static int maxArr (float* array, int size) { - int index = 0; + int index = 0; + float max = array[0]; int i; - for(i = 1; i<size; i++) + for (i = 1; i < size; i++) { - if(array[index] < array[i]) index = i; + if (array[i] > max) + { + index = i; + max = array[i]; + } } return index; @@ -122,8 +106,11 @@ int i; // current processed vector float dxx; // dxx = distance between 2 vectors int kmax = 0; // index of current Kth neighbour - couple cur; // current (node, dist) couple + int leaves_start = (pow2(t->height - 1) - 1); /* first leaf node */ + kdtree_stack_t *s = &t->stack; + kdtree_stack_elem_t cur; // current (node, dist) couple + if (t->ndata == 0) return 0; @@ -137,20 +124,24 @@ } // Init Search Stack - coupleBuild(&cur, 0, 0); - push(&t->s, cur); - - while (!isEmpty(t->s)) + stack_clear(s); + stack_push(s, 0, 0); + + while (!stack_empty(s)) { #if DEBUG_KDTREESEARCH - displayStack(t->s); +/* displayStack(t->s);*/ #endif - cur = pop(&t->s); +#if PROFILE_SEARCH + if (s->size > t->profile.maxstack) + t->profile.maxstack = s->size; +#endif + stack_pop(s, &cur); if (cur.dist < dist[kmax] && (r == 0 || cur.dist <= r )) // elimination rule { - if (cur.node >= (pow2(t->height - 1) - 1)) + if (cur.node >= leaves_start) { // leaf node float *sigmaptr = fmat_get_ptr(t->sigma); int istart = t->nodes[cur.node].startind; @@ -222,21 +213,13 @@ #endif if (d < 0) { - couple c1; - couple c2; - coupleBuild(&c1, 2*cur.node+2, max(cur.dist, d*d)); - coupleBuild(&c2, 2*cur.node+1, cur.dist); - push(&t->s, c1); - push(&t->s, c2); + stack_push(s, 2*cur.node+2, MAX(cur.dist, d*d)); + stack_push(s, 2*cur.node+1, cur.dist); } else { - couple c1; - couple c2; - coupleBuild(&c1, 2*cur.node+1, max(cur.dist, d*d)); - coupleBuild(&c2, 2*cur.node+2, cur.dist); - push(&t->s, c1); - push(&t->s, c2); + stack_push(s, 2*cur.node+1, MAX(cur.dist, d*d)); + stack_push(s, 2*cur.node+2, cur.dist); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-30 11:40:10
|
Revision: 1849 http://ftm.svn.sourceforge.net/ftm/?rev=1849&view=rev Author: diemo Date: 2008-07-30 11:40:18 +0000 (Wed, 30 Jul 2008) Log Message: ----------- can use fvec Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c trunk/ftm/ftmlib/classes/kdtreesearch.c Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-07-30 09:40:37 UTC (rev 1848) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-07-30 11:40:18 UTC (rev 1849) @@ -159,13 +159,13 @@ #endif -void vec_post (float *v, int n, const char *suffix) +void vec_post (float *v, int stride, int n, const char *suffix) { - int i; + int i, ii; - for (i = 0; i < n; i++) + for (i = 0, ii = 0; i < n; i++, ii += stride) { - fts_post("%s%.1f", (i == 0 ? "[" : ", "), v[i]); + fts_post("%s%.1f", (ii == 0 ? "[" : ", "), v[ii]); } fts_post("]%s", suffix); } @@ -192,7 +192,7 @@ for (i = 0; i < t->ndata; i++) { fts_post("raw data vec %-3i = ", i); - vec_post(fmat_get_row_ptr(t->data, i), t->ndim, "\n"); + vec_post(fmat_get_row_ptr(t->data, i), 1, t->ndim, "\n"); } } @@ -214,7 +214,7 @@ for (i = t->nodes[n].startind; i <= t->nodes[n].endind; i++) { fts_post("vec %d = ", t->dataindex[i]); - vec_post(kdtree_get_vector(t, i), t->ndim, + vec_post(kdtree_get_vector(t, i), 1, t->ndim, i < t->nodes[n].endind ? ", " : ""); } fts_post(")\n"); @@ -336,7 +336,7 @@ result = alloca(k * sizeof(float)); d = alloca(k * sizeof(float)); - n = kdtree_search_knn(self, fmat_get_ptr(x), k, 0, result, d); + n = kdtree_search_knn(self, fmat_get_ptr(x), 1, k, 0, result, d); if (s == fts_s_get) /* geti: nearest index? */ { /* return one fvec */ Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-07-30 09:40:37 UTC (rev 1848) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-07-30 11:40:18 UTC (rev 1849) @@ -127,7 +127,7 @@ int pow2(int x); -void vec_post (float *v, int n, const char *suffix); +void vec_post (float *v, int stride, int n, const char *suffix); void kdtree_info_display (kdtree_t* t); void kdtree_raw_display (kdtree_t* t); void kdtree_data_display (kdtree_t* t); @@ -135,6 +135,7 @@ /* vector to node distance */ float distV2N (kdtree_t* t, const float *x, const int node); +float distV2N_stride (kdtree_t* t, const float *x, int stride, const int node); void kdtree_set_decomposition(kdtree_t *t, kdtree_dmode_t mode, void *param); @@ -143,6 +144,6 @@ void kdtree_build (kdtree_t* t); void kdtree_init_data (kdtree_t* t, int h, int vect_num, int dim); -int kdtree_search_knn (kdtree_t *t, float* x, int k, float r, float *y, float *d); +int kdtree_search_knn (kdtree_t *t, float* x, int stride, int k, float r, float *y, float *d); #endif Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-30 09:40:37 UTC (rev 1848) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-30 11:40:18 UTC (rev 1849) @@ -103,13 +103,6 @@ return (currentVect[component] - mean[component]); } - -/* vector to orthogonal plane node distance along split dimension dim */ -static float distV2orthoH (const float* vect, float* mean, int dim) -{ - return vect[dim] - mean[dim]; -} - static void compute_splitplane (kdtree_t* t, int node, int level) { node_t *n = &t->nodes[node]; @@ -164,7 +157,17 @@ } +/* vector to orthogonal plane node distance along split dimension dim */ +static float distV2orthoH (const float* vect, float* mean, int dim) +{ + return vect[dim] - mean[dim]; +} +static float distV2orthoH_stride (const float* vect, int stride, float* mean, int dim) +{ + return vect[dim * stride] - mean[dim]; +} + /* vector to general plane node distance */ static float distV2H (const float* vect, float* plane, float* mean, int vectDim, float norm) @@ -179,8 +182,21 @@ } return (dotprod / norm); } +static float distV2H_stride (const float* vect, int stride, float* plane, + float* mean, int vectDim, float norm) +{ + // standard algebra computing + int i, iv; + float dotprod = 0; + for(i = 0, iv = 0; i < vectDim; i++, iv += stride) + { + dotprod += (vect[iv] - mean[i]) * plane[i]; + } + return (dotprod / norm); +} + /* vector to node distance */ float distV2N (kdtree_t* t, const float *x, const int node) { @@ -203,15 +219,44 @@ case dmode_orthogonal: return distV2orthoH(x, fmat_get_ptr(n->mean), n->splitdim); case dmode_hyperplane: - return distV2H(x, fmat_get_ptr(n->split), fmat_get_ptr(n->mean), - t->ndim, n->splitnorm); + return distV2H(x, fmat_get_ptr(n->split), + fmat_get_ptr(n->mean), t->ndim, n->splitnorm); default: fts_post("error: unknown mode %d", t->dmode); return 0; } } +float distV2N_stride (kdtree_t* t, const float *x, int stride, const int node) +{ + node_t *n = &t->nodes[node]; +#if PROFILE_BUILD + t->profile.v2n++; +#endif +#if DEBUG_KDTREEBUILD + if (node > t->nnodes || fmat_get_ptr(n->split) == NULL || + n->splitdim < 0 || n->splitdim > t->ndim) + { + fts_post("error in distV2N!\n"); + return 0; + } +#endif + + switch (t->dmode) + { + case dmode_orthogonal: + return distV2orthoH_stride(x, stride, fmat_get_ptr(n->mean), n->splitdim); + case dmode_hyperplane: + return distV2H_stride(x, stride, fmat_get_ptr(n->split), + fmat_get_ptr(n->mean), t->ndim, n->splitnorm); + default: + fts_post("error: unknown mode %d", t->dmode); + return 0; + } +} + + /* swap positions of vectors i and j: only in indirection array */ static void swap (kdtree_t* t, int i, int j) { Modified: trunk/ftm/ftmlib/classes/kdtreesearch.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-30 09:40:37 UTC (rev 1848) +++ trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-30 11:40:18 UTC (rev 1849) @@ -97,15 +97,15 @@ return sum; } -static float weighted_euclidean_distance (float* v1, float* v2, float *sigma, int dim) +static float weighted_euclidean_distance (float* v1, int stride1, float* v2, float *sigma, int dim) { - int i; + int i, i1; float sum = 0; - for (i = 0; i < dim; i++) + for (i = 0, i1 = 0; i < dim; i++, i1 += stride1) if (sigma[i] > 0) { - float diff = (v2[i] - v1[i]) / sigma[i]; + float diff = (v2[i] - v1[i1]) / sigma[i]; sum += diff * diff; } @@ -116,7 +116,7 @@ /* out: y[K] = index of the Kth nearest neighbour (in float for interfacing reasons) d[K] = distance of the Kth nearest neighbour return: actual number of found neighbours */ -int kdtree_search_knn (kdtree_t *t, float* x, int k, float r, +int kdtree_search_knn (kdtree_t *t, float* vector, int stride, int k, float r, /* out */ float *indx, float *dist) { int i; // current processed vector @@ -163,7 +163,7 @@ #endif for (i = istart; i <= iend; i++) { - dxx = weighted_euclidean_distance(x, + dxx = weighted_euclidean_distance(vector, stride, kdtree_get_vector(t, i), sigmaptr, t->ndim); #if PROFILE_SEARCH @@ -172,7 +172,7 @@ #if DEBUG_KDTREESEARCH fts_post("distance = %f between vector %d ", dxx, i); vec_post(kdtree_get_vector(t, i), t->ndim, " and x "); - vec_post(x, t->ndim, "\n"); + vec_post(vector, stride, t->ndim, "\n"); #endif if (dxx < dist[kmax]) { /* return original index in data and distance */ @@ -215,7 +215,7 @@ } else { // branched node - float d = distV2N(t, x, cur.node); + float d = distV2N_stride(t, vector, stride, cur.node); #if DEBUG_KDTREESEARCH fts_post("Inner node %d d %f cur.dist %f\n", cur.node, d, cur.dist); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-30 09:40:27
|
Revision: 1848 http://ftm.svn.sourceforge.net/ftm/?rev=1848&view=rev Author: diemo Date: 2008-07-30 09:40:37 +0000 (Wed, 30 Jul 2008) Log Message: ----------- trying to catch bogus releases when DEBUG_OBJECT_RELEASE is defined (only in debug mode) Modified Paths: -------------- trunk/ftm/ftmlib/object.c trunk/ftm/ftmlib/object.h Modified: trunk/ftm/ftmlib/object.c =================================================================== --- trunk/ftm/ftmlib/object.c 2008-07-29 18:11:21 UTC (rev 1847) +++ trunk/ftm/ftmlib/object.c 2008-07-30 09:40:37 UTC (rev 1848) @@ -114,7 +114,6 @@ } #ifdef DEBUG_REF_COUNT - void fts_object_refer(fts_object_t *obj) { obj->refcnt++; @@ -122,9 +121,33 @@ if(fts_object_get_class_name(obj) != NULL) post("fts_object_refer %p type %s refcount = %d", obj, fts_symbol_name(fts_object_get_class_name(obj)), obj->refcnt); } +#endif +#ifdef DEBUG_OBJECT_RELEASE +void fts_object_release_safe (fts_object_t *o, const char *file, int line) +{ +#define CLS(x) fts_object_get_class(x) +#define TYP(x) fts_object_get_class(x)->type_id +#define FMT1 "WARNING: questionable release of object %p class %p with refcount %d at %s:%d\n" +#define FMT2 "WARNING: object %p is of class '%s', type_id %d'\n" + + if (o->refcnt <= 0) + { + fts_log (FMT1, o, CLS(o), o->refcnt, file, line); + fts_post(FMT1, o, CLS(o), o->refcnt, file, line); + if (CLS(o)) + { + fts_log (FMT2, o, fts_symbol_name(fts_object_get_class_name(o)), TYP(o)); + fts_post(FMT2, o, fts_symbol_name(fts_object_get_class_name(o)), TYP(o)); + } + } + + ((--(((fts_object_t *)(o))->refcnt) > 0)? 0: (fts_object_destroy((fts_object_t *)(o)), 0)); +} #endif + + /***************************************************************************** * * elements and properties Modified: trunk/ftm/ftmlib/object.h =================================================================== --- trunk/ftm/ftmlib/object.h 2008-07-29 18:11:21 UTC (rev 1847) +++ trunk/ftm/ftmlib/object.h 2008-07-30 09:40:37 UTC (rev 1848) @@ -30,6 +30,10 @@ #ifndef _FTS_OBJECT_H_ #define _FTS_OBJECT_H_ +#ifdef DEBUG +#define DEBUG_OBJECT_RELEASE 1 +#endif + #define FTS_OBJECT_BITS_STATUS 2 #define FTS_OBJECT_BITS_CLIENT 4 #define FTS_OBJECT_BITS_ID (32 - FTS_OBJECT_BITS_STATUS - FTS_OBJECT_BITS_CLIENT) @@ -167,7 +171,14 @@ #else #define fts_object_refer(o) (((fts_object_t *)(o))->refcnt++) -#define fts_object_release(o) ((--(((fts_object_t *)(o))->refcnt) > 0)? 0: (fts_object_destroy((fts_object_t *)(o)), 0)) + +#ifdef DEBUG_OBJECT_RELEASE +void fts_object_release_safe (fts_object_t *o, const char *file, int line); +# define fts_object_release(o) fts_object_release_safe((fts_object_t *) (o), __FILE__, __LINE__) +#else +# define fts_object_release(o) ((--(((fts_object_t *)(o))->refcnt) > 0)? 0: (fts_object_destroy((fts_object_t *)(o)), 0)) +#endif + #define fts_object_has_only_one_reference(o) (((fts_object_t *)(o))->refcnt == 1) #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-29 18:11:12
|
Revision: 1847 http://ftm.svn.sourceforge.net/ftm/?rev=1847&view=rev Author: diemo Date: 2008-07-29 18:11:21 +0000 (Tue, 29 Jul 2008) Log Message: ----------- actually pass sigma for weighting Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-07-29 15:41:56 UTC (rev 1846) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-07-29 18:11:21 UTC (rev 1847) @@ -247,22 +247,11 @@ if (self->data) fts_object_release((fts_object_t *) self->data); - if (self->sigma) - fts_object_release((fts_object_t *) self->sigma); self->data = data; - - if (sigma) - self->sigma = sigma; - else - { - self->sigma = fmat_create(1, fmat_get_n(data)); - fmat_set_const(self->sigma, 1); - } - fts_object_refer((fts_object_t *) self->data); - fts_object_refer((fts_object_t *) self->sigma); + kdtree_set_sigma(self, sigma); kdtree_init_data(self, height, fmat_get_m(data), fmat_get_n(data)); /* kdtree_clear and rebuild: */ @@ -271,7 +260,26 @@ } +void kdtree_set_sigma (kdtree_t *self, fmat_t *sigma) +{ + if (self->sigma) + fts_object_release((fts_object_t *) self->sigma); + + if (sigma) + self->sigma = sigma; + else + { + self->sigma = fmat_create(1, fmat_get_n(self->data)); + fmat_set_const(self->sigma, 1); + } + fts_object_refer((fts_object_t *) self->sigma); + + self->sigma_indnz = fts_realloc(self->sigma_indnz, + fmat_get_n(self->sigma) * sizeof(*self->sigma)); +} + + /****************************************************************************** * * user methods @@ -468,6 +476,9 @@ self->nodes = NULL; self->data = fmat_create(0, 0); /* always an fmat here */ self->sigma = fmat_create(0, 0); /* always an fmat here */ + self->sigma_nnz = 0; + self->sigma_indnz = NULL; + fts_object_refer((fts_object_t *) self->data); fts_object_refer((fts_object_t *) self->sigma); @@ -508,6 +519,7 @@ /* free structure */ if (self->dataindex) fts_free(self->dataindex); if (self->nodes) fts_free(self->nodes); + if(self->sigma_indnz != NULL) fts_free(self->sigma_indnz); #if DEBUG self->data = NULL; Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-07-29 15:41:56 UTC (rev 1846) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-07-29 18:11:21 UTC (rev 1847) @@ -91,6 +91,8 @@ int *dataindex; /* data vector indirection array (ndata) */ fmat_t *sigma; /* weight, 0 == inf */ + int sigma_nnz; /* number of non-zero sigma */ + int *sigma_indnz; /* non-zero sigma lines */ int height; /* Height of the kdtree */ int maxheight; /* Maximal height of the kdtree */ @@ -137,6 +139,7 @@ void kdtree_set_decomposition(kdtree_t *t, kdtree_dmode_t mode, void *param); void kdtree_set (kdtree_t *self, fmat_t *data, fmat_t *sigma); +void kdtree_set_sigma (kdtree_t *self, fmat_t *sigma); void kdtree_build (kdtree_t* t); void kdtree_init_data (kdtree_t* t, int h, int vect_num, int dim); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-07-29 15:41:46
|
Revision: 1846 http://ftm.svn.sourceforge.net/ftm/?rev=1846&view=rev Author: borghesi Date: 2008-07-29 15:41:56 +0000 (Tue, 29 Jul 2008) Log Message: ----------- ftm.editor: added lock on object_changed Modified Paths: -------------- trunk/ftm/externals/max/ftm.editor.cpp Modified: trunk/ftm/externals/max/ftm.editor.cpp =================================================================== --- trunk/ftm/externals/max/ftm.editor.cpp 2008-07-29 14:34:53 UTC (rev 1845) +++ trunk/ftm/externals/max/ftm.editor.cpp 2008-07-29 15:41:56 UTC (rev 1846) @@ -541,7 +541,7 @@ { if(editorContainer != NULL) { - //const JUCE_NAMESPACE::MessageManagerLock mmLock; + const JUCE_NAMESPACE::MessageManagerLock mmLock; editorContainer->objectChanged((void *)o); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-29 14:34:49
|
Revision: 1845 http://ftm.svn.sourceforge.net/ftm/?rev=1845&view=rev Author: diemo Date: 2008-07-29 14:34:53 +0000 (Tue, 29 Jul 2008) Log Message: ----------- fixed MEGA-bug, phew! preliminary introduction of weighting renamed one-letter variables to something longer Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c trunk/ftm/ftmlib/classes/kdtreesearch.c Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-07-29 11:18:10 UTC (rev 1844) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-07-29 14:34:53 UTC (rev 1845) @@ -232,7 +232,7 @@ } -void kdtree_set (kdtree_t *self, fmat_t *data) +void kdtree_set (kdtree_t *self, fmat_t *data, fmat_t *sigma) { int maxheight = floor(log2(fmat_get_m(data))); int givenheight = self->givenheight; @@ -247,10 +247,21 @@ if (self->data) fts_object_release((fts_object_t *) self->data); + if (self->sigma) + fts_object_release((fts_object_t *) self->sigma); - /* method only declared for fmat, so no check needed */ - self->data = data; + self->data = data; + + if (sigma) + self->sigma = sigma; + else + { + self->sigma = fmat_create(1, fmat_get_n(data)); + fmat_set_const(self->sigma, 1); + } + fts_object_refer((fts_object_t *) self->data); + fts_object_refer((fts_object_t *) self->sigma); kdtree_init_data(self, height, fmat_get_m(data), fmat_get_n(data)); @@ -274,7 +285,7 @@ kdtree_t *self = (kdtree_t *) o; fmat_t *data = (fmat_t *) fts_get_object(at); - kdtree_set(self, data); + kdtree_set(self, data, self->sigma); fts_set_object(ret, o); return fts_ok; @@ -456,7 +467,9 @@ self->dataindex = NULL; self->nodes = NULL; self->data = fmat_create(0, 0); /* always an fmat here */ + self->sigma = fmat_create(0, 0); /* always an fmat here */ fts_object_refer((fts_object_t *) self->data); + fts_object_refer((fts_object_t *) self->sigma); #if PROFILE_BUILD profile_clear(self); Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-07-29 11:18:10 UTC (rev 1844) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-07-29 14:34:53 UTC (rev 1845) @@ -90,6 +90,8 @@ int dataalloc; /* allocated size of dataindex */ int *dataindex; /* data vector indirection array (ndata) */ + fmat_t *sigma; /* weight, 0 == inf */ + int height; /* Height of the kdtree */ int maxheight; /* Maximal height of the kdtree */ int givenheight; /* Height given by user, subtract from max if <= 0 */ @@ -134,7 +136,7 @@ void kdtree_set_decomposition(kdtree_t *t, kdtree_dmode_t mode, void *param); -void kdtree_set (kdtree_t *self, fmat_t *data); +void kdtree_set (kdtree_t *self, fmat_t *data, fmat_t *sigma); void kdtree_build (kdtree_t* t); void kdtree_init_data (kdtree_t* t, int h, int vect_num, int dim); Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-29 11:18:10 UTC (rev 1844) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-29 14:34:53 UTC (rev 1845) @@ -270,8 +270,8 @@ return; } - for (l = 0; l < t->height; l++) - { + for (l = 0; l < t->height - 1; l++) + { /* initialise inner nodes */ int nstart = pow2(l) - 1; int nend = pow2(l+1) - 1; #if DEBUG_KDTREEBUILD @@ -305,6 +305,7 @@ } } + assert(2*n+2 < t->nnodes); t->nodes[2*n+1].startind = t->nodes[n].startind; // start index of left child of node n t->nodes[2*n+1].endind = j; // end index of left child of node n t->nodes[2*n+2].startind = i; // start index of right child of node n @@ -325,6 +326,7 @@ /* init nodes */ t->nnodes = pow2(h) - 1; t->nodes = fts_realloc(t->nodes, t->nnodes * sizeof(node_t)); + bzero(t->nodes, t->nnodes * sizeof(node_t)); for (i = 0; i < t->nnodes; i++) { Modified: trunk/ftm/ftmlib/classes/kdtreesearch.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-29 11:18:10 UTC (rev 1844) +++ trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-29 14:34:53 UTC (rev 1845) @@ -83,7 +83,7 @@ return index; } -static float euclidianDistance(float* v1, float* v2, int dim) +static float euclidean_distance (float* v1, float* v2, int dim) { int i; float sum = 0; @@ -97,12 +97,27 @@ return sum; } +static float weighted_euclidean_distance (float* v1, float* v2, float *sigma, int dim) +{ + int i; + float sum = 0; + for (i = 0; i < dim; i++) + if (sigma[i] > 0) + { + float diff = (v2[i] - v1[i]) / sigma[i]; + sum += diff * diff; + } + + return sum; +} + + /* out: y[K] = index of the Kth nearest neighbour (in float for interfacing reasons) d[K] = distance of the Kth nearest neighbour return: actual number of found neighbours */ int kdtree_search_knn (kdtree_t *t, float* x, int k, float r, - /* out */ float *y, float *d) + /* out */ float *indx, float *dist) { int i; // current processed vector float dxx; // dxx = distance between 2 vectors @@ -118,7 +133,7 @@ // Init distances for(i = 0; i < k; i++) { - d[i] = MAX_FLOAT; + dist[i] = MAX_FLOAT; } // Init Search Stack @@ -132,20 +147,25 @@ #endif cur = pop(&t->s); - if (cur.dist < d[kmax] && + if (cur.dist < dist[kmax] && (r == 0 || cur.dist <= r )) // elimination rule { if (cur.node >= (pow2(t->height - 1) - 1)) { // leaf node + float *sigmaptr = fmat_get_ptr(t->sigma); int istart = t->nodes[cur.node].startind; int iend = t->nodes[cur.node].endind; int i; + #if DEBUG_KDTREESEARCH - fts_post("Leaf node p = %d cur.dist %f\n", cur.node, cur.dist); + fts_post("Leaf node p = %d cur.dist %f\n", + cur.node, cur.dist); #endif for (i = istart; i <= iend; i++) { - dxx = euclidianDistance(x, kdtree_get_vector(t, i), t->ndim); + dxx = weighted_euclidean_distance(x, + kdtree_get_vector(t, i), + sigmaptr, t->ndim); #if PROFILE_SEARCH t->profile.v2v++; #endif @@ -154,12 +174,12 @@ vec_post(kdtree_get_vector(t, i), t->ndim, " and x "); vec_post(x, t->ndim, "\n"); #endif - if (dxx < d[kmax]) + if (dxx < dist[kmax]) { /* return original index in data and distance */ if (k == 1) { - y[kmax] = t->dataindex[i]; - d[kmax] = dxx; + indx[kmax] = t->dataindex[i]; + dist[kmax] = dxx; } else if (t->sort) { @@ -167,28 +187,28 @@ if (kmax < k - 1) { /* first move or override */ - d[kmax + 1] = d[kmax]; - y[kmax + 1] = y[kmax]; + dist[kmax + 1] = dist[kmax]; + indx[kmax + 1] = indx[kmax]; kmax++; } /* insert into sorted list of distance */ - while (pos > 0 && dxx < d[pos - 1]) + while (pos > 0 && dxx < dist[pos - 1]) { /* move up */ - d[pos] = d[pos - 1]; - y[pos] = y[pos - 1]; + dist[pos] = dist[pos - 1]; + indx[pos] = indx[pos - 1]; pos--; } - y[pos] = t->dataindex[i]; - d[pos] = dxx; + indx[pos] = t->dataindex[i]; + dist[pos] = dxx; } else { - y[kmax] = t->dataindex[i]; - d[kmax] = dxx; - kmax = maxArr(d, k); + indx[kmax] = t->dataindex[i]; + dist[kmax] = dxx; + kmax = maxArr(dist, k); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-07-29 11:18:01
|
Revision: 1844 http://ftm.svn.sourceforge.net/ftm/?rev=1844&view=rev Author: borghesi Date: 2008-07-29 11:18:10 +0000 (Tue, 29 Jul 2008) Log Message: ----------- ftm.editor: fixed matrix cpp gui Modified Paths: -------------- trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h Modified: trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h =================================================================== --- trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h 2008-07-29 11:10:45 UTC (rev 1843) +++ trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h 2008-07-29 11:18:10 UTC (rev 1844) @@ -166,8 +166,9 @@ virtual int getValue(void *obj, int row, int col, double *double_value, int *int_value, char **string_value) = 0; virtual void setFloat(void *obj, int row, int col, double value) = 0; virtual void setInt(void *obj, int row, int col, int value) = 0; - virtual void setString(void *obj, int row, int col, char *value) = 0; + virtual void setString(void *obj, int row, int col, const char *value) = 0; virtual void getObject(void *obj, int row, int col, void **openObj, imtr_guiInterface **openObjGui, char **description) = 0; + virtual char *getColumnName(void *obj, int col) = 0; }; /** @} Matrix gui interface */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-07-29 11:10:36
|
Revision: 1843 http://ftm.svn.sourceforge.net/ftm/?rev=1843&view=rev Author: borghesi Date: 2008-07-29 11:10:45 +0000 (Tue, 29 Jul 2008) Log Message: ----------- ftm.editor: fixed markers cpp_gui interface Modified Paths: -------------- trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h Modified: trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h =================================================================== --- trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h 2008-07-25 17:55:32 UTC (rev 1842) +++ trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h 2008-07-29 11:10:45 UTC (rev 1843) @@ -111,7 +111,7 @@ virtual void *add(void *obj, double the_time) = 0; virtual void *move(void *obj, void *marker, int index, double the_time) = 0; virtual void remove(void *obj, void *marker, int index) = 0; - virtual void setLabel(void *obj, void *marker, int index, char *label) = 0; + virtual void setLabel(void *obj, void *marker, int index, const char *label) = 0; virtual void setCue(void *obj, void *marker, int index, int cue) = 0; /* used only if isVector() == 0 (list implementation) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-25 17:55:23
|
Revision: 1842 http://ftm.svn.sourceforge.net/ftm/?rev=1842&view=rev Author: diemo Date: 2008-07-25 17:55:32 +0000 (Fri, 25 Jul 2008) Log Message: ----------- optimise height = clip(1, maxheight - prune, maxheight) attribute @height < 0 -> pruning index alloc size = data alloc size maxheight, height, ndata, nnodes, modes, etc. -> profiling dict set freed pointer to NULL to help catch darn allocation bug! Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c trunk/ftm/ftmlib/classes/kdtreesearch.c Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-07-25 16:01:37 UTC (rev 1841) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-07-25 17:55:32 UTC (rev 1842) @@ -29,9 +29,10 @@ #include "fts.h" -#define HEIGHT 3 + #define MAX_FLOAT 0x7FFFFFFF + fts_symbol_t kdtree_symbol = 0; fts_class_t *kdtree_class = 0; @@ -85,10 +86,12 @@ #if PROFILE void profile_clear (kdtree_t *t) { - t->profile.v2v = 0; - t->profile.v2n = 0; - t->profile.mean = 0; - t->profile.hyper = 0; + t->profile.v2v = 0; + t->profile.v2n = 0; + t->profile.mean = 0; + t->profile.hyper = 0; + t->profile.searches = 0; + t->profile.neighbours = 0; } #endif @@ -169,13 +172,21 @@ void kdtree_info_display (kdtree_t* t) { - int i, j; + int i; fts_post("\nTree Info:\n"); - fts_post("ndim = %i\n", t->ndim); - fts_post("ndata = %i\n", t->ndata); - fts_post("height = %i\n", t->height); - fts_post("nnodes = %i\n", t->nnodes); + fts_post("ndim = %i\n", t->ndim); + fts_post("ndata = %i\n", t->ndata); + fts_post("nalloc = %i\n", t->dataalloc); + fts_post("height = %i\n", t->height); + fts_post("maxheight = %i\n", t->maxheight); + fts_post("givenheight = %i\n", t->givenheight); + fts_post("nnodes = %i\n", t->nnodes); +} +void kdtree_raw_display (kdtree_t* t) +{ + int i; + if (t->height == 0 || t->ndata == 0) fts_post("Empty Tree\n"); for (i = 0; i < t->ndata; i++) @@ -185,10 +196,9 @@ } } - void kdtree_data_display(kdtree_t* t) { - int l, n, i, j; + int l, n, i; fts_post("\nTree Data:\n"); if (t->height == 0 || t->ndata == 0) fts_post("Empty Tree\n"); @@ -224,6 +234,17 @@ void kdtree_set (kdtree_t *self, fmat_t *data) { + int maxheight = floor(log2(fmat_get_m(data))); + int givenheight = self->givenheight; + int height = givenheight > 0 ? givenheight : maxheight + givenheight; + + /* clip height */ + if (height > maxheight) + height = maxheight; + if (height < 1) + height = 1; /* minimum: just one node, linear search */ + self->maxheight = maxheight; + if (self->data) fts_object_release((fts_object_t *) self->data); @@ -231,8 +252,7 @@ self->data = data; fts_object_refer((fts_object_t *) self->data); - kdtree_init_data(self, floor(log2(fmat_get_m(data))), - fmat_get_m(data), fmat_get_n(data)); + kdtree_init_data(self, height, fmat_get_m(data), fmat_get_n(data)); /* kdtree_clear and rebuild: */ /* kdtree_clear(self);*/ @@ -285,8 +305,8 @@ kdtree_t *self = (kdtree_t *) o; fmat_t *x = NULL; /* search vector */ int k = 1, n; - int *result; - float *d; + float *result; + float *d; if (ac > 0 && fts_is_a(at, fmat_class)) x = (fmat_t *) fts_get_object(at); @@ -383,8 +403,11 @@ "vector to node distances: \t%d\n" "mean vector calculations: \t%d\n", "split plane calculations: \t%d\n", + "searches performed: \t%d\n", + "neighbours found: \t%d\n", t->profile.v2v, t->profile.v2n, - t->profile.mean, t->profile.hyper); + t->profile.mean, t->profile.hyper, + t->profile.searches, t->profile.neighbours); fts_set_object(ret, t); profile_clear(t); } @@ -420,16 +443,19 @@ kdtree_t *self = (kdtree_t *) o; /* Init */ - self->dmode = dmode_orthogonal; - self->mmode = mmode_mean; - self->sort = 1; - self->ndata = 0; - self->height = 0; - self->nnodes = 0; - self->ndim = 0; - self->dataindex = NULL; - self->nodes = NULL; - self->data = fmat_create(0, 0); /* always an fmat here */ + self->dmode = dmode_orthogonal; + self->mmode = mmode_mean; + self->sort = 1; + self->ndata = 0; + self->dataalloc = 0; + self->height = 0; + self->maxheight = 0; + self->givenheight = -1; /* -1 gives less comparisons than -2 */ + self->nnodes = 0; + self->ndim = 0; + self->dataindex = NULL; + self->nodes = NULL; + self->data = fmat_create(0, 0); /* always an fmat here */ fts_object_refer((fts_object_t *) self->data); #if PROFILE_BUILD @@ -457,6 +483,10 @@ { fts_object_release(self->nodes[i].mean); fts_object_release(self->nodes[i].split); +#if DEBUG + self->nodes[i].mean = NULL; + self->nodes[i].split = NULL; +#endif } /* free data */ @@ -466,6 +496,12 @@ if (self->dataindex) fts_free(self->dataindex); if (self->nodes) fts_free(self->nodes); +#if DEBUG + self->data = NULL; + self->dataindex = NULL; + self->nodes = NULL; +#endif + return fts_ok; } Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-07-25 16:01:37 UTC (rev 1841) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-07-25 17:55:32 UTC (rev 1842) @@ -86,21 +86,26 @@ int ndim; /* Dimension of vectors */ int ndata; /* Number of vectors */ + fmat_t *data; /* data matrix (ndata, ndim) */ + int dataalloc; /* allocated size of dataindex */ + int *dataindex; /* data vector indirection array (ndata) */ + int height; /* Height of the kdtree */ + int maxheight; /* Maximal height of the kdtree */ + int givenheight; /* Height given by user, subtract from max if <= 0 */ int nnodes; /* Number of nodes (must be a power of 2) */ - - fmat_t *data; /* data matrix (ndata, ndim) */ - int *dataindex; /* data vector indirection array (ndata) */ node_t *nodes; /* nodes (nnodes) */ int sort; /* sort search result by distance */ stack s; struct { - int v2v; - int v2n; - int mean; - int hyper; + int v2v; /* vector to vector distances */ + int v2n; /* vector to node distances */ + int mean; /* mean vector calculations */ + int hyper; /* split plane calculations */ + int searches; /* searches performed */ + int neighbours; /* neighbours found */ } profile; } kdtree_t; @@ -120,6 +125,7 @@ int pow2(int x); void vec_post (float *v, int n, const char *suffix); void kdtree_info_display (kdtree_t* t); +void kdtree_raw_display (kdtree_t* t); void kdtree_data_display (kdtree_t* t); void profile_clear (kdtree_t *t); Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-25 16:01:37 UTC (rev 1841) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-25 17:55:32 UTC (rev 1842) @@ -4,7 +4,7 @@ #include <math.h> -#define DEBUG_KDTREEBUILD 1 +#define DEBUG_KDTREEBUILD 0 static void compute_mean (kdtree_t *t, int node, int dim) @@ -260,12 +260,12 @@ int i, j; // loop counters /* Maximum length is equal to pow2(height-1) */ - if (pow2(t->height-1) > t->ndata) + if (pow2(t->height - 1) > t->ndata) { if (t->ndata == 0) fts_post("tree is empty! \n"); else - fts_post("error: can't build this tree, try with a smaller height: %i > %i\n", pow2(t->height-1), t->ndata); + fts_post("error: can't build this tree, try with a smaller height: %d > %d\n", pow2(t->height-1), t->ndata); return; } @@ -342,7 +342,8 @@ } /* init index list */ - t->dataindex = fts_realloc(t->dataindex, t->ndata * sizeof(int)); + t->dataalloc = t->data->alloc / dim; /* index alloc size = data alloc rows */ + t->dataindex = fts_realloc(t->dataindex, t->dataalloc * sizeof(int)); for (i = 0; i < t->ndata; i++) t->dataindex[i] = i; Modified: trunk/ftm/ftmlib/classes/kdtreesearch.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-25 16:01:37 UTC (rev 1841) +++ trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-25 17:55:32 UTC (rev 1842) @@ -127,7 +127,9 @@ while (!isEmpty(t->s)) { +#if DEBUG_KDTREESEARCH displayStack(t->s); +#endif cur = pop(&t->s); if (cur.dist < d[kmax] && @@ -138,7 +140,7 @@ int istart = t->nodes[cur.node].startind; int iend = t->nodes[cur.node].endind; int i; -#ifdef DEBUG_KDTREESEARCH +#if DEBUG_KDTREESEARCH fts_post("Leaf node p = %d cur.dist %f\n", cur.node, cur.dist); #endif for (i = istart; i <= iend; i++) @@ -147,7 +149,7 @@ #if PROFILE_SEARCH t->profile.v2v++; #endif -#ifdef DEBUG_KDTREESEARCH +#if DEBUG_KDTREESEARCH fts_post("distance = %f between vector %d ", dxx, i); vec_post(kdtree_get_vector(t, i), t->ndim, " and x "); vec_post(x, t->ndim, "\n"); @@ -194,7 +196,7 @@ else { // branched node float d = distV2N(t, x, cur.node); -#ifdef DEBUG_KDTREESEARCH +#if DEBUG_KDTREESEARCH fts_post("Inner node %d d %f cur.dist %f\n", cur.node, d, cur.dist); #endif @@ -220,5 +222,9 @@ } /* else: node can be eliminated from search */ } +#if PROFILE_SEARCH + t->profile.searches++; + t->profile.neighbours += kmax + 1; +#endif return kmax + 1; /* return actual number of found neighbours */ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-07-25 16:01:30
|
Revision: 1841 http://ftm.svn.sourceforge.net/ftm/?rev=1841&view=rev Author: borghesi Date: 2008-07-25 16:01:37 +0000 (Fri, 25 Jul 2008) Log Message: ----------- ftm.editor: added matrix gui interface to bpf class Modified Paths: -------------- trunk/ftm/ftmlib/classes/bpf.c trunk/ftm/ftmlib/classes/dict.c trunk/ftm/ftmlib/classes/fmat.c trunk/ftm/ftmlib/classes/mat.c trunk/ftm/ftmlib/classes/track.c trunk/ftm/ftmlib/predefsymbols.h trunk/ftm/gui/Juce/c_gui/guiinterfaces.h trunk/ftm/gui/Juce/common/MatrixEditor.cpp Modified: trunk/ftm/ftmlib/classes/bpf.c =================================================================== --- trunk/ftm/ftmlib/classes/bpf.c 2008-07-25 10:57:52 UTC (rev 1840) +++ trunk/ftm/ftmlib/classes/bpf.c 2008-07-25 16:01:37 UTC (rev 1841) @@ -35,6 +35,7 @@ static fts_symbol_t sym_removePoints = 0; static fts_symbol_t sym_setPoints = 0; static imtr_guiInterfaceBpf *bpf_gui_interface_bpf = NULL; +static imtr_guiInterfaceMatrix *bpf_gui_interface_matrix = NULL; /************************************************************ * @@ -1093,7 +1094,71 @@ *value = 0.0f; return NULL; } + /************************************************************ + * + * Matrix Gui Interface + * + */ + +static int +bpf_gui_matrix_is_float() +{ + return 1; +} +static int +bpf_gui_matrix_get_rows(void *obj) +{ + return bpf_get_size((bpf_t *)obj); +} +static int +bpf_gui_matrix_get_cols(void *obj) +{ + return 2; +} +static int +bpf_gui_matrix_get_value(void *obj, int row, int col, double *float_val, int *int_val, char **string_val) +{ + bpf_t *self = (bpf_t *) obj; + if(col == 0) + *float_val = bpf_get_time(self, row); + else + *float_val = bpf_get_value(self, row); + *int_val = 0; + *string_val = 0; + + return 0; +} +static void +bpf_gui_matrix_set_float(void *obj, int row, int col, double value) +{ + bpf_t *self = (bpf_t *) obj; + if(col == 0) + bpf_set_point(self, row, value, bpf_get_value(self, row)); + else + bpf_set_point(self, row, bpf_get_time(self, row), value); +} +static void +bpf_gui_matrix_set_int(void *obj, int row, int col, int value){} +static void +bpf_gui_matrix_set_string(void *obj, int row, int col, const char *value){} +static void +bpf_gui_matrix_get_object(void *obj, int row, int col, void **openObj, imtr_guiInterface **openObjGui, char **description) +{ + *openObj = NULL; + *openObjGui = NULL; + *description = 0; +} +static char * +bpf_gui_matrix_get_column_name(void *obj, int col) +{ + if(col == 0) + return fts_symbol_name(fts_s_time); + else + return fts_symbol_name(fts_s_value); +} + +/************************************************************ * * class * @@ -1199,6 +1264,20 @@ bpf_gui_interface_bpf->getNextPoint = bpf_gui_bpf_get_next_point; fts_class_gui_interface(cl, fts_s_bpf, bpf_gui_interface_bpf); + + bpf_gui_interface_matrix = (imtr_guiInterfaceMatrix *)fts_malloc(sizeof(imtr_guiInterfaceMatrix)); + ((imtr_guiInterface *)bpf_gui_interface_matrix)->name = fts_symbol_name(fts_s_matrix); + bpf_gui_interface_matrix->isFloat = bpf_gui_matrix_is_float; + bpf_gui_interface_matrix->getRows = bpf_gui_matrix_get_rows; + bpf_gui_interface_matrix->getCols = bpf_gui_matrix_get_cols; + bpf_gui_interface_matrix->getValue = bpf_gui_matrix_get_value; + bpf_gui_interface_matrix->setFloat = bpf_gui_matrix_set_float; + bpf_gui_interface_matrix->setInt = bpf_gui_matrix_set_int; + bpf_gui_interface_matrix->setString = bpf_gui_matrix_set_string; + bpf_gui_interface_matrix->getObject = bpf_gui_matrix_get_object; + bpf_gui_interface_matrix->getColumnName = bpf_gui_matrix_get_column_name; + + fts_class_gui_interface(cl, fts_s_matrix, bpf_gui_interface_matrix); } FTS_MODULE_INIT(bpf) Modified: trunk/ftm/ftmlib/classes/dict.c =================================================================== --- trunk/ftm/ftmlib/classes/dict.c 2008-07-25 10:57:52 UTC (rev 1840) +++ trunk/ftm/ftmlib/classes/dict.c 2008-07-25 16:01:37 UTC (rev 1841) @@ -967,6 +967,14 @@ strcpy(*description, buff); } } +static char * +dict_gui_matrix_get_column_name(void *obj, int col) +{ + if(col == 0) + return fts_symbol_name(fts_s_key); + else + return fts_symbol_name(fts_s_value); +} /********************************************************** * @@ -1059,6 +1067,7 @@ dict_gui_interface_matrix->setInt = dict_gui_matrix_set_int; dict_gui_interface_matrix->setString = dict_gui_matrix_set_string; dict_gui_interface_matrix->getObject = dict_gui_matrix_get_object; + dict_gui_interface_matrix->getColumnName = dict_gui_matrix_get_column_name; fts_class_gui_interface(cl, fts_s_matrix, dict_gui_interface_matrix); } Modified: trunk/ftm/ftmlib/classes/fmat.c =================================================================== --- trunk/ftm/ftmlib/classes/fmat.c 2008-07-25 10:57:52 UTC (rev 1840) +++ trunk/ftm/ftmlib/classes/fmat.c 2008-07-25 16:01:37 UTC (rev 1841) @@ -5256,6 +5256,11 @@ *openObjGui = NULL; *description = 0; } +static char * +fmat_gui_matrix_get_column_name(void *obj, int col) +{ + return 0; +} /********************************************************* * @@ -5568,6 +5573,8 @@ fmat_gui_interface_matrix->setFloat = fmat_gui_matrix_set_float; fmat_gui_interface_matrix->setInt =fmat_gui_matrix_set_int; fmat_gui_interface_matrix->setString = fmat_gui_matrix_set_string; + fmat_gui_interface_matrix->getObject = fmat_gui_matrix_get_object; + fmat_gui_interface_matrix->getColumnName = fmat_gui_matrix_get_column_name; fts_class_gui_interface(cl, fts_s_matrix, fmat_gui_interface_matrix); } Modified: trunk/ftm/ftmlib/classes/mat.c =================================================================== --- trunk/ftm/ftmlib/classes/mat.c 2008-07-25 10:57:52 UTC (rev 1840) +++ trunk/ftm/ftmlib/classes/mat.c 2008-07-25 16:01:37 UTC (rev 1841) @@ -2408,7 +2408,6 @@ char buff[256]; fts_object_t *o = fts_get_object(val); int obj_id = fts_object_get_id(o); - *openObj = fts_get_object(val); *openObj = (void *)o; name = fts_object_get_class_name(o); @@ -2430,6 +2429,13 @@ strcpy(*description, buff); } } + +static char * +mat_gui_matrix_get_column_name(void *obj, int col) +{ + return 0; +} + /******************************************************************** * * class @@ -2650,6 +2656,7 @@ mat_gui_interface_matrix->setInt = mat_gui_matrix_set_int; mat_gui_interface_matrix->setString = mat_gui_matrix_set_string; mat_gui_interface_matrix->getObject = mat_gui_matrix_get_object; + mat_gui_interface_matrix->getColumnName = mat_gui_matrix_get_column_name; fts_class_gui_interface(cl, fts_s_matrix, mat_gui_interface_matrix); } Modified: trunk/ftm/ftmlib/classes/track.c =================================================================== --- trunk/ftm/ftmlib/classes/track.c 2008-07-25 10:57:52 UTC (rev 1840) +++ trunk/ftm/ftmlib/classes/track.c 2008-07-25 16:01:37 UTC (rev 1841) @@ -1952,9 +1952,7 @@ { event_t *evt = sequence_get_first(track_get_events((track_t *)obj)); if(evt != NULL) - { - fts_atom_t ret; - + { /*time*/ *time = event_get_time(evt); @@ -1980,9 +1978,7 @@ { event_t *event = event_get_next((event_t *)evt); if(event != NULL) - { - fts_atom_t ret; - + { /*time*/ *time = event_get_time(event); @@ -2007,9 +2003,7 @@ { event_t *evt = sequence_get_event_by_index( track_get_events((track_t *)obj), the_index); if(evt != NULL) - { - fts_atom_t ret; - + { /*time*/ *time = event_get_time(evt); Modified: trunk/ftm/ftmlib/predefsymbols.h =================================================================== --- trunk/ftm/ftmlib/predefsymbols.h 2008-07-25 10:57:52 UTC (rev 1840) +++ trunk/ftm/ftmlib/predefsymbols.h 2008-07-25 16:01:37 UTC (rev 1841) @@ -187,6 +187,7 @@ PREDEF_SYMBOL( fts_s_getprop, "getprop") PREDEF_SYMBOL( fts_s_setprop, "setprop") PREDEF_SYMBOL( fts_s_value, "value") +PREDEF_SYMBOL( fts_s_key, "key") PREDEF_SYMBOL( fts_s_orientation, "orientation") PREDEF_SYMBOL( fts_s_max_value, "maxValue") PREDEF_SYMBOL( fts_s_min_value, "minValue") Modified: trunk/ftm/gui/Juce/c_gui/guiinterfaces.h =================================================================== --- trunk/ftm/gui/Juce/c_gui/guiinterfaces.h 2008-07-25 10:57:52 UTC (rev 1840) +++ trunk/ftm/gui/Juce/c_gui/guiinterfaces.h 2008-07-25 16:01:37 UTC (rev 1841) @@ -698,6 +698,15 @@ typedef void (*imtr_gui_interface_matrix_get_object_t)(void *obj, int row, int col, void **openObj, imtr_guiInterface **openObjGui, char **description); /** + * @brief get name of given column + * @param obj the matrix object + * @param col the col + * @return the column name + * @ingroup guiinterfaces + */ +typedef char *(*imtr_gui_interface_matrix_get_column_name_t)(void *obj, int col); + +/** * @brief score gui interface * @ingroup guiinterfaces */ @@ -713,6 +722,7 @@ imtr_gui_interface_matrix_set_int_t setInt; imtr_gui_interface_matrix_set_string_t setString; imtr_gui_interface_matrix_get_object_t getObject; + imtr_gui_interface_matrix_get_column_name_t getColumnName; } imtr_guiInterfaceMatrix; /** @} Score gui interface */ Modified: trunk/ftm/gui/Juce/common/MatrixEditor.cpp =================================================================== --- trunk/ftm/gui/Juce/common/MatrixEditor.cpp 2008-07-25 10:57:52 UTC (rev 1840) +++ trunk/ftm/gui/Juce/common/MatrixEditor.cpp 2008-07-25 16:01:37 UTC (rev 1841) @@ -132,13 +132,18 @@ void initColumns() { + char *name; + JUCE_EDITOR_NAMESPACE::String colname; table->getHeader()->removeAllColumns(); // Add some columns to the table header, based on the column list in our database.. int flags = (JUCE_EDITOR_NAMESPACE::TableHeaderComponent::visible | JUCE_EDITOR_NAMESPACE::TableHeaderComponent::resizable); for(int i=0; i < matrixGui->getCols(obj); i++) - table->getHeader()->addColumn(JUCE_EDITOR_NAMESPACE::String(i), i, 200, 50, 400, flags); - + { + name = matrixGui->getColumnName(obj, i); + colname = (name != 0) ? JUCE_EDITOR_NAMESPACE::String(name) : JUCE_EDITOR_NAMESPACE::String(i); + table->getHeader()->addColumn(colname, i, 200, 50, 400, flags); + } // we could now change some initial settings.. table->getHeader()->setSortColumnId (1, true); // sort forwards by the ID column // un-comment this line to have a go of stretch-to-fit mode This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-07-25 10:57:45
|
Revision: 1840 http://ftm.svn.sourceforge.net/ftm/?rev=1840&view=rev Author: borghesi Date: 2008-07-25 10:57:52 +0000 (Fri, 25 Jul 2008) Log Message: ----------- ftm.editor: added matrix editor in help Modified Paths: -------------- trunk/ftm/patches/max/help/ftm.editor.help Modified: trunk/ftm/patches/max/help/ftm.editor.help =================================================================== --- trunk/ftm/patches/max/help/ftm.editor.help 2008-07-25 10:51:54 UTC (rev 1839) +++ trunk/ftm/patches/max/help/ftm.editor.help 2008-07-25 10:57:52 UTC (rev 1840) @@ -1,6 +1,26 @@ max v2; -#N vpatcher 642 113 1437 1039; +#N vpatcher 658 86 1453 1012; #P origin 0 -7; +#P user ftm.mess 350 370 102 15 3 9 255 255 255 0 0 0 1 2 0 0 0 --> 0; +#T _#ftm version 2 3; +#T _#scope begin; +#T _#absargs $0_ $1_ $2_ $3_ $4_ $5_ $6_ $7_ $8_ $9_; +#T _#line "_set $matrice matrix"; +#P user ftm.object 270 368 32 18 3 9 --> 0; +#T _#obj 1 mat; +#T _#mess 1 size 5 5; +#T _#mess 1 row 0 1 0.2 colognole 0 0; +#T _#obj 2 bpf; +#T _#mess 2 set 0. 0. 195. 0.697674 440. 0.674419 585. 0.44186 810. 0.511628 1060. 0.581395 1190. 0.511628; +#T _#mess 2 editor zoom 0.2; +#T _#mess 1 row 1 0 _#2 0 0 0; +#T _#obj 3 fmat; +#T _#mess 3 size 10 10; +#T _#mess 3 set 0 0 0. 0. 0. 0. 0. 0. 0. 0.23 0. 0. 0. 123. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 14. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 125. 0. 0. 0. 0. 0. 0. 0. 0.; +#T _#mess 1 row 2 0 0 _#3 0 0; +#T _#mess 1 row 3 123 0 maggiorana 0 cotoletta; +#T _#mess 1 row 4 0 0 0 0 0; +#T _#def 1 _mat matrice local; #P window setfont "Sans Serif" 14.; #P window linecount 1; #N vpatcher 1121 305 1275 433; @@ -9,9 +29,6 @@ #P window setfont "Sans Serif" 9.; #P comment 11 12 50 196617 Info panel; #P user ftm.mess 8 69 98 15 3 9 255 255 255 0 0 0 1 2 0 0 0 --> 1; -#T _#ftm version 2 3; -#T _#scope begin; -#T _#absargs $0_ $1_ $2_ $3_ $4_ $5_ $6_ $7_ $8_ $9_; #T _#line "_infopanel visible $1"; #P user panel 5 39 123 53; #X brgb 235 252 211; @@ -39,314 +56,314 @@ #T _#line "_view 0 rangemode used\,"; #T _#line "_infopanel visible 1"; #P user ftm.object 20 340 67 18 3 9 --> 0; -#T _#obj 1 track scoob; -#T _#obj 2 sequence scoob; -#T _#obj 3 scoob note 63. 0. 902.083313 velocity 71. channel 16; -#T _#mess 2 append 0. _#3; -#T _#obj 4 scoob note 73. 0. 73.958336 velocity 109. channel 16; -#T _#mess 2 append 1000. _#4; -#T _#obj 5 scoob note 74. 0. 76.041664 velocity 90. channel 16; -#T _#mess 2 append 1081.770874 _#5; -#T _#obj 6 scoob note 97. 0. 1238.964111 velocity 52. channel 16; -#T _#mess 2 append 1911.291504 _#6; -#T _#obj 7 scoob note 74. 0. 113.020836 velocity 53. channel 16; -#T _#mess 2 append 2250. _#7; -#T _#obj 8 scoob note 71. 0. 113.020836 velocity 56. channel 16; -#T _#mess 2 append 2375. _#8; -#T _#obj 9 scoob note 84. 0. 1060.9375 velocity 107. channel 16; -#T _#mess 2 append 2460.787842 _#9; -#T _#obj 10 scoob note 33.893333 0. 100.; -#T _#mess 2 append 2792.338623 _#10; -#T _#obj 11 scoob note 34.986668 0. 100.; -#T _#mess 2 append 3040.256348 _#11; -#T _#obj 12 scoob note 37.173332 0. 100.; -#T _#mess 2 append 3275.125732 _#12; -#T _#obj 13 scoob note 66. 0. 89.583336 velocity 89. channel 16; -#T _#mess 2 append 3599.479248 _#13; -#T _#obj 14 scoob note 74. 0. 90.104164 velocity 104. channel 16; -#T _#mess 2 append 3698.958252 _#14; -#T _#obj 15 scoob note 67. 0. 90.104164 velocity 56. channel 16; -#T _#mess 2 append 3798.4375 _#15; -#T _#obj 16 scoob note 63. 0. 828.125 velocity 54. channel 16; -#T _#mess 2 append 3898.4375 _#16; -#T _#obj 17 scoob note 68. 0. 73.958336 velocity 96. channel 16; -#T _#mess 2 append 4750. _#17; -#T _#obj 18 scoob note 60. 0. 76.041664 velocity 55. channel 16; -#T _#mess 2 append 4831.770996 _#18; -#T _#obj 19 scoob note 63. 0. 76.5625 velocity 84. channel 16; -#T _#mess 2 append 4915.625 _#19; -#T _#obj 20 scoob note 71. 0. 726.5625 velocity 108. channel 16; -#T _#mess 2 append 5000. _#20; -#T _#obj 21 scoob note 69. 0. 113.020836 velocity 67. channel 16; -#T _#mess 2 append 5750. _#21; -#T _#obj 22 scoob note 63. 0. 113.020836 velocity 53. channel 16; -#T _#mess 2 append 5875. _#22; -#T _#obj 23 scoob note 73. 0. 113.020836 velocity 109. channel 16; -#T _#mess 2 append 6000. _#23; -#T _#obj 24 scoob note 60. 0. 464.583344 velocity 55. channel 16; -#T _#mess 2 append 6125. _#24; -#T _#obj 25 scoob note 69. 0. 89.583336 velocity 107. channel 16; -#T _#mess 2 append 6599.479004 _#25; -#T _#obj 26 scoob note 77. 0. 90.104164 velocity 107. channel 16; -#T _#mess 2 append 6698.958496 _#26; -#T _#obj 27 scoob note 68. 0. 90.104164 velocity 55. channel 16; -#T _#mess 2 append 6798.4375 _#27; -#T _#obj 28 scoob note 57.107887 0. 1003.645813 velocity 53. channel 16; -#T _#mess 2 append 7316.18457 _#28; -#T _#obj 29 scoob note 66. 0. 70.3125 velocity 88. channel 16; -#T _#mess 2 append 8000. _#29; -#T _#obj 30 scoob note 63. 0. 7.8125 velocity 75. channel 16; -#T _#mess 2 append 8062.5 _#30; -#T _#obj 31 scoob note 63. 0. 48.4375 velocity 66. channel 16; -#T _#mess 2 append 8070.3125 _#31; -#T _#obj 32 scoob note 63. 0. 7.8125 velocity 74. channel 16; -#T _#mess 2 append 8125. _#32; -#T _#obj 33 scoob note 63. 0. 56.25 velocity 76. channel 16; -#T _#mess 2 append 8187.5 _#33; -#T _#obj 34 scoob note 63. 0. 56.25 velocity 74. channel 16; -#T _#mess 2 append 8250. _#34; -#T _#obj 35 scoob note 63. 0. 56.25 velocity 76. channel 16; -#T _#mess 2 append 8312.5 _#35; -#T _#obj 36 scoob note 63. 0. 56.25 velocity 75. channel 16; -#T _#mess 2 append 8375. _#36; -#T _#obj 37 scoob note 63. 0. 56.25 velocity 76. channel 16; -#T _#mess 2 append 8437.5 _#37; -#T _#obj 38 scoob note 63. 0. 5.729167 velocity 77. channel 16; -#T _#mess 2 append 8500. _#38; -#T _#obj 39 scoob note 63. 0. 58.333332 velocity 78. channel 16; -#T _#mess 2 append 8505.729492 _#39; -#T _#obj 40 scoob note 73. 0. 66.145836 velocity 104. channel 16; -#T _#mess 2 append 8570.3125 _#40; -#T _#obj 41 scoob note 73. 0. 64.583336 velocity 82. channel 16; -#T _#mess 2 append 8642.1875 _#41; -#T _#obj 42 scoob note 73. 0. 66.666664 velocity 78. channel 16; -#T _#mess 2 append 8712.5 _#42; -#T _#obj 43 scoob note 73. 0. 64.583336 velocity 77. channel 16; -#T _#mess 2 append 8784.895508 _#43; -#T _#obj 44 scoob note 73. 0. 66.666664 velocity 77. channel 16; -#T _#mess 2 append 8855.208008 _#44; -#T _#obj 45 scoob note 73. 0. 66.145836 velocity 76. channel 16; -#T _#mess 2 append 8927.604492 _#45; -#T _#obj 46 scoob note 73. 0. 73.958336 velocity 80. channel 16; -#T _#mess 2 append 9000. _#46; -#T _#obj 47 scoob note 73. 0. 76.041664 velocity 74. channel 16; -#T _#mess 2 append 9081.770508 _#47; -#T _#obj 48 scoob note 63. 0. 64.0625 velocity 55. channel 16; -#T _#mess 2 append 9101.5625 _#48; -#T _#obj 49 scoob note 68. 0. 76.5625 velocity 90. channel 16; -#T _#mess 2 append 9165.625 _#49; -#T _#obj 50 scoob note 68. 0. 73.958336 velocity 78. channel 16; -#T _#mess 2 append 9250. _#50; -#T _#obj 51 scoob note 68. 0. 76.041664 velocity 77. channel 16; -#T _#mess 2 append 9331.770508 _#51; -#T _#obj 52 scoob note 68. 0. 76.5625 velocity 76. channel 16; -#T _#mess 2 append 9415.625 _#52; -#T _#obj 53 scoob note 68. 0. 89.583336 velocity 78. channel 16; -#T _#mess 2 append 9500. _#53; -#T _#obj 54 scoob note 68. 0. 89.583336 velocity 74. channel 16; -#T _#mess 2 append 9599.479492 _#54; -#T _#obj 55 scoob note 63. 0. 60.416668 velocity 55. channel 16; -#T _#mess 2 append 9638.541992 _#55; -#T _#obj 56 scoob note 69. 0. 90.104164 velocity 94. channel 16; -#T _#mess 2 append 9698.958008 _#56; -#T _#obj 57 scoob note 69. 0. 90.104164 velocity 81. channel 16; -#T _#mess 2 append 9798.4375 _#57; -#T _#obj 58 scoob note 69. 0. 91.666664 velocity 78. channel 16; -#T _#mess 2 append 9898.4375 _#58; -#T _#obj 59 scoob note 69. 0. 113.020836 velocity 81. channel 16; -#T _#mess 2 append 10000. _#59; -#T _#obj 60 scoob note 69. 0. 113.020836 velocity 77. channel 16; -#T _#mess 2 append 10125. _#60; -#T _#obj 61 scoob note 69. 0. 113.020836 velocity 75. channel 16; -#T _#mess 2 append 10250. _#61; -#T _#obj 62 scoob note 63. 0. 33.333332 velocity 55. channel 16; -#T _#mess 2 append 10341.666992 _#62; -#T _#obj 63 scoob note 67. 0. 113.020836 velocity 86. channel 16; -#T _#mess 2 append 10375. _#63; -#T _#obj 64 scoob note 67. 0. 150. velocity 82. channel 16; -#T _#mess 2 append 10500. _#64; -#T _#obj 65 scoob note 67. 0. 150.520828 velocity 75. channel 16; -#T _#mess 2 append 10665.625 _#65; -#T _#obj 66 scoob note 67. 0. 152.604172 velocity 75. channel 16; -#T _#mess 2 append 10831.770508 _#66; -#T _#obj 67 scoob note 63. 0. 71.875 velocity 57. channel 16; -#T _#mess 2 append 11000. _#67; -#T _#obj 68 scoob note 66. 0. 154.6875 velocity 88. channel 16; -#T _#mess 2 append 11071.875 _#68; -#T _#obj 69 scoob note 66. 0. 226.5625 velocity 79. channel 16; -#T _#mess 2 append 11250. _#69; -#T _#obj 70 scoob note 66. 0. 150.520828 velocity 70. channel 16; -#T _#mess 2 append 11665.625 _#70; -#T _#obj 71 scoob note 63. 0. 56.25 velocity 72. channel 16; -#T _#mess 2 append 12000. _#71; -#T _#obj 72 scoob note 74. 0. 56.25 velocity 106. channel 16; -#T _#mess 2 append 12062.5 _#72; -#T _#obj 73 scoob note 82. 0. 56.25 velocity 69. channel 16; -#T _#mess 2 append 12625. _#73; -#T _#obj 74 scoob note 70. 0. 56.25 velocity 55. channel 16; -#T _#mess 2 append 12687.5 _#74; -#T _#obj 75 scoob note 63. 0. 113.020836 velocity 54. channel 16; -#T _#mess 2 append 12750. _#75; -#T _#obj 76 scoob note 74. 0. 76.5625 velocity 69. channel 16; -#T _#mess 2 append 13165.625 _#76; -#T _#obj 77 scoob note 63. 0. 73.958336 velocity 54. channel 16; -#T _#mess 2 append 13250. _#77; -#T _#obj 78 scoob note 73. 0. 152.604172 velocity 107. channel 16; -#T _#mess 2 append 13331.770508 _#78; -#T _#obj 79 scoob note 73. 0. 150. velocity 86. channel 16; -#T _#mess 2 append 13500. _#79; -#T _#obj 80 scoob note 73. 0. 150.520828 velocity 76. channel 16; -#T _#mess 2 append 13665.625 _#80; -#T _#obj 81 scoob note 73. 0. 152.604172 velocity 75. channel 16; -#T _#mess 2 append 13831.770508 _#81; -#T _#obj 82 scoob note 63. 0. 56.25 velocity 55. channel 16; -#T _#mess 2 append 14000. _#82; -#T _#obj 83 scoob note 76. 0. 56.25 velocity 106. channel 16; -#T _#mess 2 append 14062.5 _#83; -#T _#obj 84 scoob note 76. 0. 113.020836 velocity 81. channel 16; -#T _#mess 2 append 14125. _#84; -#T _#obj 85 scoob note 76. 0. 113.020836 velocity 76. channel 16; -#T _#mess 2 append 14250. _#85; -#T _#obj 86 scoob note 76. 0. 113.020836 velocity 77. channel 16; -#T _#mess 2 append 14375. _#86; -#T _#obj 87 scoob note 76. 0. 89.583336 velocity 78. channel 16; -#T _#mess 2 append 14500. _#87; -#T _#obj 88 scoob note 76. 0. 44.791668 velocity 75. channel 16; -#T _#mess 2 append 14599.479492 _#88; -#T _#obj 89 scoob note 63. 0. 46.875 velocity 54. channel 16; -#T _#mess 2 append 14648.4375 _#89; -#T _#obj 90 scoob note 77. 0. 90.104164 velocity 104. channel 16; -#T _#mess 2 append 14698.958008 _#90; -#T _#obj 91 scoob note 77. 0. 90.104164 velocity 85. channel 16; -#T _#mess 2 append 14798.4375 _#91; -#T _#obj 92 scoob note 77. 0. 91.666664 velocity 78. channel 16; -#T _#mess 2 append 14898.4375 _#92; -#T _#obj 93 scoob note 77. 0. 73.958336 velocity 79. channel 16; -#T _#mess 2 append 15000. _#93; -#T _#obj 94 scoob note 77. 0. 76.041664 velocity 77. channel 16; -#T _#mess 2 append 15081.770508 _#94; -#T _#obj 95 scoob note 77. 0. 76.5625 velocity 76. channel 16; -#T _#mess 2 append 15165.625 _#95; -#T _#obj 96 scoob note 77. 0. 36.979168 velocity 76. channel 16; -#T _#mess 2 append 15250. _#96; -#T _#obj 97 scoob note 69. 0. 37.5 velocity 52. channel 16; -#T _#mess 2 append 15290.625 _#97; -#T _#obj 98 scoob note 68. 0. 39.0625 velocity 63. channel 16; -#T _#mess 2 append 15331.770508 _#98; -#T _#obj 99 scoob note 63. 0. 36.979168 velocity 52. channel 16; -#T _#mess 2 append 15375. _#99; -#T _#obj 100 scoob note 63. 0. 76.5625 velocity 71. channel 16; -#T _#mess 2 append 15415.625 _#100; -#T _#obj 101 scoob note 63. 0. 56.25 velocity 78. channel 16; -#T _#mess 2 append 15500. _#101; -#T _#obj 102 scoob note 63. 0. 56.25 velocity 75. channel 16; -#T _#mess 2 append 15562.5 _#102; -#T _#obj 103 scoob note 63. 0. 56.25 velocity 75. channel 16; -#T _#mess 2 append 15625. _#103; -#T _#obj 104 scoob note 63. 0. 56.25 velocity 77. channel 16; -#T _#mess 2 append 15687.5 _#104; -#T _#obj 105 scoob note 63. 0. 56.25 velocity 75. channel 16; -#T _#mess 2 append 15750. _#105; -#T _#obj 106 scoob note 63. 0. 56.25 velocity 77. channel 16; -#T _#mess 2 append 15812.5 _#106; -#T _#obj 107 scoob note 63. 0. 56.25 velocity 76. channel 16; -#T _#mess 2 append 15875. _#107; -#T _#obj 108 scoob note 63. 0. 56.25 velocity 77. channel 16; -#T _#mess 2 append 15937.5 _#108; -#T _#obj 109 scoob note 60. 0. 70.3125 velocity 61. channel 16; -#T _#mess 2 append 16000. _#109; -#T _#obj 110 scoob note 63. 0. 1380.729126 velocity 88. channel 16; -#T _#mess 2 append 16070.3125 _#110; -#T _#obj 111 scoob note 73. 0. 89.583336 velocity 107. channel 16; -#T _#mess 2 append 17500. _#111; -#T _#obj 112 scoob note 74. 0. 89.583336 velocity 90. channel 16; -#T _#mess 2 append 17599.478516 _#112; -#T _#obj 113 scoob note 66. 0. 90.104164 velocity 52. channel 16; -#T _#mess 2 append 17698.958984 _#113; -#T _#obj 114 scoob note 71. 0. 90.104164 velocity 90. channel 16; -#T _#mess 2 append 17798.4375 _#114; -#T _#obj 115 scoob note 68. 0. 91.666664 velocity 66. channel 16; -#T _#mess 2 append 17898.4375 _#115; -#T _#obj 116 scoob note 60. 0. 573.958313 velocity 57. channel 16; -#T _#mess 2 append 18000. _#116; -#T _#obj 117 scoob note 69. 0. 76.041664 velocity 107. channel 16; -#T _#mess 2 append 18581.771484 _#117; -#T _#obj 118 scoob note 63. 0. 76.5625 velocity 59. channel 16; -#T _#mess 2 append 18665.625 _#118; -#T _#obj 119 scoob note 73. 0. 73.958336 velocity 108. channel 16; -#T _#mess 2 append 18750. _#119; -#T _#obj 120 scoob note 67. 0. 76.041664 velocity 59. channel 16; -#T _#mess 2 append 18831.771484 _#120; -#T _#obj 121 scoob note 74. 0. 421.875 velocity 100. channel 16; -#T _#mess 2 append 18915.625 _#121; -#T _#obj 122 scoob note 68. 0. 113.020836 velocity 54. channel 16; -#T _#mess 2 append 19375. _#122; -#T _#obj 123 scoob note 63. 0. 113.020836 velocity 58. channel 16; -#T _#mess 2 append 19500. _#123; -#T _#obj 124 scoob note 77. 0. 113.020836 velocity 107. channel 16; -#T _#mess 2 append 19625. _#124; -#T _#obj 125 scoob note 69. 0. 113.020836 velocity 52. channel 16; -#T _#mess 2 append 19750. _#125; -#T _#obj 126 scoob note 82. 0. 113.020836 velocity 106. channel 16; -#T _#mess 2 append 19875. _#126; -#T _#obj 127 scoob note 71. 0. 337.5 velocity 56. channel 16; -#T _#mess 2 append 20000. _#127; -#T _#obj 128 scoob note 69. 0. 113.020836 velocity 59. channel 16; -#T _#mess 2 append 20375. _#128; -#T _#obj 129 scoob note 68. 0. 113.020836 velocity 67. channel 16; -#T _#mess 2 append 20500. _#129; -#T _#obj 130 scoob note 73. 0. 113.020836 velocity 95. channel 16; -#T _#mess 2 append 20625. _#130; -#T _#obj 131 scoob note 66. 0. 113.020836 velocity 54. channel 16; -#T _#mess 2 append 20750. _#131; -#T _#obj 132 scoob note 63. 0. 113.020836 velocity 56. channel 16; -#T _#mess 2 append 20875. _#132; -#T _#obj 133 scoob note 67. 0. 451.041656 velocity 92. channel 16; -#T _#mess 2 append 21000. _#133; -#T _#obj 134 scoob note 76. 0. 89.583336 velocity 110. channel 16; -#T _#mess 2 append 21500. _#134; -#T _#obj 135 scoob note 77. 0. 89.583336 velocity 88. channel 16; -#T _#mess 2 append 21599.478516 _#135; -#T _#obj 136 scoob note 69. 0. 90.104164 velocity 56. channel 16; -#T _#mess 2 append 21698.958984 _#136; -#T _#obj 137 scoob note 63. 0. 90.104164 velocity 56. channel 16; -#T _#mess 2 append 21798.4375 _#137; -#T _#obj 138 scoob note 74. 0. 91.666664 velocity 106. channel 16; -#T _#mess 2 append 21898.4375 _#138; -#T _#obj 139 scoob note 71. 0. 451.041656 velocity 74. channel 16; -#T _#mess 2 append 22000. _#139; -#T _#obj 140 scoob note 73. 0. 73.958336 velocity 85. channel 16; -#T _#mess 2 append 22500. _#140; -#T _#obj 141 scoob note 82. 0. 76.041664 velocity 105. channel 16; -#T _#mess 2 append 22581.771484 _#141; -#T _#obj 142 scoob note 74. 0. 76.5625 velocity 53. channel 16; -#T _#mess 2 append 22665.625 _#142; -#T _#obj 143 scoob note 68. 0. 73.958336 velocity 55. channel 16; -#T _#mess 2 append 22750. _#143; -#T _#obj 144 scoob note 76. 0. 76.041664 velocity 99. channel 16; -#T _#mess 2 append 22831.771484 _#144; -#T _#obj 145 scoob note 63. 0. 921.875 velocity 54. channel 16; -#T _#mess 2 append 22915.625 _#145; -#T _#obj 146 scoob note 63. 0. 113.020836 velocity 75. channel 16; -#T _#mess 2 append 23875. _#146; -#T _#mess 1 events _#2; -#T _#obj 147 sequence marker; -#T _#mess 1 markers _#147; -#T _#obj 148 sequence metric; -#T _#obj 149 metric 1 2/4; -#T _#mess 148 append 0. _#149; -#T _#mess 1 metric _#148; -#T _#obj 150 sequence number; -#T _#mess 150 append 0. 120.; -#T _#mess 1 tempo _#150; -#T _#mess 1 save_editor 1; -#T _#mess 1 editor window 752 258 839 517; -#T _#mess 1 editor label ; -#T _#mess 1 editor zoom 0.2; -#T _#mess 1 editor transp 0; -#T _#mess 1 editor view 0; -#T _#mess 1 editor rangemode 0; -#T _#mess 1 editor grid_mode 0; +#T _#obj 4 track scoob; +#T _#obj 5 sequence scoob; +#T _#obj 6 scoob note 63. 0. 902.083313 channel 16 velocity 71.; +#T _#mess 5 append 0. _#6; +#T _#obj 7 scoob note 73. 0. 73.958336 channel 16 velocity 109.; +#T _#mess 5 append 1000. _#7; +#T _#obj 8 scoob note 74. 0. 76.041664 channel 16 velocity 90.; +#T _#mess 5 append 1081.770874 _#8; +#T _#obj 9 scoob note 97. 0. 1238.964111 channel 16 velocity 52.; +#T _#mess 5 append 1911.291504 _#9; +#T _#obj 10 scoob note 74. 0. 113.020836 channel 16 velocity 53.; +#T _#mess 5 append 2250. _#10; +#T _#obj 11 scoob note 71. 0. 113.020836 channel 16 velocity 56.; +#T _#mess 5 append 2375. _#11; +#T _#obj 12 scoob note 84. 0. 1060.9375 channel 16 velocity 107.; +#T _#mess 5 append 2460.787842 _#12; +#T _#obj 13 scoob note 33.893333 0. 100.; +#T _#mess 5 append 2792.338623 _#13; +#T _#obj 14 scoob note 34.986668 0. 100.; +#T _#mess 5 append 3040.256348 _#14; +#T _#obj 15 scoob note 37.173332 0. 100.; +#T _#mess 5 append 3275.125732 _#15; +#T _#obj 16 scoob note 66. 0. 89.583336 channel 16 velocity 89.; +#T _#mess 5 append 3599.479248 _#16; +#T _#obj 17 scoob note 74. 0. 90.104164 channel 16 velocity 104.; +#T _#mess 5 append 3698.958252 _#17; +#T _#obj 18 scoob note 67. 0. 90.104164 channel 16 velocity 56.; +#T _#mess 5 append 3798.4375 _#18; +#T _#obj 19 scoob note 63. 0. 828.125 channel 16 velocity 54.; +#T _#mess 5 append 3898.4375 _#19; +#T _#obj 20 scoob note 68. 0. 73.958336 channel 16 velocity 96.; +#T _#mess 5 append 4750. _#20; +#T _#obj 21 scoob note 60. 0. 76.041664 channel 16 velocity 55.; +#T _#mess 5 append 4831.770996 _#21; +#T _#obj 22 scoob note 63. 0. 76.5625 channel 16 velocity 84.; +#T _#mess 5 append 4915.625 _#22; +#T _#obj 23 scoob note 71. 0. 726.5625 channel 16 velocity 108.; +#T _#mess 5 append 5000. _#23; +#T _#obj 24 scoob note 69. 0. 113.020836 channel 16 velocity 67.; +#T _#mess 5 append 5750. _#24; +#T _#obj 25 scoob note 63. 0. 113.020836 channel 16 velocity 53.; +#T _#mess 5 append 5875. _#25; +#T _#obj 26 scoob note 73. 0. 113.020836 channel 16 velocity 109.; +#T _#mess 5 append 6000. _#26; +#T _#obj 27 scoob note 60. 0. 464.583344 channel 16 velocity 55.; +#T _#mess 5 append 6125. _#27; +#T _#obj 28 scoob note 69. 0. 89.583336 channel 16 velocity 107.; +#T _#mess 5 append 6599.479004 _#28; +#T _#obj 29 scoob note 77. 0. 90.104164 channel 16 velocity 107.; +#T _#mess 5 append 6698.958496 _#29; +#T _#obj 30 scoob note 68. 0. 90.104164 channel 16 velocity 55.; +#T _#mess 5 append 6798.4375 _#30; +#T _#obj 31 scoob note 57.107887 0. 1003.645813 channel 16 velocity 53.; +#T _#mess 5 append 7316.18457 _#31; +#T _#obj 32 scoob note 66. 0. 70.3125 channel 16 velocity 88.; +#T _#mess 5 append 8000. _#32; +#T _#obj 33 scoob note 63. 0. 7.8125 channel 16 velocity 75.; +#T _#mess 5 append 8062.5 _#33; +#T _#obj 34 scoob note 63. 0. 48.4375 channel 16 velocity 66.; +#T _#mess 5 append 8070.3125 _#34; +#T _#obj 35 scoob note 63. 0. 7.8125 channel 16 velocity 74.; +#T _#mess 5 append 8125. _#35; +#T _#obj 36 scoob note 63. 0. 56.25 channel 16 velocity 76.; +#T _#mess 5 append 8187.5 _#36; +#T _#obj 37 scoob note 63. 0. 56.25 channel 16 velocity 74.; +#T _#mess 5 append 8250. _#37; +#T _#obj 38 scoob note 63. 0. 56.25 channel 16 velocity 76.; +#T _#mess 5 append 8312.5 _#38; +#T _#obj 39 scoob note 63. 0. 56.25 channel 16 velocity 75.; +#T _#mess 5 append 8375. _#39; +#T _#obj 40 scoob note 63. 0. 56.25 channel 16 velocity 76.; +#T _#mess 5 append 8437.5 _#40; +#T _#obj 41 scoob note 63. 0. 5.729167 channel 16 velocity 77.; +#T _#mess 5 append 8500. _#41; +#T _#obj 42 scoob note 63. 0. 58.333332 channel 16 velocity 78.; +#T _#mess 5 append 8505.729492 _#42; +#T _#obj 43 scoob note 73. 0. 66.145836 channel 16 velocity 104.; +#T _#mess 5 append 8570.3125 _#43; +#T _#obj 44 scoob note 73. 0. 64.583336 channel 16 velocity 82.; +#T _#mess 5 append 8642.1875 _#44; +#T _#obj 45 scoob note 73. 0. 66.666664 channel 16 velocity 78.; +#T _#mess 5 append 8712.5 _#45; +#T _#obj 46 scoob note 73. 0. 64.583336 channel 16 velocity 77.; +#T _#mess 5 append 8784.895508 _#46; +#T _#obj 47 scoob note 73. 0. 66.666664 channel 16 velocity 77.; +#T _#mess 5 append 8855.208008 _#47; +#T _#obj 48 scoob note 73. 0. 66.145836 channel 16 velocity 76.; +#T _#mess 5 append 8927.604492 _#48; +#T _#obj 49 scoob note 73. 0. 73.958336 channel 16 velocity 80.; +#T _#mess 5 append 9000. _#49; +#T _#obj 50 scoob note 73. 0. 76.041664 channel 16 velocity 74.; +#T _#mess 5 append 9081.770508 _#50; +#T _#obj 51 scoob note 63. 0. 64.0625 channel 16 velocity 55.; +#T _#mess 5 append 9101.5625 _#51; +#T _#obj 52 scoob note 68. 0. 76.5625 channel 16 velocity 90.; +#T _#mess 5 append 9165.625 _#52; +#T _#obj 53 scoob note 68. 0. 73.958336 channel 16 velocity 78.; +#T _#mess 5 append 9250. _#53; +#T _#obj 54 scoob note 68. 0. 76.041664 channel 16 velocity 77.; +#T _#mess 5 append 9331.770508 _#54; +#T _#obj 55 scoob note 68. 0. 76.5625 channel 16 velocity 76.; +#T _#mess 5 append 9415.625 _#55; +#T _#obj 56 scoob note 68. 0. 89.583336 channel 16 velocity 78.; +#T _#mess 5 append 9500. _#56; +#T _#obj 57 scoob note 68. 0. 89.583336 channel 16 velocity 74.; +#T _#mess 5 append 9599.479492 _#57; +#T _#obj 58 scoob note 63. 0. 60.416668 channel 16 velocity 55.; +#T _#mess 5 append 9638.541992 _#58; +#T _#obj 59 scoob note 69. 0. 90.104164 channel 16 velocity 94.; +#T _#mess 5 append 9698.958008 _#59; +#T _#obj 60 scoob note 69. 0. 90.104164 channel 16 velocity 81.; +#T _#mess 5 append 9798.4375 _#60; +#T _#obj 61 scoob note 69. 0. 91.666664 channel 16 velocity 78.; +#T _#mess 5 append 9898.4375 _#61; +#T _#obj 62 scoob note 69. 0. 113.020836 channel 16 velocity 81.; +#T _#mess 5 append 10000. _#62; +#T _#obj 63 scoob note 69. 0. 113.020836 channel 16 velocity 77.; +#T _#mess 5 append 10125. _#63; +#T _#obj 64 scoob note 69. 0. 113.020836 channel 16 velocity 75.; +#T _#mess 5 append 10250. _#64; +#T _#obj 65 scoob note 63. 0. 33.333332 channel 16 velocity 55.; +#T _#mess 5 append 10341.666992 _#65; +#T _#obj 66 scoob note 67. 0. 113.020836 channel 16 velocity 86.; +#T _#mess 5 append 10375. _#66; +#T _#obj 67 scoob note 67. 0. 150. channel 16 velocity 82.; +#T _#mess 5 append 10500. _#67; +#T _#obj 68 scoob note 67. 0. 150.520828 channel 16 velocity 75.; +#T _#mess 5 append 10665.625 _#68; +#T _#obj 69 scoob note 67. 0. 152.604172 channel 16 velocity 75.; +#T _#mess 5 append 10831.770508 _#69; +#T _#obj 70 scoob note 63. 0. 71.875 channel 16 velocity 57.; +#T _#mess 5 append 11000. _#70; +#T _#obj 71 scoob note 66. 0. 154.6875 channel 16 velocity 88.; +#T _#mess 5 append 11071.875 _#71; +#T _#obj 72 scoob note 66. 0. 226.5625 channel 16 velocity 79.; +#T _#mess 5 append 11250. _#72; +#T _#obj 73 scoob note 66. 0. 150.520828 channel 16 velocity 70.; +#T _#mess 5 append 11665.625 _#73; +#T _#obj 74 scoob note 63. 0. 56.25 channel 16 velocity 72.; +#T _#mess 5 append 12000. _#74; +#T _#obj 75 scoob note 74. 0. 56.25 channel 16 velocity 106.; +#T _#mess 5 append 12062.5 _#75; +#T _#obj 76 scoob note 82. 0. 56.25 channel 16 velocity 69.; +#T _#mess 5 append 12625. _#76; +#T _#obj 77 scoob note 70. 0. 56.25 channel 16 velocity 55.; +#T _#mess 5 append 12687.5 _#77; +#T _#obj 78 scoob note 63. 0. 113.020836 channel 16 velocity 54.; +#T _#mess 5 append 12750. _#78; +#T _#obj 79 scoob note 74. 0. 76.5625 channel 16 velocity 69.; +#T _#mess 5 append 13165.625 _#79; +#T _#obj 80 scoob note 63. 0. 73.958336 channel 16 velocity 54.; +#T _#mess 5 append 13250. _#80; +#T _#obj 81 scoob note 73. 0. 152.604172 channel 16 velocity 107.; +#T _#mess 5 append 13331.770508 _#81; +#T _#obj 82 scoob note 73. 0. 150. channel 16 velocity 86.; +#T _#mess 5 append 13500. _#82; +#T _#obj 83 scoob note 73. 0. 150.520828 channel 16 velocity 76.; +#T _#mess 5 append 13665.625 _#83; +#T _#obj 84 scoob note 73. 0. 152.604172 channel 16 velocity 75.; +#T _#mess 5 append 13831.770508 _#84; +#T _#obj 85 scoob note 63. 0. 56.25 channel 16 velocity 55.; +#T _#mess 5 append 14000. _#85; +#T _#obj 86 scoob note 76. 0. 56.25 channel 16 velocity 106.; +#T _#mess 5 append 14062.5 _#86; +#T _#obj 87 scoob note 76. 0. 113.020836 channel 16 velocity 81.; +#T _#mess 5 append 14125. _#87; +#T _#obj 88 scoob note 76. 0. 113.020836 channel 16 velocity 76.; +#T _#mess 5 append 14250. _#88; +#T _#obj 89 scoob note 76. 0. 113.020836 channel 16 velocity 77.; +#T _#mess 5 append 14375. _#89; +#T _#obj 90 scoob note 76. 0. 89.583336 channel 16 velocity 78.; +#T _#mess 5 append 14500. _#90; +#T _#obj 91 scoob note 76. 0. 44.791668 channel 16 velocity 75.; +#T _#mess 5 append 14599.479492 _#91; +#T _#obj 92 scoob note 63. 0. 46.875 channel 16 velocity 54.; +#T _#mess 5 append 14648.4375 _#92; +#T _#obj 93 scoob note 77. 0. 90.104164 channel 16 velocity 104.; +#T _#mess 5 append 14698.958008 _#93; +#T _#obj 94 scoob note 77. 0. 90.104164 channel 16 velocity 85.; +#T _#mess 5 append 14798.4375 _#94; +#T _#obj 95 scoob note 77. 0. 91.666664 channel 16 velocity 78.; +#T _#mess 5 append 14898.4375 _#95; +#T _#obj 96 scoob note 77. 0. 73.958336 channel 16 velocity 79.; +#T _#mess 5 append 15000. _#96; +#T _#obj 97 scoob note 77. 0. 76.041664 channel 16 velocity 77.; +#T _#mess 5 append 15081.770508 _#97; +#T _#obj 98 scoob note 77. 0. 76.5625 channel 16 velocity 76.; +#T _#mess 5 append 15165.625 _#98; +#T _#obj 99 scoob note 77. 0. 36.979168 channel 16 velocity 76.; +#T _#mess 5 append 15250. _#99; +#T _#obj 100 scoob note 69. 0. 37.5 channel 16 velocity 52.; +#T _#mess 5 append 15290.625 _#100; +#T _#obj 101 scoob note 68. 0. 39.0625 channel 16 velocity 63.; +#T _#mess 5 append 15331.770508 _#101; +#T _#obj 102 scoob note 63. 0. 36.979168 channel 16 velocity 52.; +#T _#mess 5 append 15375. _#102; +#T _#obj 103 scoob note 63. 0. 76.5625 channel 16 velocity 71.; +#T _#mess 5 append 15415.625 _#103; +#T _#obj 104 scoob note 63. 0. 56.25 channel 16 velocity 78.; +#T _#mess 5 append 15500. _#104; +#T _#obj 105 scoob note 63. 0. 56.25 channel 16 velocity 75.; +#T _#mess 5 append 15562.5 _#105; +#T _#obj 106 scoob note 63. 0. 56.25 channel 16 velocity 75.; +#T _#mess 5 append 15625. _#106; +#T _#obj 107 scoob note 63. 0. 56.25 channel 16 velocity 77.; +#T _#mess 5 append 15687.5 _#107; +#T _#obj 108 scoob note 63. 0. 56.25 channel 16 velocity 75.; +#T _#mess 5 append 15750. _#108; +#T _#obj 109 scoob note 63. 0. 56.25 channel 16 velocity 77.; +#T _#mess 5 append 15812.5 _#109; +#T _#obj 110 scoob note 63. 0. 56.25 channel 16 velocity 76.; +#T _#mess 5 append 15875. _#110; +#T _#obj 111 scoob note 63. 0. 56.25 channel 16 velocity 77.; +#T _#mess 5 append 15937.5 _#111; +#T _#obj 112 scoob note 60. 0. 70.3125 channel 16 velocity 61.; +#T _#mess 5 append 16000. _#112; +#T _#obj 113 scoob note 63. 0. 1380.729126 channel 16 velocity 88.; +#T _#mess 5 append 16070.3125 _#113; +#T _#obj 114 scoob note 73. 0. 89.583336 channel 16 velocity 107.; +#T _#mess 5 append 17500. _#114; +#T _#obj 115 scoob note 74. 0. 89.583336 channel 16 velocity 90.; +#T _#mess 5 append 17599.478516 _#115; +#T _#obj 116 scoob note 66. 0. 90.104164 channel 16 velocity 52.; +#T _#mess 5 append 17698.958984 _#116; +#T _#obj 117 scoob note 71. 0. 90.104164 channel 16 velocity 90.; +#T _#mess 5 append 17798.4375 _#117; +#T _#obj 118 scoob note 68. 0. 91.666664 channel 16 velocity 66.; +#T _#mess 5 append 17898.4375 _#118; +#T _#obj 119 scoob note 60. 0. 573.958313 channel 16 velocity 57.; +#T _#mess 5 append 18000. _#119; +#T _#obj 120 scoob note 69. 0. 76.041664 channel 16 velocity 107.; +#T _#mess 5 append 18581.771484 _#120; +#T _#obj 121 scoob note 63. 0. 76.5625 channel 16 velocity 59.; +#T _#mess 5 append 18665.625 _#121; +#T _#obj 122 scoob note 73. 0. 73.958336 channel 16 velocity 108.; +#T _#mess 5 append 18750. _#122; +#T _#obj 123 scoob note 67. 0. 76.041664 channel 16 velocity 59.; +#T _#mess 5 append 18831.771484 _#123; +#T _#obj 124 scoob note 74. 0. 421.875 channel 16 velocity 100.; +#T _#mess 5 append 18915.625 _#124; +#T _#obj 125 scoob note 68. 0. 113.020836 channel 16 velocity 54.; +#T _#mess 5 append 19375. _#125; +#T _#obj 126 scoob note 63. 0. 113.020836 channel 16 velocity 58.; +#T _#mess 5 append 19500. _#126; +#T _#obj 127 scoob note 77. 0. 113.020836 channel 16 velocity 107.; +#T _#mess 5 append 19625. _#127; +#T _#obj 128 scoob note 69. 0. 113.020836 channel 16 velocity 52.; +#T _#mess 5 append 19750. _#128; +#T _#obj 129 scoob note 82. 0. 113.020836 channel 16 velocity 106.; +#T _#mess 5 append 19875. _#129; +#T _#obj 130 scoob note 71. 0. 337.5 channel 16 velocity 56.; +#T _#mess 5 append 20000. _#130; +#T _#obj 131 scoob note 69. 0. 113.020836 channel 16 velocity 59.; +#T _#mess 5 append 20375. _#131; +#T _#obj 132 scoob note 68. 0. 113.020836 channel 16 velocity 67.; +#T _#mess 5 append 20500. _#132; +#T _#obj 133 scoob note 73. 0. 113.020836 channel 16 velocity 95.; +#T _#mess 5 append 20625. _#133; +#T _#obj 134 scoob note 66. 0. 113.020836 channel 16 velocity 54.; +#T _#mess 5 append 20750. _#134; +#T _#obj 135 scoob note 63. 0. 113.020836 channel 16 velocity 56.; +#T _#mess 5 append 20875. _#135; +#T _#obj 136 scoob note 67. 0. 451.041656 channel 16 velocity 92.; +#T _#mess 5 append 21000. _#136; +#T _#obj 137 scoob note 76. 0. 89.583336 channel 16 velocity 110.; +#T _#mess 5 append 21500. _#137; +#T _#obj 138 scoob note 77. 0. 89.583336 channel 16 velocity 88.; +#T _#mess 5 append 21599.478516 _#138; +#T _#obj 139 scoob note 69. 0. 90.104164 channel 16 velocity 56.; +#T _#mess 5 append 21698.958984 _#139; +#T _#obj 140 scoob note 63. 0. 90.104164 channel 16 velocity 56.; +#T _#mess 5 append 21798.4375 _#140; +#T _#obj 141 scoob note 74. 0. 91.666664 channel 16 velocity 106.; +#T _#mess 5 append 21898.4375 _#141; +#T _#obj 142 scoob note 71. 0. 451.041656 channel 16 velocity 74.; +#T _#mess 5 append 22000. _#142; +#T _#obj 143 scoob note 73. 0. 73.958336 channel 16 velocity 85.; +#T _#mess 5 append 22500. _#143; +#T _#obj 144 scoob note 82. 0. 76.041664 channel 16 velocity 105.; +#T _#mess 5 append 22581.771484 _#144; +#T _#obj 145 scoob note 74. 0. 76.5625 channel 16 velocity 53.; +#T _#mess 5 append 22665.625 _#145; +#T _#obj 146 scoob note 68. 0. 73.958336 channel 16 velocity 55.; +#T _#mess 5 append 22750. _#146; +#T _#obj 147 scoob note 76. 0. 76.041664 channel 16 velocity 99.; +#T _#mess 5 append 22831.771484 _#147; +#T _#obj 148 scoob note 63. 0. 921.875 channel 16 velocity 54.; +#T _#mess 5 append 22915.625 _#148; +#T _#obj 149 scoob note 63. 0. 113.020836 channel 16 velocity 75.; +#T _#mess 5 append 23875. _#149; +#T _#mess 4 events _#5; +#T _#obj 150 sequence marker; +#T _#mess 4 markers _#150; +#T _#obj 151 sequence metric; +#T _#obj 152 metric 1 2/4; +#T _#mess 151 append 0. _#152; +#T _#mess 4 metric _#151; +#T _#obj 153 sequence number; +#T _#mess 153 append 0. 120.; +#T _#mess 4 tempo _#153; +#T _#mess 4 save_editor 1; +#T _#mess 4 editor window 752 258 839 517; +#T _#mess 4 editor label ; +#T _#mess 4 editor zoom 0.2; +#T _#mess 4 editor transp 0; +#T _#mess 4 editor view 0; +#T _#mess 4 editor rangemode 0; +#T _#mess 4 editor grid_mode 0; #T _#def 1 "_track scoob" t_score local; #P window setfont "Sans Serif" 12.; #P comment 20 320 161 196620 TRACK of scoob as score; @@ -360,13736 +377,13736 @@ @@ Diff output truncated at 100000 characters. @@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-07-25 10:51:45
|
Revision: 1839 http://ftm.svn.sourceforge.net/ftm/?rev=1839&view=rev Author: borghesi Date: 2008-07-25 10:51:54 +0000 (Fri, 25 Jul 2008) Log Message: ----------- ftm.editor: finalized Matrix Editor Modified Paths: -------------- trunk/ftm/gui/Juce/common/MatrixEditor.cpp Modified: trunk/ftm/gui/Juce/common/MatrixEditor.cpp =================================================================== --- trunk/ftm/gui/Juce/common/MatrixEditor.cpp 2008-07-24 18:45:30 UTC (rev 1838) +++ trunk/ftm/gui/Juce/common/MatrixEditor.cpp 2008-07-25 10:51:54 UTC (rev 1839) @@ -69,7 +69,7 @@ bool activateSelectedCell; /*--------- contained editor ------------------*/ - JUCE_EDITOR_NAMESPACE::Component *innerEditor; + ImtrEditor *innerEditor; JUCE_EDITOR_NAMESPACE::Component *innerBar; public: @@ -109,6 +109,7 @@ // give it a border table->setColour (JUCE_EDITOR_NAMESPACE::ListBox::outlineColourId, JUCE_EDITOR_NAMESPACE::Colours::grey); + table->setColour(JUCE_EDITOR_NAMESPACE::ListBox::backgroundColourId, backcolor); table->setOutlineThickness (1); //table->setOpaque(true); @@ -195,6 +196,11 @@ drawInfoBackground(info_g); } + void paint (JUCE_EDITOR_NAMESPACE::Graphics& g) + { + g.fillAll(backcolor); + } + //////////////////////////////////////////////////////////////////////////////////////// int getNumRows() { @@ -206,7 +212,7 @@ { if (rowIsSelected) { - g.fillAll (JUCE_EDITOR_NAMESPACE::Colours::lightblue); + g.fillAll(JUCE_EDITOR_NAMESPACE::Colours::lightblue); if(lastClickedCol != -1) { @@ -215,6 +221,8 @@ g.fillRect(bounds.getX(), bounds.getY(), bounds.getWidth(), height); } } + /*else + g.fillAll (backcolor);*/ } void paintCell (JUCE_EDITOR_NAMESPACE::Graphics& g, @@ -228,7 +236,7 @@ { JUCE_EDITOR_NAMESPACE::String text; MatrixComponent *label = (MatrixComponent*) existingComponentToUpdate; - + if (label == NULL) label = new MatrixComponent(*this, rowNumber, columnId); else @@ -290,7 +298,7 @@ if(innerBar != NULL) innerBar->setBounds(0, 0, bounds.getWidth(), INNER_BAR_SIZE); if(innerEditor != NULL) - innerEditor->setBounds(0, INNER_BAR_SIZE, bounds.getWidth(), bounds.getHeight()-INNER_BAR_SIZE); + (dynamic_cast<JUCE_EDITOR_NAMESPACE::Component *>(innerEditor))->setBounds(0, INNER_BAR_SIZE, bounds.getWidth(), bounds.getHeight()-INNER_BAR_SIZE); } /************************* @@ -314,6 +322,9 @@ void objectRefresh() { //redraw_offscreen = true; + if(innerEditor != NULL) + return innerEditor->objectRefresh(); + container->repaint(); } @@ -322,9 +333,16 @@ if(matrixGui->getCols(obj) != table->getHeader()->getNumColumns(false)) initColumns(); table->updateContent(); + + if(innerEditor != NULL) + return innerEditor->objectChanged(); } - void layoutChanged(){} + void layoutChanged() + { + if(innerEditor != NULL) + return innerEditor->layoutChanged(); + } void setBackgroundColor(JUCE_EDITOR_NAMESPACE::Colour bcolor) { @@ -332,8 +350,13 @@ darkerColor = backcolor.darker(0.2f); selectColor = JUCE_EDITOR_NAMESPACE::Colour::contrasting(backcolor, forecolor); lightColor = backcolor.brighter(0.2f); + + if(table!= NULL) + table->setColour(JUCE_EDITOR_NAMESPACE::ListBox::backgroundColourId, backcolor); + + if(innerEditor != NULL) + innerEditor->setBackgroundColor(bcolor); } - void backgroundColorChanged(JUCE_EDITOR_NAMESPACE::Colour bcolor){ setBackgroundColor(bcolor);} void setForegroundColor(JUCE_EDITOR_NAMESPACE::Colour fcolor) @@ -341,16 +364,27 @@ forecolor = fcolor; selectColor = JUCE_EDITOR_NAMESPACE::Colour::contrasting(backcolor, forecolor); labelColor = forecolor.withAlpha(0.4f); + + if(innerEditor != NULL) + innerEditor->setForegroundColor(fcolor); + + table->updateContent(); } JUCE_EDITOR_NAMESPACE::Colour getForegroundColor() { - return forecolor; + if(innerEditor != NULL) + return innerEditor->getForegroundColor(); + else + return forecolor; } JUCE_EDITOR_NAMESPACE::Colour getBackgroundColor() { - return backcolor; + if(innerEditor != NULL) + return innerEditor->getBackgroundColor(); + else + return backcolor; } void setOpacity(float alpha) @@ -371,9 +405,16 @@ float getOriginalLength() { - return original_length; + if(innerEditor != NULL) + return innerEditor->getOriginalLength(); + else + return original_length; } - void setTool(JUCE_EDITOR_NAMESPACE::MouseListener *tool){} + void setTool(JUCE_EDITOR_NAMESPACE::MouseListener *tool) + { + if(innerEditor != NULL) + return innerEditor->setTool(tool); + } void openPopupMenu(){} void addToLocation(int x, int y, bool isShiftDown){} void commandAltInteraction(int x, int y, bool isShiftDown){} @@ -466,14 +507,15 @@ matrixGui->getObject(obj, row, column, &openObj, &openObjGui, &descr); if(openObj != NULL && openObjGui != NULL) { - innerEditor = container->createEditor(openObj, openObjGui); - (dynamic_cast<ImtrEditor *>(innerEditor))->setDescription(JUCE_EDITOR_NAMESPACE::String(descr)); - addAndMakeVisible(innerEditor); + innerEditor = dynamic_cast<ImtrEditor *>(container->createEditor(openObj, openObjGui)); + innerEditor->setDescription(JUCE_EDITOR_NAMESPACE::String(descr)); + innerEditor->setOpacity(1.0f); + addAndMakeVisible((dynamic_cast<JUCE_EDITOR_NAMESPACE::Component *>(innerEditor))); - //innerBar = new InnerBar(this); - innerBar = createInnerBar(this, (dynamic_cast<ImtrEditor *>(innerEditor))); + innerBar = createInnerBar(this, innerEditor); addAndMakeVisible(innerBar); + container->updateContainer(); resized(); } } @@ -488,11 +530,13 @@ } if(innerEditor != NULL) { - removeChildComponent(innerEditor); + removeChildComponent((dynamic_cast<JUCE_EDITOR_NAMESPACE::Component *>(innerEditor))); delete innerEditor; innerEditor = NULL; } + container->updateContainer(); resized(); + container->repaint(); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -550,6 +594,7 @@ column = c; type = owner.matrixGui->getValue(owner.obj, row, column, &floatVal, &intVal, &stringVal); + label->setColour(JUCE_EDITOR_NAMESPACE::Label::textColourId, owner.forecolor); switch(type) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-24 18:45:23
|
Revision: 1838 http://ftm.svn.sourceforge.net/ftm/?rev=1838&view=rev Author: diemo Date: 2008-07-24 18:45:30 +0000 (Thu, 24 Jul 2008) Log Message: ----------- sort result by distance include radius (?) proper handling of modes Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c trunk/ftm/ftmlib/classes/kdtreesearch.c Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-07-24 17:08:42 UTC (rev 1837) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-07-24 18:45:30 UTC (rev 1838) @@ -231,8 +231,8 @@ self->data = data; fts_object_refer((fts_object_t *) self->data); - kdtree_init(self, floor(log2(fmat_get_m(data))), - fmat_get_m(data), fmat_get_n(data)); + kdtree_init_data(self, floor(log2(fmat_get_m(data))), + fmat_get_m(data), fmat_get_n(data)); /* kdtree_clear and rebuild: */ /* kdtree_clear(self);*/ @@ -297,7 +297,7 @@ result = alloca(k * sizeof(float)); d = alloca(k * sizeof(float)); - n = kdtree_search_knn(self, fmat_get_ptr(x), k, result, d); + n = kdtree_search_knn(self, fmat_get_ptr(x), k, 0, result, d); if (s == fts_s_get) /* geti: nearest index? */ { /* return one fvec */ @@ -420,6 +420,9 @@ kdtree_t *self = (kdtree_t *) o; /* Init */ + self->dmode = dmode_orthogonal; + self->mmode = mmode_mean; + self->sort = 1; self->ndata = 0; self->height = 0; self->nnodes = 0; Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-07-24 17:08:42 UTC (rev 1837) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-07-24 18:45:30 UTC (rev 1838) @@ -83,6 +83,7 @@ kdtree_dmode_t dmode; /* decomposition mode */ kdtree_mmode_t mmode; /* pivot (mean vector to split at) calculation mode */ + int ndim; /* Dimension of vectors */ int ndata; /* Number of vectors */ int height; /* Height of the kdtree */ @@ -92,6 +93,7 @@ int *dataindex; /* data vector indirection array (ndata) */ node_t *nodes; /* nodes (nnodes) */ + int sort; /* sort search result by distance */ stack s; struct { @@ -128,8 +130,8 @@ void kdtree_set (kdtree_t *self, fmat_t *data); void kdtree_build (kdtree_t* t); -void kdtree_init (kdtree_t* t, int h, int vect_num, int dim); +void kdtree_init_data (kdtree_t* t, int h, int vect_num, int dim); -int kdtree_search_knn (kdtree_t *t, float* x, int k, float *y, float *d); +int kdtree_search_knn (kdtree_t *t, float* x, int k, float r, float *y, float *d); #endif Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-24 17:08:42 UTC (rev 1837) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-24 18:45:30 UTC (rev 1838) @@ -4,7 +4,7 @@ #include <math.h> -#define DEBUG_KDTREEBUILD 0 +#define DEBUG_KDTREEBUILD 1 static void compute_mean (kdtree_t *t, int node, int dim) @@ -97,11 +97,47 @@ } -static void compute_pivot (kdtree_t *t, int node) +static int compare(float* currentVect, float* mean, int component) { +// fts_post("compare %f and %f\n", mean[component], currentVect[component]); + return (currentVect[component] - mean[component]); +} + + +/* vector to orthogonal plane node distance along split dimension dim */ +static float distV2orthoH (const float* vect, float* mean, int dim) +{ + return vect[dim] - mean[dim]; +} + +static void compute_splitplane (kdtree_t* t, int node, int level) +{ + node_t *n = &t->nodes[node]; + + #if PROFILE_BUILD + t->profile.hyper++; +#endif + + /* case dmode_orthogonal */ + // compute hyperplane orthogonal to the base vector number b + fmat_set_const(n->split, 0); + fmat_set_element(n->split, n->splitdim, 0, 1); + n->splitnorm = 1; + +#if DEBUG_KDTREEBUILD + fts_post("Splitplane of node %i: ", node); + vec_post(fmat_get_ptr(n->split), t->ndim, "\n"); +#endif +} + + +static void decompose_node (kdtree_t *t, int node, int level) +{ #if PROFILE_BUILD t->profile.mean++; #endif + + t->nodes[node].splitdim = level % t->ndim; switch (t->mmode) { @@ -123,44 +159,15 @@ compute_middle(t, node, -1); /* all dimensions */ break; } -} - -static int compare(float* currentVect, float* mean, int component) -{ -// fts_post("compare %f and %f\n", mean[component], currentVect[component]); - return (currentVect[component] - mean[component]); + compute_splitplane(t, node, level); } -/* swap positions of vectors i and j: only in indirection array */ -static void swap (kdtree_t* t, int i, int j) -{ - int tmp; - tmp = t->dataindex[i]; - t->dataindex[i] = t->dataindex[j]; - t->dataindex[j] = tmp; -} - - -/* vector to orthogonal plane node distance */ -static float distV2orthoH (const float* vect, float* hplane, int vectDim, float norm) -{ -// standard algebra computing - int i; - float dotprod = 0; - - for (i = 0; i < vectDim; i++) - { - dotprod += vect[i] * hplane[i]; - } - return ((dotprod + hplane[vectDim]) / norm); -} - - /* vector to general plane node distance */ -static float distV2H (const float* vect, float* plane, float* mean, int vectDim, float norm) +static float distV2H (const float* vect, float* plane, float* mean, + int vectDim, float norm) { // standard algebra computing int i; @@ -182,17 +189,21 @@ #if PROFILE_BUILD t->profile.v2n++; #endif +#if DEBUG_KDTREEBUILD + if (node > t->nnodes || fmat_get_ptr(n->split) == NULL || + n->splitdim < 0 || n->splitdim > t->ndim) + { + fts_post("error in distV2N!\n"); + return 0; + } +#endif switch (t->dmode) { case dmode_orthogonal: - return distV2orthoH(x, - fmat_get_ptr(n->split), - t->ndim, n->splitnorm); + return distV2orthoH(x, fmat_get_ptr(n->mean), n->splitdim); case dmode_hyperplane: - return distV2H(x, - fmat_get_ptr(n->split), - fmat_get_ptr(n->mean), + return distV2H(x, fmat_get_ptr(n->split), fmat_get_ptr(n->mean), t->ndim, n->splitnorm); default: fts_post("error: unknown mode %d", t->dmode); @@ -201,44 +212,17 @@ } -static void compute_splitplane (kdtree_t* t, int node, int level) +/* swap positions of vectors i and j: only in indirection array */ +static void swap (kdtree_t* t, int i, int j) { - node_t *n = &t->nodes[node]; - int b; - float h; + int tmp; - #if PROFILE_BUILD - t->profile.hyper++; -#endif - - /* case dmode_orthogonal */ - // Level parameter gives the base vector to use - b = level % t->ndim; - h = fmat_get_element(n->mean, b, 0); - - // We compute an hyperplane which is orthogonal to the base vector number b - fmat_set_const(n->split, 0); - - fmat_set_element(n->split, b, 0, 1); - fmat_set_element(n->split, t->ndim, 0, -h); - - n->splitnorm = 1; - n->splitdim = b; - -#if DEBUG_KDTREEBUILD - fts_post("Splitplane of node %i: ", node); - vec_post(n->split, t->ndim + 1, "\n"); -#endif + tmp = t->dataindex[i]; + t->dataindex[i] = t->dataindex[j]; + t->dataindex[j] = tmp; } - - -static void freeVect (kdtree_t* t, int vect_number) -{ - fmat_set_const(t->data, MAX_FLOAT); -} - #if 0 void reBalance(kdtree_t* t) { @@ -295,8 +279,7 @@ #endif for (n = nstart; n < nend; n++) { /* for all nodes at tree level l */ - compute_pivot(t, n); - compute_splitplane(t, n, l); + decompose_node(t, n, l); #if DEBUG_KDTREEBUILD fts_post("Node #%i (%i..%i): mean = ", @@ -331,12 +314,10 @@ } -void kdtree_init (kdtree_t* t, int h, int vect_num, int dim) +void kdtree_init_data (kdtree_t* t, int h, int vect_num, int dim) { int i; - t->dmode = dmode_orthogonal; - t->mmode = mmode_mean; t->ndim = dim; t->ndata = vect_num; t->height = h; @@ -348,7 +329,7 @@ for (i = 0; i < t->nnodes; i++) { t->nodes[i].mean = fmat_create(dim, 1); - t->nodes[i].split = fmat_create(dim + 1, 1); + t->nodes[i].split = fmat_create(dim, 1); fts_object_refer((fts_object_t *) t->nodes[i].mean); fts_object_refer((fts_object_t *) t->nodes[i].split); Modified: trunk/ftm/ftmlib/classes/kdtreesearch.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-24 17:08:42 UTC (rev 1837) +++ trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-24 18:45:30 UTC (rev 1838) @@ -101,11 +101,12 @@ /* out: y[K] = index of the Kth nearest neighbour (in float for interfacing reasons) d[K] = distance of the Kth nearest neighbour return: actual number of found neighbours */ -int kdtree_search_knn (kdtree_t *t, float* x, int k, float *y, float *d) +int kdtree_search_knn (kdtree_t *t, float* x, int k, float r, + /* out */ float *y, float *d) { - int i; // current processed vector - float dxx; // dxx = distance between 2 vectors - int kmax = 0; // index of current Kth neighbour + int i; // current processed vector + float dxx; // dxx = distance between 2 vectors + int kmax = 0; // index of current Kth neighbour couple cur; // current (node, dist) couple if (t->ndata == 0) @@ -129,7 +130,8 @@ displayStack(t->s); cur = pop(&t->s); - if (cur.dist < d[kmax]) // elimination rule + if (cur.dist < d[kmax] && + (r == 0 || cur.dist <= r )) // elimination rule { if (cur.node >= (pow2(t->height - 1) - 1)) { // leaf node @@ -137,7 +139,7 @@ int iend = t->nodes[cur.node].endind; int i; #ifdef DEBUG_KDTREESEARCH - fts_post("Leaf node p = %d\n", cur.node); + fts_post("Leaf node p = %d cur.dist %f\n", cur.node, cur.dist); #endif for (i = istart; i <= iend; i++) { @@ -152,9 +154,40 @@ #endif if (dxx < d[kmax]) { /* return original index in data and distance */ - y[kmax] = t->dataindex[i]; - d[kmax] = dxx; - kmax = maxArr(d, k); + if (k == 1) + { + y[kmax] = t->dataindex[i]; + d[kmax] = dxx; + } + else if (t->sort) + { + int pos = kmax; /* where to insert */ + + if (kmax < k - 1) + { /* first move or override */ + d[kmax + 1] = d[kmax]; + y[kmax + 1] = y[kmax]; + kmax++; + } + + /* insert into sorted list of distance */ + while (pos > 0 && dxx < d[pos - 1]) + { + /* move up */ + d[pos] = d[pos - 1]; + y[pos] = y[pos - 1]; + pos--; + } + + y[pos] = t->dataindex[i]; + d[pos] = dxx; + } + else + { + y[kmax] = t->dataindex[i]; + d[kmax] = dxx; + kmax = maxArr(d, k); + } } } } @@ -162,7 +195,8 @@ { // branched node float d = distV2N(t, x, cur.node); #ifdef DEBUG_KDTREESEARCH - fts_post("Inner node %d, d = %f\n", cur.node, d); + fts_post("Inner node %d d %f cur.dist %f\n", + cur.node, d, cur.dist); #endif if (d < 0) { @@ -184,6 +218,7 @@ } } } + /* else: node can be eliminated from search */ } - return k; /* return actual number of found neighbours */ + return kmax + 1; /* return actual number of found neighbours */ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-07-24 17:08:35
|
Revision: 1837 http://ftm.svn.sourceforge.net/ftm/?rev=1837&view=rev Author: borghesi Date: 2008-07-24 17:08:42 +0000 (Thu, 24 Jul 2008) Log Message: ----------- ftm.editor: fixed bug in dict and mat about matrix interface Modified Paths: -------------- trunk/ftm/ftmlib/classes/dict.c trunk/ftm/ftmlib/classes/mat.c Modified: trunk/ftm/ftmlib/classes/dict.c =================================================================== --- trunk/ftm/ftmlib/classes/dict.c 2008-07-24 16:55:32 UTC (rev 1836) +++ trunk/ftm/ftmlib/classes/dict.c 2008-07-24 17:08:42 UTC (rev 1837) @@ -951,7 +951,7 @@ // gui interface if(name == fts_s_fvec) *openObjGui = fts_object_get_gui_interface(o, fts_s_fvec); - else if(name == fts_s_mat || name == fts_s_dict || fts_s_fmat) + else if(name == fts_s_mat || name == fts_s_dict || name == fts_s_fmat) *openObjGui = fts_object_get_gui_interface(o, fts_s_matrix); else if(name == fts_s_bpf) *openObjGui = fts_object_get_gui_interface(o, fts_s_bpf); Modified: trunk/ftm/ftmlib/classes/mat.c =================================================================== --- trunk/ftm/ftmlib/classes/mat.c 2008-07-24 16:55:32 UTC (rev 1836) +++ trunk/ftm/ftmlib/classes/mat.c 2008-07-24 17:08:42 UTC (rev 1837) @@ -2414,7 +2414,7 @@ if(name == fts_s_fvec) *openObjGui = fts_object_get_gui_interface(o, fts_s_fvec); - else if(name == fts_s_mat || name == fts_s_dict || fts_s_fmat) + else if(name == fts_s_mat || name == fts_s_dict || name == fts_s_fmat) *openObjGui = fts_object_get_gui_interface(o, fts_s_matrix); else if(name == fts_s_bpf) *openObjGui = fts_object_get_gui_interface(o, fts_s_bpf); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-07-24 16:55:24
|
Revision: 1836 http://ftm.svn.sourceforge.net/ftm/?rev=1836&view=rev Author: borghesi Date: 2008-07-24 16:55:32 +0000 (Thu, 24 Jul 2008) Log Message: ----------- ftm.editor: adapted cpp gui_interface Modified Paths: -------------- trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h Modified: trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h =================================================================== --- trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h 2008-07-24 16:52:48 UTC (rev 1835) +++ trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h 2008-07-24 16:55:32 UTC (rev 1836) @@ -167,6 +167,7 @@ virtual void setFloat(void *obj, int row, int col, double value) = 0; virtual void setInt(void *obj, int row, int col, int value) = 0; virtual void setString(void *obj, int row, int col, char *value) = 0; + virtual void getObject(void *obj, int row, int col, void **openObj, imtr_guiInterface **openObjGui, char **description) = 0; }; /** @} Matrix gui interface */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-07-24 16:52:41
|
Revision: 1835 http://ftm.svn.sourceforge.net/ftm/?rev=1835&view=rev Author: borghesi Date: 2008-07-24 16:52:48 +0000 (Thu, 24 Jul 2008) Log Message: ----------- ftm.editor: matrix editor (for mat and dict) can open editors for inner objects Modified Paths: -------------- trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj trunk/ftm/ftmlib/classes/dict.c trunk/ftm/ftmlib/classes/fmat.c trunk/ftm/ftmlib/classes/mat.c trunk/ftm/ftmlib/predefsymbols.h trunk/ftm/gui/Juce/c_gui/guiinterfaces.h trunk/ftm/gui/Juce/common/MatrixEditor.cpp Modified: trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj =================================================================== --- trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj 2008-07-24 10:48:35 UTC (rev 1834) +++ trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj 2008-07-24 16:52:48 UTC (rev 1835) @@ -645,7 +645,7 @@ 5C23143107A28BF300CC6F2E /* ftm.buffer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ftm.buffer.c; sourceTree = "<group>"; }; 5C3DB7B10AB078B000BE8005 /* ftmjs.mxo */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ftmjs.mxo; sourceTree = BUILT_PRODUCTS_DIR; }; 5C3DB7BF0AB07A3A00BE8005 /* ftmjs.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ftmjs.c; sourceTree = "<group>"; }; - 5C4038CE0BDF94FA00CCBF8F /* FTMlib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FTMlib.framework; path = /Library/Frameworks/FTMlib.framework; sourceTree = "<absolute>"; }; + 5C4038CE0BDF94FA00CCBF8F /* FTMlib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FTMlib.framework; path = "../../../../build-macho/FTMlib.framework"; sourceTree = SOURCE_ROOT; }; 5C5F085A0782214600A59DE2 /* ftm.inter.mxo */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ftm.inter.mxo; sourceTree = BUILT_PRODUCTS_DIR; }; 5C5F086D0782217900A59DE2 /* ftm.inter.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ftm.inter.c; sourceTree = "<group>"; }; 5C5F087A078222B700A59DE2 /* ftm.tween.mxo */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ftm.tween.mxo; sourceTree = BUILT_PRODUCTS_DIR; }; Modified: trunk/ftm/ftmlib/classes/dict.c =================================================================== --- trunk/ftm/ftmlib/classes/dict.c 2008-07-24 10:48:35 UTC (rev 1834) +++ trunk/ftm/ftmlib/classes/dict.c 2008-07-24 16:52:48 UTC (rev 1835) @@ -931,6 +931,42 @@ fts_set_symbol(&a, fts_new_symbol(value)); dict_gui_matrix_set(self, row, col, &a); } +static void +dict_gui_matrix_get_object(void *obj, int row, int col, void **openObj, imtr_guiInterface **openObjGui, char **description) +{ + dict_t *self = (dict_t *) obj; + fts_atom_t key, val, value; + dict_get_by_row(self, row, &key, &val); + + value = (col == 0) ? key : val; + if(fts_is_object(&value)) + { + fts_symbol_t name; + char buff[256]; + fts_object_t *o = fts_get_object(&value); + int obj_id = fts_object_get_id(o); + *openObj = (void *)o; + name = fts_object_get_class_name(o); + + // gui interface + if(name == fts_s_fvec) + *openObjGui = fts_object_get_gui_interface(o, fts_s_fvec); + else if(name == fts_s_mat || name == fts_s_dict || fts_s_fmat) + *openObjGui = fts_object_get_gui_interface(o, fts_s_matrix); + else if(name == fts_s_bpf) + *openObjGui = fts_object_get_gui_interface(o, fts_s_bpf); + else if(name == fts_s_track) + *openObjGui = fts_object_get_gui_interface(o, fts_s_score); + else if(name == fts_s_sequence) + *openObjGui = fts_object_get_gui_interface(o, fts_s_markers); + else + *openObjGui = fts_object_get_gui_interface(o, fts_s_matrix); + + // descrition + snprintf(buff, 255, "<%s[#%d]>", fts_symbol_name(name), obj_id); + strcpy(*description, buff); + } +} /********************************************************** * @@ -1022,6 +1058,7 @@ dict_gui_interface_matrix->setFloat = dict_gui_matrix_set_float; dict_gui_interface_matrix->setInt = dict_gui_matrix_set_int; dict_gui_interface_matrix->setString = dict_gui_matrix_set_string; + dict_gui_interface_matrix->getObject = dict_gui_matrix_get_object; fts_class_gui_interface(cl, fts_s_matrix, dict_gui_interface_matrix); } Modified: trunk/ftm/ftmlib/classes/fmat.c =================================================================== --- trunk/ftm/ftmlib/classes/fmat.c 2008-07-24 10:48:35 UTC (rev 1834) +++ trunk/ftm/ftmlib/classes/fmat.c 2008-07-24 16:52:48 UTC (rev 1835) @@ -5249,6 +5249,13 @@ fmat_gui_matrix_set_int(void *obj, int row, int col, int value){} static void fmat_gui_matrix_set_string(void *obj, int row, int col, const char *value){} +static void +fmat_gui_matrix_get_object(void *obj, int row, int col, void **openObj, imtr_guiInterface **openObjGui, char **description) +{ + *openObj = NULL; + *openObjGui = NULL; + *description = 0; +} /********************************************************* * Modified: trunk/ftm/ftmlib/classes/mat.c =================================================================== --- trunk/ftm/ftmlib/classes/mat.c 2008-07-24 10:48:35 UTC (rev 1834) +++ trunk/ftm/ftmlib/classes/mat.c 2008-07-24 16:52:48 UTC (rev 1835) @@ -2392,11 +2392,44 @@ static void mat_gui_matrix_set_string(void *obj, int row, int col, const char *value) { - mat_t *self = (mat_t *) obj; + mat_t *self = (mat_t *) obj; fts_atom_t a; fts_set_symbol(&a, fts_new_symbol(value)); mat_set_element(self, row, col, &a); } +static void +mat_gui_matrix_get_object(void *obj, int row, int col, void **openObj, imtr_guiInterface **openObjGui, char **description) +{ + mat_t *self = (mat_t *) obj; + fts_atom_t *val = mat_get_element(self, row, col); + if(fts_is_object(val)) + { + fts_symbol_t name; + char buff[256]; + fts_object_t *o = fts_get_object(val); + int obj_id = fts_object_get_id(o); + *openObj = fts_get_object(val); + *openObj = (void *)o; + name = fts_object_get_class_name(o); + + if(name == fts_s_fvec) + *openObjGui = fts_object_get_gui_interface(o, fts_s_fvec); + else if(name == fts_s_mat || name == fts_s_dict || fts_s_fmat) + *openObjGui = fts_object_get_gui_interface(o, fts_s_matrix); + else if(name == fts_s_bpf) + *openObjGui = fts_object_get_gui_interface(o, fts_s_bpf); + else if(name == fts_s_track) + *openObjGui = fts_object_get_gui_interface(o, fts_s_score); + else if(name == fts_s_sequence) + *openObjGui = fts_object_get_gui_interface(o, fts_s_markers); + else + *openObjGui = fts_object_get_gui_interface(o, fts_s_matrix); + + // descrition + snprintf(buff, 255, "<%s[#%d]>", fts_symbol_name(name), obj_id); + strcpy(*description, buff); + } +} /******************************************************************** * * class @@ -2616,6 +2649,7 @@ mat_gui_interface_matrix->setFloat = mat_gui_matrix_set_float; mat_gui_interface_matrix->setInt = mat_gui_matrix_set_int; mat_gui_interface_matrix->setString = mat_gui_matrix_set_string; + mat_gui_interface_matrix->getObject = mat_gui_matrix_get_object; fts_class_gui_interface(cl, fts_s_matrix, mat_gui_interface_matrix); } Modified: trunk/ftm/ftmlib/predefsymbols.h =================================================================== --- trunk/ftm/ftmlib/predefsymbols.h 2008-07-24 10:48:35 UTC (rev 1834) +++ trunk/ftm/ftmlib/predefsymbols.h 2008-07-24 16:52:48 UTC (rev 1835) @@ -81,7 +81,10 @@ PREDEF_SYMBOL( fts_s_time, "time") PREDEF_SYMBOL( fts_s_index, "index") PREDEF_SYMBOL( fts_s_bpf, "bpf") +PREDEF_SYMBOL( fts_s_dict, "dict") +PREDEF_SYMBOL( fts_s_fmat, "fmat") PREDEF_SYMBOL( fts_s_fvec, "fvec") +PREDEF_SYMBOL( fts_s_mat, "mat") PREDEF_SYMBOL( fts_s_row, "row") PREDEF_SYMBOL( fts_s_col, "col") Modified: trunk/ftm/gui/Juce/c_gui/guiinterfaces.h =================================================================== --- trunk/ftm/gui/Juce/c_gui/guiinterfaces.h 2008-07-24 10:48:35 UTC (rev 1834) +++ trunk/ftm/gui/Juce/c_gui/guiinterfaces.h 2008-07-24 16:52:48 UTC (rev 1835) @@ -687,6 +687,17 @@ typedef void (*imtr_gui_interface_matrix_set_string_t)(void *obj, int row, int col, const char *value); /** + * @brief get object and gui interface at given position + * @param obj the matrix object + * @param row the row + * @param col the col + * @param openObj returns the object + * @param openObjGui returns gui interface + * @ingroup guiinterfaces + */ +typedef void (*imtr_gui_interface_matrix_get_object_t)(void *obj, int row, int col, void **openObj, imtr_guiInterface **openObjGui, char **description); + +/** * @brief score gui interface * @ingroup guiinterfaces */ @@ -701,6 +712,7 @@ imtr_gui_interface_matrix_set_float_t setFloat; imtr_gui_interface_matrix_set_int_t setInt; imtr_gui_interface_matrix_set_string_t setString; + imtr_gui_interface_matrix_get_object_t getObject; } imtr_guiInterfaceMatrix; /** @} Score gui interface */ Modified: trunk/ftm/gui/Juce/common/MatrixEditor.cpp =================================================================== --- trunk/ftm/gui/Juce/common/MatrixEditor.cpp 2008-07-24 10:48:35 UTC (rev 1834) +++ trunk/ftm/gui/Juce/common/MatrixEditor.cpp 2008-07-24 16:52:48 UTC (rev 1835) @@ -41,7 +41,10 @@ #define float_Pi 3.14159265358979323846f #define MARKERS_INFO_SIZE 35 +#define INNER_BAR_SIZE 15 +JUCE_EDITOR_NAMESPACE::Component *createInnerBar(ImtrEditor *mainEditor, ImtrEditor *innerEditor); + class MatrixEditor : public JUCE_EDITOR_NAMESPACE::Component, public JUCE_EDITOR_NAMESPACE::TableListBoxModel, public ImtrEditor { JUCE_EDITOR_NAMESPACE::Colour backcolor, lightColor, darkerColor, forecolor, selectColor, labelColor, selectedCellColor; @@ -64,7 +67,11 @@ int lastClickedCol; bool activateSelectedCell; - + + /*--------- contained editor ------------------*/ + JUCE_EDITOR_NAMESPACE::Component *innerEditor; + JUCE_EDITOR_NAMESPACE::Component *innerBar; + public: MatrixEditor(void *obj, imtr_guiInterfaceMatrix *matrixGui, EditorContainer *container, ImtrEditorListener *listener) : font (12.0f), listener(listener), container(container), obj(obj), matrixGui(matrixGui) { @@ -113,6 +120,9 @@ lastClickedCol = -1; activateSelectedCell = false; + + innerEditor = NULL; + innerBar = NULL; } ~MatrixEditor() @@ -274,7 +284,13 @@ void resized() { + JUCE_EDITOR_NAMESPACE::Rectangle bounds = getBounds(); table->setBoundsInset (JUCE_EDITOR_NAMESPACE::BorderSize(1)); + + if(innerBar != NULL) + innerBar->setBounds(0, 0, bounds.getWidth(), INNER_BAR_SIZE); + if(innerEditor != NULL) + innerEditor->setBounds(0, INNER_BAR_SIZE, bounds.getWidth(), bounds.getHeight()-INNER_BAR_SIZE); } /************************* @@ -439,7 +455,47 @@ if(infoImage == NULL) createAndDrawInfoBackground(); return infoImage; } + /////////////////////////////////////////////////////////////////////////////////////////////////////// + void openEditorForObject(int row, int column) + { + void *openObj = NULL; + imtr_guiInterface *openObjGui = NULL; + char *descr = (char *)alloca(sizeof(char) * 256); + + matrixGui->getObject(obj, row, column, &openObj, &openObjGui, &descr); + if(openObj != NULL && openObjGui != NULL) + { + innerEditor = container->createEditor(openObj, openObjGui); + (dynamic_cast<ImtrEditor *>(innerEditor))->setDescription(JUCE_EDITOR_NAMESPACE::String(descr)); + addAndMakeVisible(innerEditor); + + //innerBar = new InnerBar(this); + innerBar = createInnerBar(this, (dynamic_cast<ImtrEditor *>(innerEditor))); + addAndMakeVisible(innerBar); + + resized(); + } + } + + void closeInnerEditor() + { + if(innerBar != NULL) + { + removeChildComponent(innerBar); + delete innerBar; + innerBar = NULL; + } + if(innerEditor != NULL) + { + removeChildComponent(innerEditor); + delete innerEditor; + innerEditor = NULL; + } + resized(); + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////// class MatrixComponent: public JUCE_EDITOR_NAMESPACE::Component, public JUCE_EDITOR_NAMESPACE::LabelListener { public: @@ -450,7 +506,6 @@ double floatVal; int intVal; char *stringVal = (char *)alloca(sizeof(char) * 256); - int type = -1; type = owner.matrixGui->getValue(owner.obj, row, column, &floatVal, &intVal, &stringVal); @@ -474,6 +529,7 @@ label->setEditable(false, true, true); label->addListener(this); + label->addMouseListener(dynamic_cast <JUCE_EDITOR_NAMESPACE::MouseListener*> (this), true); } ~MatrixComponent(){} @@ -489,7 +545,6 @@ double floatVal; int intVal; char *stringVal = (char *)alloca(sizeof(char) * 256); - int type = -1; row = r; column = c; @@ -598,14 +653,89 @@ } } + void mouseDown(const JUCE_EDITOR_NAMESPACE::MouseEvent& e) + { + if(type == 3 && e.mods.isPopupMenu()) + { + JUCE_EDITOR_NAMESPACE::PopupMenu m; + m.addItem (1, "Open Editor"); + const int r = m.show(); + switch(r) + { + case 1: + owner.openEditorForObject(row, column); + } + } + } + private: MatrixEditor& owner; JUCE_EDITOR_NAMESPACE::Label* label; int row, column; - }; + int type; + }; }; +class InnerBar: public JUCE_EDITOR_NAMESPACE::Component +{ + MatrixEditor *owner; + JUCE_EDITOR_NAMESPACE::Font *barFont; + ImtrEditor *innerEditor; +public: + InnerBar(MatrixEditor *owner_, ImtrEditor *innerEditor) : owner(owner_), innerEditor(innerEditor) + { + barFont = new JUCE_EDITOR_NAMESPACE::Font(JUCE_EDITOR_NAMESPACE::String( "Lucida Grande"), 10, JUCE_EDITOR_NAMESPACE::Font::italic); + } + + ~InnerBar(){} + + void paint (JUCE_EDITOR_NAMESPACE::Graphics& g) + { + int width = getWidth(); + int height = getHeight(); + int rectsize = height-8; + g.fillAll(JUCE_EDITOR_NAMESPACE::Colours::lightgrey); + + // draw bounds + g.setColour(JUCE_EDITOR_NAMESPACE::Colours::darkgrey); + g.drawRect(1, 1, width-2, height-2); + g.setColour(JUCE_EDITOR_NAMESPACE::Colours::lightgrey.brighter(0.3f)); + g.drawLine(2, 2, 2, height-2); + g.drawLine(2, 2, width-2, 2); + g.setColour(JUCE_EDITOR_NAMESPACE::Colours::lightgrey.darker(0.3f)); + g.drawLine(2, height-3, width-2, height-3); + g.drawLine(width-3, 2, width-3, height-2); + + //draw close rect + g.setColour(JUCE_EDITOR_NAMESPACE::Colours::darkgrey); + g.drawRect(width-4-rectsize, 4, rectsize, rectsize); + g.setColour(JUCE_EDITOR_NAMESPACE::Colours::black); + g.drawRect(width-2-rectsize, 6, rectsize-4, rectsize-4); + // draw text + g.setColour(JUCE_EDITOR_NAMESPACE::Colours::black); + g.setFont(*barFont); + g.drawSingleLineText(innerEditor->getDescription(), 3, height-5); + } + + void mouseDown(const JUCE_EDITOR_NAMESPACE::MouseEvent& e) + { + int x = e.getMouseDownX(); + int y = e.getMouseDownY(); + int height = getHeight(); + int width = getWidth(); + int rectsize = height - 4; + + if((x <= width-4 && x >= width - rectsize) && (y >= 4 && y <= height-4)) + owner->closeInnerEditor(); + } +}; + JUCE_EDITOR_NAMESPACE::Component *createMatrixEditor(void *obj, imtr_guiInterfaceMatrix *matrixGui, EditorContainer *container, ImtrEditorListener *listener) { return new MatrixEditor(obj, matrixGui, container, listener); +} + +JUCE_EDITOR_NAMESPACE::Component *createInnerBar(ImtrEditor *mainEditor, ImtrEditor *innerEditor) +{ + return new InnerBar((MatrixEditor *)mainEditor, innerEditor); } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-24 10:48:27
|
Revision: 1834 http://ftm.svn.sourceforge.net/ftm/?rev=1834&view=rev Author: diemo Date: 2008-07-24 10:48:35 +0000 (Thu, 24 Jul 2008) Log Message: ----------- different modes set method separate from message Modified Paths: -------------- trunk/ftm/ftmlib/classes/kdtree.c trunk/ftm/ftmlib/classes/kdtree.h trunk/ftm/ftmlib/classes/kdtreebuild.c trunk/ftm/ftmlib/classes/kdtreesearch.c Modified: trunk/ftm/ftmlib/classes/kdtree.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.c 2008-07-24 10:29:43 UTC (rev 1833) +++ trunk/ftm/ftmlib/classes/kdtree.c 2008-07-24 10:48:35 UTC (rev 1834) @@ -83,7 +83,7 @@ #if PROFILE -static void profile_clear (kdtree_t *t) +void profile_clear (kdtree_t *t) { t->profile.v2v = 0; t->profile.v2n = 0; @@ -167,7 +167,7 @@ fts_post("]%s", suffix); } -static void kdtree_info_display (kdtree_t* t) +void kdtree_info_display (kdtree_t* t) { int i, j; fts_post("\nTree Info:\n"); @@ -186,7 +186,7 @@ } -static void kdtree_data_display(kdtree_t* t) +void kdtree_data_display(kdtree_t* t) { int l, n, i, j; @@ -222,9 +222,25 @@ } +void kdtree_set (kdtree_t *self, fmat_t *data) +{ + if (self->data) + fts_object_release((fts_object_t *) self->data); + /* method only declared for fmat, so no check needed */ + self->data = data; + fts_object_refer((fts_object_t *) self->data); + kdtree_init(self, floor(log2(fmat_get_m(data))), + fmat_get_m(data), fmat_get_n(data)); + /* kdtree_clear and rebuild: */ + /* kdtree_clear(self);*/ + kdtree_build(self); +} + + + /****************************************************************************** * * user methods @@ -236,22 +252,10 @@ fts_atom_t *ret) { kdtree_t *self = (kdtree_t *) o; - fmat_t *data = (fmat_t *) fts_get_object(at); + fmat_t *data = (fmat_t *) fts_get_object(at); - if (self->data) - fts_object_release((fts_object_t *) self->data); + kdtree_set(self, data); - /* method only declared for fmat, so no check needed */ - self->data = data; - fts_object_refer((fts_object_t *) self->data); - - kdtree_init(self, floor(log2(fmat_get_m(data))), - fmat_get_m(data), fmat_get_n(data)); - - /* kdtree_clear and rebuild: */ - /* kdtree_clear(self);*/ - kdtree_build(self); - fts_set_object(ret, o); return fts_ok; } @@ -282,6 +286,7 @@ fmat_t *x = NULL; /* search vector */ int k = 1, n; int *result; + float *d; if (ac > 0 && fts_is_a(at, fmat_class)) x = (fmat_t *) fts_get_object(at); @@ -289,9 +294,10 @@ if (ac > 1 && fts_is_number(at+1)) k = fts_get_number_int(at+1); - result = alloca(sizeof(int) * k); + result = alloca(k * sizeof(float)); + d = alloca(k * sizeof(float)); - n = kdtree_search_knn(self, fmat_get_ptr(x), k, result); + n = kdtree_search_knn(self, fmat_get_ptr(x), k, result, d); if (s == fts_s_get) /* geti: nearest index? */ { /* return one fvec */ @@ -311,11 +317,11 @@ for (i = 0; i < n; i++) { if (s == s_getknni) - fts_set_int(at + i, self->dataindex[result[i]]); + fts_set_int(at + i, result[i]); else /* getknn */ { fvec_t *vec = fvec_create_row(self->data); - fvec_set_index(vec, self->dataindex[result[i]]); + fvec_set_index(vec, result[i]); fts_object_refer((fts_object_t *) vec); fts_set_object(at + i, vec); Modified: trunk/ftm/ftmlib/classes/kdtree.h =================================================================== --- trunk/ftm/ftmlib/classes/kdtree.h 2008-07-24 10:29:43 UTC (rev 1833) +++ trunk/ftm/ftmlib/classes/kdtree.h 2008-07-24 10:48:35 UTC (rev 1834) @@ -52,6 +52,7 @@ { int startind; /* index of first vector in node in dataindex array */ int endind; /* index of last vector in node in dataindex array */ + int splitdim; /* for dmode othogonal, dimension along which node is split*/ fmat_t *mean; /* mean vector (todo: median) */ fmat_t *split; /* hyperplane A1*X1 + A2*X2 +...+ An*Xn + An+1 = 0 */ @@ -59,21 +60,37 @@ } node_t; -enum kdtree_dmode { dmode_orthogonal, dmode_hyperplane, dmode_pca }; +/* decomposition mode */ +typedef enum +{ + dmode_orthogonal, /* optimised othogonal to axes */ + dmode_hyperplane, /* hyperplane orthogonal to axes */ + dmode_pca /* hyperplane along principal components */ +} kdtree_dmode_t; +/* pivot (mean vector to split at) calculation mode */ +typedef enum +{ + mmode_mean, /* mean of values / distances to splitplane */ + mmode_middle, /* middle between min/max */ + mmode_median /* true median (guarantees equal number of points left + and right and thus a well-balanced and optimal tree) */ +} kdtree_mmode_t; + typedef struct _kdtree { fts_object_t o; - enum kdtree_dmode dmode; - int ndim; /* Dimension of vectors */ - int ndata; /* Number of vectors */ - int height; /* Height of the kdtree */ - int nnodes; /* Number of nodes (must be a power of 2) */ + kdtree_dmode_t dmode; /* decomposition mode */ + kdtree_mmode_t mmode; /* pivot (mean vector to split at) calculation mode */ + int ndim; /* Dimension of vectors */ + int ndata; /* Number of vectors */ + int height; /* Height of the kdtree */ + int nnodes; /* Number of nodes (must be a power of 2) */ - fmat_t *data; /* data matrix (ndata, ndim) */ - int *dataindex; /* data vector indirection array (ndata) */ - node_t *nodes; /* nodes (nnodes) */ + fmat_t *data; /* data matrix (ndata, ndim) */ + int *dataindex; /* data vector indirection array (ndata) */ + node_t *nodes; /* nodes (nnodes) */ stack s; @@ -100,14 +117,19 @@ int pow2(int x); void vec_post (float *v, int n, const char *suffix); +void kdtree_info_display (kdtree_t* t); +void kdtree_data_display (kdtree_t* t); +void profile_clear (kdtree_t *t); /* vector to node distance */ float distV2N (kdtree_t* t, const float *x, const int node); +void kdtree_set_decomposition(kdtree_t *t, kdtree_dmode_t mode, void *param); + +void kdtree_set (kdtree_t *self, fmat_t *data); void kdtree_build (kdtree_t* t); void kdtree_init (kdtree_t* t, int h, int vect_num, int dim); -int kdtree_search_knn (kdtree_t *t, float* x, int k, int *y); +int kdtree_search_knn (kdtree_t *t, float* x, int k, float *y, float *d); - #endif Modified: trunk/ftm/ftmlib/classes/kdtreebuild.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-24 10:29:43 UTC (rev 1833) +++ trunk/ftm/ftmlib/classes/kdtreebuild.c 2008-07-24 10:48:35 UTC (rev 1834) @@ -7,26 +7,36 @@ #define DEBUG_KDTREEBUILD 0 -static void -compute_mean (kdtree_t *t, int node) +static void compute_mean (kdtree_t *t, int node, int dim) { - float sum; - float *mean_ptr = fmat_get_ptr(t->nodes[node].mean); -// float *data_ptr = fmat_get_ptr(t->data); - int nvector; - int i, j; + node_t *n = &t->nodes[node]; + float *mean_ptr = fmat_get_ptr(n->mean); +// float *data_ptr = fmat_get_ptr(t->data); + int nstart = n->startind; + int nend = n->endind; + int nvector = nend - nstart + 1; // number of vectors of processed node + int dstart, dend; + int i, j; -#if PROFILE_BUILD - t->profile.mean++; + if (dim < 0) + { + dstart = 0; + dend = t->ndim; + } + else + { + dstart = dim; + dend = dim + 1; +#if DEBUG_KDTREEBUILD + bzero(mean_ptr, t->ndim * sizeof(float)); #endif + } - // number of vectors from the processed node - nvector = t->nodes[node].endind - t->nodes[node].startind + 1; - for (j = 0; j < t->ndim; j++) + for (j = dstart; j < dend; j++) { - sum = 0; + float sum = 0; - for (i = t->nodes[node].startind; i <= t->nodes[node].endind; i++) + for (i = nstart; i <= nend; i++) { sum += kdtree_get_element(t, i, j); } @@ -40,6 +50,82 @@ } +static void compute_middle (kdtree_t *t, int node, int dim) +{ + node_t *n = &t->nodes[node]; + float *mean_ptr = fmat_get_ptr(n->mean); + int nstart = n->startind; + int nend = n->endind; + int dstart, dend; + int i, j; + + if (dim < 0) + { + dstart = 0; + dend = t->ndim; + } + else + { + dstart = dim; + dend = dim + 1; +#if DEBUG_KDTREEBUILD + bzero(mean_ptr, t->ndim * sizeof(float)); +#endif + } + + // number of vectors from the processed node + for (j = dstart; j < dend; j++) + { + float min = MAX_FLOAT, max = -MAX_FLOAT; + + for (i = nstart; i <= nend; i++) + { + float x = kdtree_get_element(t, i, j); + + if (x < min) + min = x; + if (x > max) + max = x; + } + mean_ptr[j] = (max + min) / 2.; + } + +#if DEBUG_KDTREEBUILD + fts_post("middle vect for node %d = ", node); + vec_post(mean_ptr, t->ndim, "\n"); +#endif +} + + +static void compute_pivot (kdtree_t *t, int node) +{ +#if PROFILE_BUILD + t->profile.mean++; +#endif + + switch (t->mmode) + { + case mmode_mean: + if (t->dmode == dmode_orthogonal) + compute_mean(t, node, t->nodes[node].splitdim); + else + compute_mean(t, node, -1); /* all dimensions */ + break; +/* + case mmode_median: + compute_median(t, node); + break; +*/ + case mmode_middle: + if (t->dmode == dmode_orthogonal) + compute_middle(t, node, t->nodes[node].splitdim); + else + compute_middle(t, node, -1); /* all dimensions */ + break; + } +} + + static int compare(float* currentVect, float* mean, int component) { // fts_post("compare %f and %f\n", mean[component], currentVect[component]); @@ -91,6 +177,8 @@ /* vector to node distance */ float distV2N (kdtree_t* t, const float *x, const int node) { + node_t *n = &t->nodes[node]; + #if PROFILE_BUILD t->profile.v2n++; #endif @@ -99,13 +187,13 @@ { case dmode_orthogonal: return distV2orthoH(x, - fmat_get_ptr(t->nodes[node].split), - t->ndim, t->nodes[node].splitnorm); + fmat_get_ptr(n->split), + t->ndim, n->splitnorm); case dmode_hyperplane: return distV2H(x, - fmat_get_ptr(t->nodes[node].split), - fmat_get_ptr(t->nodes[node].mean), - t->ndim, t->nodes[node].splitnorm); + fmat_get_ptr(n->split), + fmat_get_ptr(n->mean), + t->ndim, n->splitnorm); default: fts_post("error: unknown mode %d", t->dmode); return 0; @@ -115,6 +203,7 @@ static void compute_splitplane (kdtree_t* t, int node, int level) { + node_t *n = &t->nodes[node]; int b; float h; @@ -125,19 +214,20 @@ /* case dmode_orthogonal */ // Level parameter gives the base vector to use b = level % t->ndim; - h = fmat_get_element(t->nodes[node].mean, b, 0); + h = fmat_get_element(n->mean, b, 0); // We compute an hyperplane which is orthogonal to the base vector number b - fmat_set_const(t->nodes[node].split, 0); + fmat_set_const(n->split, 0); - fmat_set_element(t->nodes[node].split, b, 0, 1); - fmat_set_element(t->nodes[node].split, t->ndim, 0, -h); + fmat_set_element(n->split, b, 0, 1); + fmat_set_element(n->split, t->ndim, 0, -h); - t->nodes[node].splitnorm = 1; + n->splitnorm = 1; + n->splitdim = b; #if DEBUG_KDTREEBUILD fts_post("Splitplane of node %i: ", node); - vec_post(t->nodes[node].split, t->ndim + 1, "\n"); + vec_post(n->split, t->ndim + 1, "\n"); #endif } @@ -205,7 +295,7 @@ #endif for (n = nstart; n < nend; n++) { /* for all nodes at tree level l */ - compute_mean(t, n); + compute_pivot(t, n); compute_splitplane(t, n, l); #if DEBUG_KDTREEBUILD @@ -246,6 +336,7 @@ int i; t->dmode = dmode_orthogonal; + t->mmode = mmode_mean; t->ndim = dim; t->ndata = vect_num; t->height = h; Modified: trunk/ftm/ftmlib/classes/kdtreesearch.c =================================================================== --- trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-24 10:29:43 UTC (rev 1833) +++ trunk/ftm/ftmlib/classes/kdtreesearch.c 2008-07-24 10:48:35 UTC (rev 1834) @@ -98,11 +98,11 @@ } -/* out: y[K] = index of the Kth neirest neighbour +/* out: y[K] = index of the Kth nearest neighbour (in float for interfacing reasons) + d[K] = distance of the Kth nearest neighbour return: actual number of found neighbours */ -int kdtree_search_knn (kdtree_t *t, float* x, int k, int *y) +int kdtree_search_knn (kdtree_t *t, float* x, int k, float *y, float *d) { - float *d; // vector to vector distance from vector y[k] to vector x int i; // current processed vector float dxx; // dxx = distance between 2 vectors int kmax = 0; // index of current Kth neighbour @@ -115,7 +115,6 @@ k = 1; // Init distances - d = alloca(k * sizeof(float)); for(i = 0; i < k; i++) { d[i] = MAX_FLOAT; @@ -143,18 +142,17 @@ for (i = istart; i <= iend; i++) { dxx = euclidianDistance(x, kdtree_get_vector(t, i), t->ndim); - +#if PROFILE_SEARCH + t->profile.v2v++; +#endif #ifdef DEBUG_KDTREESEARCH fts_post("distance = %f between vector %d ", dxx, i); vec_post(kdtree_get_vector(t, i), t->ndim, " and x "); - vec_post(x, t->ndim, "\n"); + vec_post(x, t->ndim, "\n"); #endif -#if PROFILE_SEARCH - t->profile.v2v++; -#endif if (dxx < d[kmax]) - { - y[kmax] = i; + { /* return original index in data and distance */ + y[kmax] = t->dataindex[i]; d[kmax] = dxx; kmax = maxArr(d, k); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bor...@us...> - 2008-07-24 10:29:37
|
Revision: 1833 http://ftm.svn.sourceforge.net/ftm/?rev=1833&view=rev Author: borghesi Date: 2008-07-24 10:29:43 +0000 (Thu, 24 Jul 2008) Log Message: ----------- ftm.editor: new MatrixEditor (interface matrixGui implemented by fmat/mat/dict classes) Modified Paths: -------------- trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj trunk/ftm/ftmlib/atom.h trunk/ftm/ftmlib/classes/dict.c trunk/ftm/ftmlib/classes/fmat.c trunk/ftm/ftmlib/classes/mat.c trunk/ftm/ftmlib/classes/sequence.c trunk/ftm/ftmlib/predefsymbols.h trunk/ftm/gui/Juce/c_gui/guiinterfaces.h trunk/ftm/gui/Juce/common/BpfEditor.cpp trunk/ftm/gui/Juce/common/EditorContainer.cpp trunk/ftm/gui/Juce/common/ImtrEditor.h trunk/ftm/gui/Juce/common/MarkersTableView.cpp trunk/ftm/gui/Juce/common/imtrjuce.h trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h trunk/ftm/gui/Juce/examples/osx-application/Main.cpp trunk/ftm/gui/Juce/examples/osx-application/juce_application.xcodeproj/project.pbxproj Added Paths: ----------- trunk/ftm/gui/Juce/common/MatrixEditor.cpp Modified: trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj =================================================================== --- trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/build/max/osx-macho/ftmexternals.xcodeproj/project.pbxproj 2008-07-24 10:29:43 UTC (rev 1833) @@ -192,12 +192,13 @@ 3B4E71160CC8E399006DFB5A /* MarkersTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B4E71150CC8E399006DFB5A /* MarkersTableView.cpp */; }; 3B7073BE0713F12300764C51 /* ftm.list.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B7073BD0713F04500764C51 /* ftm.list.c */; }; 3B8DE0FC0E10F962000757BC /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B8DE0FB0E10F962000757BC /* AppKit.framework */; }; + 3B99E1280E349FB3000AF43F /* MatrixEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B99E1270E349FB3000AF43F /* MatrixEditor.cpp */; }; 3B9D37B30E1CD6CC002ED38C /* EditorContainerListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B9D37B10E1CD6CC002ED38C /* EditorContainerListener.h */; }; 3B9D37B40E1CD6CC002ED38C /* InfoPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B9D37B20E1CD6CC002ED38C /* InfoPanel.cpp */; }; - 3BA368CD0E0A60050011055C /* libjuce.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BDB04330D197490006AEB4A /* libjuce.a */; }; 3BA9E3B80E2513A500B88643 /* ScoreEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BA9E3B60E2513A500B88643 /* ScoreEditor.cpp */; }; 3BA9E3B90E2513A500B88643 /* ScoreTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BA9E3B70E2513A500B88643 /* ScoreTableView.cpp */; }; 3BBD0E020E261F6D0074EE11 /* BpfTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BBD0E010E261F6D0074EE11 /* BpfTableView.cpp */; }; + 3BC5ADA40E36134E00AAA94D /* libjucedebug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B03F9840CAA96E7001C491B /* libjucedebug.a */; }; 3BCAC5EC0CBE5E7E00020156 /* FvecEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BCAC5EB0CBE5E7E00020156 /* FvecEditor.cpp */; }; 3BDB03F40D197463006AEB4A /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BDB03F30D197463006AEB4A /* IOKit.framework */; }; 3BDB03F50D197463006AEB4A /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BDB03F30D197463006AEB4A /* IOKit.framework */; }; @@ -613,6 +614,7 @@ 3B4E71150CC8E399006DFB5A /* MarkersTableView.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MarkersTableView.cpp; sourceTree = "<group>"; }; 3B7073BD0713F04500764C51 /* ftm.list.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ftm.list.c; sourceTree = "<group>"; }; 3B8DE0FB0E10F962000757BC /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; + 3B99E1270E349FB3000AF43F /* MatrixEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MatrixEditor.cpp; sourceTree = "<group>"; }; 3B9D37B10E1CD6CC002ED38C /* EditorContainerListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorContainerListener.h; sourceTree = "<group>"; }; 3B9D37B20E1CD6CC002ED38C /* InfoPanel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InfoPanel.cpp; sourceTree = "<group>"; }; 3BA9E3B60E2513A500B88643 /* ScoreEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScoreEditor.cpp; sourceTree = "<group>"; }; @@ -864,7 +866,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 3BA368CD0E0A60050011055C /* libjuce.a in Frameworks */, + 3BC5ADA40E36134E00AAA94D /* libjucedebug.a in Frameworks */, 3B1CA8000C467C4C005F0280 /* CoreAudio.framework in Frameworks */, 3B1CA7FA0C467C39005F0280 /* AGL.framework in Frameworks */, 3B1CA7DA0C467B12005F0280 /* MaxAPI.framework in Frameworks */, @@ -1155,6 +1157,7 @@ 3B0682DB0C2937D200D78875 /* EditorScrollBar.h */, 3BCAC5EB0CBE5E7E00020156 /* FvecEditor.cpp */, 3B4E71150CC8E399006DFB5A /* MarkersTableView.cpp */, + 3B99E1270E349FB3000AF43F /* MatrixEditor.cpp */, 3BA9E3B60E2513A500B88643 /* ScoreEditor.cpp */, 3BA9E3B70E2513A500B88643 /* ScoreTableView.cpp */, 3B40FAA50D351B7D00A25542 /* ScrollZoomListener.h */, @@ -3142,6 +3145,7 @@ 3BA9E3B80E2513A500B88643 /* ScoreEditor.cpp in Sources */, 3BA9E3B90E2513A500B88643 /* ScoreTableView.cpp in Sources */, 3BBD0E020E261F6D0074EE11 /* BpfTableView.cpp in Sources */, + 3B99E1280E349FB3000AF43F /* MatrixEditor.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3507,7 +3511,9 @@ LIBRARY_SEARCH_PATHS = ( "${inherited}", "${SRCROOT}/../../../components/juce/bin/UninstalledProducts", + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", ); + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../components/juce/bin\""; OTHER_LDFLAGS = ( "${inherited}", "-framework", @@ -3533,7 +3539,9 @@ LIBRARY_SEARCH_PATHS = ( "${inherited}", "${SRCROOT}/../../../components/juce/bin/UninstalledProducts", + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", ); + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../components/juce/bin\""; OTHER_LDFLAGS = ( "${inherited}", "-framework", Modified: trunk/ftm/ftmlib/atom.h =================================================================== --- trunk/ftm/ftmlib/atom.h 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/ftmlib/atom.h 2008-07-24 10:29:43 UTC (rev 1833) @@ -21,7 +21,7 @@ */ /** - * FTS atom support. + * FTS atom support.ww * * Atoms are arbitary values. * Modified: trunk/ftm/ftmlib/classes/dict.c =================================================================== --- trunk/ftm/ftmlib/classes/dict.c 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/ftmlib/classes/dict.c 2008-07-24 10:29:43 UTC (rev 1833) @@ -27,6 +27,8 @@ static fts_symbol_t sym_remove_entries = 0; +static imtr_guiInterfaceMatrix *dict_gui_interface_matrix = NULL; + #define dict_set_editor_open(m) ((m)->opened = 1) #define dict_set_editor_close(m) ((m)->opened = 0) @@ -802,6 +804,134 @@ return fts_ok; } + +/************************************************************ + * + * Matrix Gui Interface + * + */ +static void +dict_get_by_row(dict_t *self, int row, fts_atom_t *key, fts_atom_t *val) +{ + fts_iterator_t key_iterator; + int i = 0; + fts_hashtable_get_keys(&self->hash, &key_iterator); + while(fts_iterator_has_more(&key_iterator)) + { + fts_iterator_next(&key_iterator, key); + if(i == row) break; + i++; + } + dict_get(self, key, val); +} + +static int +dict_gui_matrix_is_float() +{ + return 0; +} +static int +dict_gui_matrix_get_rows(void *obj) +{ + dict_t *self = (dict_t *) obj; + return fts_hashtable_get_size(&self->hash); +} +static int +dict_gui_matrix_get_cols(void *obj) +{ + return 2; +} +static int +dict_gui_matrix_get_value(void *obj, int row, int col, double *float_val, int *int_val, char **string_val) +{ + dict_t *self = (dict_t *) obj; + fts_atom_t key, val, value; + + dict_get_by_row(self, row, &key, &val); + value = (col == 0) ? key : val; + + if(fts_is_float(&value)) + { + *float_val = fts_get_number_float(&value); + *int_val = 0; + *string_val = 0; + return 0; + } + else if(fts_is_int(&value)) + { + *float_val = 0; + *int_val = fts_get_number_int(&value); + *string_val = 0; + return 1; + } + else if(fts_is_symbol(&value)) + { + *float_val = 0; + *int_val = 0; + *string_val = fts_symbol_name(fts_get_symbol(&value)); + return 2; + } + else if(fts_is_object(&value)) + { + char buff[256]; + fts_object_t *obj = fts_get_object(&value); + int obj_id = fts_object_get_id(obj); + fts_symbol_t name = fts_s_empty_string; + + if(name != fts_s_empty_string) + snprintf(buff, 255, "<%s[#%d]> [%s]", fts_symbol_name(fts_object_get_class_name(obj)), obj_id, fts_symbol_name(name)); + else + snprintf(buff, 255, "<%s[#%d]>", fts_symbol_name(fts_object_get_class_name(obj)), obj_id); + + *float_val = 0; + *int_val = 0; + strcpy(*string_val, buff); + return 3; + } + return -1; +} +static void +dict_gui_matrix_set(void *obj, int row, int col, fts_atom_t *at) +{ + dict_t *self = (dict_t *) obj; + fts_atom_t key, val; + dict_get_by_row(self, row, &key, &val); + + if(col == 0) + { + dict_remove(self, &key); + dict_store(self, at, &val); + } + else + dict_store(self, &key, at); + + dict_changed(self); +} +static void +dict_gui_matrix_set_float(void *obj, int row, int col, double value) +{ + dict_t *self = (dict_t *) obj; + fts_atom_t a; + fts_set_float(&a, value); + dict_gui_matrix_set(self, row, col, &a); +} +static void +dict_gui_matrix_set_int(void *obj, int row, int col, int value) +{ + dict_t *self = (dict_t *) obj; + fts_atom_t a; + fts_set_int(&a, value); + dict_gui_matrix_set(self, row, col, &a); +} +static void +dict_gui_matrix_set_string(void *obj, int row, int col, const char *value) +{ + dict_t *self = (dict_t *) obj; + fts_atom_t a; + fts_set_symbol(&a, fts_new_symbol(value)); + dict_gui_matrix_set(self, row, col, &a); +} + /********************************************************** * * class @@ -882,6 +1012,18 @@ fts_class_message_varargs(cl, fts_s_closeEditor, dict_close_editor, NULL); fts_class_message_varargs(cl, fts_s_destroyEditor, dict_destroy_editor, NULL); fts_class_message_varargs(cl, fts_s_listenersNotify, dict_listeners_notify, NULL); + + dict_gui_interface_matrix = (imtr_guiInterfaceMatrix *)fts_malloc(sizeof(imtr_guiInterfaceMatrix)); + ((imtr_guiInterface *)dict_gui_interface_matrix)->name = fts_symbol_name(fts_s_matrix); + dict_gui_interface_matrix->isFloat = dict_gui_matrix_is_float; + dict_gui_interface_matrix->getRows = dict_gui_matrix_get_rows; + dict_gui_interface_matrix->getCols = dict_gui_matrix_get_cols; + dict_gui_interface_matrix->getValue = dict_gui_matrix_get_value; + dict_gui_interface_matrix->setFloat = dict_gui_matrix_set_float; + dict_gui_interface_matrix->setInt = dict_gui_matrix_set_int; + dict_gui_interface_matrix->setString = dict_gui_matrix_set_string; + + fts_class_gui_interface(cl, fts_s_matrix, dict_gui_interface_matrix); } FTS_MODULE_INIT(dict) Modified: trunk/ftm/ftmlib/classes/fmat.c =================================================================== --- trunk/ftm/ftmlib/classes/fmat.c 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/ftmlib/classes/fmat.c 2008-07-24 10:29:43 UTC (rev 1833) @@ -67,6 +67,7 @@ static imtr_guiInterfaceFvec *fmat_gui_interface_fvec = NULL; static imtr_guiInterfaceSpectrogram *fmat_gui_interface_spectro = NULL; static imtr_guiInterfaceBpf *fmat_gui_interface_bpf = NULL; +static imtr_guiInterfaceMatrix *fmat_gui_interface_matrix = NULL; #ifdef WIN32 /* undefined functions on windows */ @@ -5205,6 +5206,50 @@ return NULL; /* return point */ } +/************************************************************ + * + * Matrix Gui Interface + * + */ + +static int +fmat_gui_matrix_is_float() +{ + return 1; +} +static int +fmat_gui_matrix_get_rows(void *obj) +{ + fmat_t *self = (fmat_t *) obj; + return fmat_get_m(self); +} +static int +fmat_gui_matrix_get_cols(void *obj) +{ + fmat_t *self = (fmat_t *) obj; + return fmat_get_n(self); +} +static int +fmat_gui_matrix_get_value(void *obj, int row, int col, double *float_val, int *int_val, char **string_val) +{ + fmat_t *self = (fmat_t *) obj; + *float_val = fmat_get_element(self, row, col); + *int_val = 0; + *string_val = 0; + + return 0; +} +static void +fmat_gui_matrix_set_float(void *obj, int row, int col, double value) +{ + fmat_t *self = (fmat_t *) obj; + fmat_set_element(self, row, col, value); +} +static void +fmat_gui_matrix_set_int(void *obj, int row, int col, int value){} +static void +fmat_gui_matrix_set_string(void *obj, int row, int col, const char *value){} + /********************************************************* * * class init/delete @@ -5506,6 +5551,18 @@ fmat_gui_interface_bpf->getNextPoint = fmat_gui_bpf_get_next_point; fts_class_gui_interface(cl, fts_s_bpf, fmat_gui_interface_bpf); + + fmat_gui_interface_matrix = (imtr_guiInterfaceMatrix *)fts_malloc(sizeof(imtr_guiInterfaceMatrix)); + ((imtr_guiInterface *)fmat_gui_interface_matrix)->name = fts_symbol_name(fts_s_matrix); + fmat_gui_interface_matrix->isFloat = fmat_gui_matrix_is_float; + fmat_gui_interface_matrix->getRows = fmat_gui_matrix_get_rows; + fmat_gui_interface_matrix->getCols = fmat_gui_matrix_get_cols; + fmat_gui_interface_matrix->getValue = fmat_gui_matrix_get_value; + fmat_gui_interface_matrix->setFloat = fmat_gui_matrix_set_float; + fmat_gui_interface_matrix->setInt =fmat_gui_matrix_set_int; + fmat_gui_interface_matrix->setString = fmat_gui_matrix_set_string; + + fts_class_gui_interface(cl, fts_s_matrix, fmat_gui_interface_matrix); } FTS_MODULE_INIT(fmat) Modified: trunk/ftm/ftmlib/classes/mat.c =================================================================== --- trunk/ftm/ftmlib/classes/mat.c 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/ftmlib/classes/mat.c 2008-07-24 10:29:43 UTC (rev 1833) @@ -30,6 +30,7 @@ static imtr_guiInterfaceMarkers *mat_gui_interface_markers = NULL; static imtr_guiInterfaceScore *mat_gui_interface_score = NULL; +static imtr_guiInterfaceMatrix *mat_gui_interface_matrix = NULL; static void mat_changed(mat_t *mat) @@ -2059,7 +2060,7 @@ mat_delete_rows((mat_t *)obj, index, 1); } static void -mat_gui_markers_set_label(void *obj, void *marker, int index, char *label) +mat_gui_markers_set_label(void *obj, void *marker, int index, const char *label) { int m = mat_get_m((mat_t *)obj); int n = mat_get_n((mat_t *)obj); @@ -2294,6 +2295,108 @@ return NULL; } +/************************************************************ + * + * Matrix Gui Interface + * + */ + +static int +mat_gui_matrix_is_float() +{ + return 0; +} +static int +mat_gui_matrix_get_rows(void *obj) +{ + mat_t *self = (mat_t *) obj; + return mat_get_m(self); +} +static int +mat_gui_matrix_get_cols(void *obj) +{ + mat_t *self = (mat_t *) obj; + return mat_get_n(self); +} +static int +mat_gui_matrix_get_value(void *obj, int row, int col, double *float_val, int *int_val, char **string_val) +{ + mat_t *self = (mat_t *) obj; + fts_atom_t *val = mat_get_element(self, row, col); + + if(fts_is_float(val)) + { + *float_val = fts_get_number_float(val); + *int_val = 0; + *string_val = 0; + return 0; + } + else if(fts_is_int(val)) + { + *float_val = 0; + *int_val = fts_get_number_int(val); + *string_val = 0; + return 1; + } + else if(fts_is_symbol(val)) + { + *float_val = 0; + *int_val = 0; + *string_val = fts_symbol_name(fts_get_symbol(val)); + return 2; + } + else if(fts_is_object(val)) + { + char buff[256]; + fts_object_t *obj = fts_get_object(val); + int obj_id = fts_object_get_id(obj); + //ftm_context_t *context = ftm_context_get(obj); + fts_symbol_t name = fts_s_empty_string; + int len; + + /*if(context != NULL) + name = ftm_context_get_name(obj->context);*/ + + if(name != fts_s_empty_string) + snprintf(buff, 255, "<%s[#%d]> [%s]", fts_symbol_name(fts_object_get_class_name(obj)), obj_id, fts_symbol_name(name)); + else + snprintf(buff, 255, "<%s[#%d]>", fts_symbol_name(fts_object_get_class_name(obj)), obj_id); + + len = strlen(buff); + /*buff[len] = '\0'; + buff[len+1] = '\0';*/ + + *float_val = 0; + *int_val = 0; + strcpy(*string_val, buff); + return 3; + } + return -1; +} +static void +mat_gui_matrix_set_float(void *obj, int row, int col, double value) +{ + mat_t *self = (mat_t *) obj; + fts_atom_t a; + fts_set_float(&a, value); + mat_set_element(self, row, col, &a); +} +static void +mat_gui_matrix_set_int(void *obj, int row, int col, int value) +{ + mat_t *self = (mat_t *) obj; + fts_atom_t a; + fts_set_int(&a, value); + mat_set_element(self, row, col, &a); +} +static void +mat_gui_matrix_set_string(void *obj, int row, int col, const char *value) +{ + mat_t *self = (mat_t *) obj; + fts_atom_t a; + fts_set_symbol(&a, fts_new_symbol(value)); + mat_set_element(self, row, col, &a); +} /******************************************************************** * * class @@ -2503,6 +2606,18 @@ mat_gui_interface_score->setPitch = mat_gui_score_set_pitch; fts_class_gui_interface(cl, fts_s_score, mat_gui_interface_score); + + mat_gui_interface_matrix = (imtr_guiInterfaceMatrix *)fts_malloc(sizeof(imtr_guiInterfaceMatrix)); + ((imtr_guiInterface *)mat_gui_interface_matrix)->name = fts_symbol_name(fts_s_matrix); + mat_gui_interface_matrix->isFloat = mat_gui_matrix_is_float; + mat_gui_interface_matrix->getRows = mat_gui_matrix_get_rows; + mat_gui_interface_matrix->getCols = mat_gui_matrix_get_cols; + mat_gui_interface_matrix->getValue = mat_gui_matrix_get_value; + mat_gui_interface_matrix->setFloat = mat_gui_matrix_set_float; + mat_gui_interface_matrix->setInt = mat_gui_matrix_set_int; + mat_gui_interface_matrix->setString = mat_gui_matrix_set_string; + + fts_class_gui_interface(cl, fts_s_matrix, mat_gui_interface_matrix); } FTS_MODULE_INIT(mat) Modified: trunk/ftm/ftmlib/classes/sequence.c =================================================================== --- trunk/ftm/ftmlib/classes/sequence.c 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/ftmlib/classes/sequence.c 2008-07-24 10:29:43 UTC (rev 1833) @@ -2509,7 +2509,7 @@ sequence_remove_event((sequence_t *)obj, (event_t *)marker); } static void -sequence_gui_markers_set_label(void *obj, void *marker, int index, char *label) +sequence_gui_markers_set_label(void *obj, void *marker, int index, const char *label) { fts_atom_t k; fts_set_symbol(&k, fts_new_symbol(label)); Modified: trunk/ftm/ftmlib/predefsymbols.h =================================================================== --- trunk/ftm/ftmlib/predefsymbols.h 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/ftmlib/predefsymbols.h 2008-07-24 10:29:43 UTC (rev 1833) @@ -391,6 +391,7 @@ PREDEF_SYMBOL( fts_s_layout, "layout"); PREDEF_SYMBOL( fts_s_lines, "lines"); PREDEF_SYMBOL( fts_s_lock, "lock"); +PREDEF_SYMBOL( fts_s_matrix, "matrix"); PREDEF_SYMBOL( fts_s_opacity, "opacity"); PREDEF_SYMBOL( fts_s_peaks, "peaks"); PREDEF_SYMBOL( fts_s_points, "points"); Modified: trunk/ftm/gui/Juce/c_gui/guiinterfaces.h =================================================================== --- trunk/ftm/gui/Juce/c_gui/guiinterfaces.h 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/gui/Juce/c_gui/guiinterfaces.h 2008-07-24 10:29:43 UTC (rev 1833) @@ -432,7 +432,7 @@ * @param the label * @ingroup guiinterfaces */ -typedef void (*imtr_gui_interface_markers_set_label_t)(void *obj, void *marker, int index, char *label); +typedef void (*imtr_gui_interface_markers_set_label_t)(void *obj, void *marker, int index, const char *label); /** * @brief sets the cue to given marker * @param obj the markers track object @@ -614,4 +614,95 @@ } imtr_guiInterfaceScore; /** @} Score gui interface */ + +/*********************************************************** + * + * Matrix GUI interface + * + */ + +/** @name Matrix gui interface + * @{ */ +/** + * @brief returns true if the matrix object is a float matrix + * @return 1 if matriw is a float matrix, 0 otherwise + * @ingroup guiinterfaces + */ +typedef int (*imtr_gui_interface_matrix_is_float_t)(void); + +/** + * @brief returns the number of rows + * @param obj the matrix object + * @return number of rows + * @ingroup guiinterfaces + */ +typedef int (*imtr_gui_interface_matrix_get_rows_t)(void *obj); + +/** + * @brief returns the number of cols + * @param obj the matrix object + * @return number of columns + * @ingroup guiinterfaces + */ +typedef int (*imtr_gui_interface_matrix_get_cols_t)(void *obj); + +/** + * @brief returns the value at given position + * @param obj the matrix object + * @param row the row + * @param col the col + * @param double_int return int value (if the value is int) + * @param double_value return double value (if the value is double) + * @param string_value return char* value (if the value is char*) + * @ingroup guiinterfaces + */ +typedef int (*imtr_gui_interface_matrix_get_value_t)(void *obj, int row, int col, double *double_value, int *int_value, char **string_value); + +/** + * @brief set double value at given position + * @param obj the matrix object + * @param row the row + * @param col the col + * @param value the new value + * @ingroup guiinterfaces + */ +typedef void (*imtr_gui_interface_matrix_set_float_t)(void *obj, int row, int col, double value); +/** + * @brief set int value at given position + * @param obj the matrix object + * @param row the row + * @param col the col + * @param value the new value + * @ingroup guiinterfaces + */ +typedef void (*imtr_gui_interface_matrix_set_int_t)(void *obj, int row, int col, int value); +/** + * @brief set char* value at given position + * @param obj the matrix object + * @param row the row + * @param col the col + * @param value the new value + * @ingroup guiinterfaces + */ +typedef void (*imtr_gui_interface_matrix_set_string_t)(void *obj, int row, int col, const char *value); + +/** + * @brief score gui interface + * @ingroup guiinterfaces + */ +typedef struct _imtrGuiInterfaceMatrix + { + imtr_guiInterface head; + + imtr_gui_interface_matrix_is_float_t isFloat; + imtr_gui_interface_matrix_get_rows_t getRows; + imtr_gui_interface_matrix_get_cols_t getCols; + imtr_gui_interface_matrix_get_value_t getValue; + imtr_gui_interface_matrix_set_float_t setFloat; + imtr_gui_interface_matrix_set_int_t setInt; + imtr_gui_interface_matrix_set_string_t setString; + + } imtr_guiInterfaceMatrix; +/** @} Score gui interface */ + #endif Modified: trunk/ftm/gui/Juce/common/BpfEditor.cpp =================================================================== --- trunk/ftm/gui/Juce/common/BpfEditor.cpp 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/gui/Juce/common/BpfEditor.cpp 2008-07-24 10:29:43 UTC (rev 1833) @@ -274,7 +274,6 @@ g.drawLine(bounds.getWidth()-2, 0, bounds.getWidth()-2, getHeight()); g.setColour(lightColour); g.drawLine(bounds.getWidth()-1, 0, bounds.getWidth()-1, getHeight()); - } else { Modified: trunk/ftm/gui/Juce/common/EditorContainer.cpp =================================================================== --- trunk/ftm/gui/Juce/common/EditorContainer.cpp 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/gui/Juce/common/EditorContainer.cpp 2008-07-24 10:29:43 UTC (rev 1833) @@ -584,6 +584,9 @@ else if(interface_name == JUCE_EDITOR_NAMESPACE::String("score")) editor = createScoreEditor((void *)obj, (imtr_guiInterfaceScore *)guiInterface, this, listener); + else + if(interface_name == JUCE_EDITOR_NAMESPACE::String("matrix")) + editor = createMatrixEditor((void *)obj, (imtr_guiInterfaceMatrix *)guiInterface, this, listener); } else { Modified: trunk/ftm/gui/Juce/common/ImtrEditor.h =================================================================== --- trunk/ftm/gui/Juce/common/ImtrEditor.h 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/gui/Juce/common/ImtrEditor.h 2008-07-24 10:29:43 UTC (rev 1833) @@ -357,7 +357,7 @@ /** @} Tools interaction */ virtual void backgroundColorChanged(JUCE_EDITOR_NAMESPACE::Colour color) = 0; - virtual void disposeTableView() = 0; + virtual void disposeTableView() {}; virtual float getOriginalLength() = 0; virtual void postError(JUCE_EDITOR_NAMESPACE::String error) = 0; Modified: trunk/ftm/gui/Juce/common/MarkersTableView.cpp =================================================================== --- trunk/ftm/gui/Juce/common/MarkersTableView.cpp 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/gui/Juce/common/MarkersTableView.cpp 2008-07-24 10:29:43 UTC (rev 1833) @@ -255,12 +255,13 @@ owner.markersGui->setCue(owner.obj, evt, row, text.getIntValue()); break; case 3: - int len = text.length(); + /*int len = text.length(); char *buff = (char *)alloca(sizeof(char) * (len+1)); text.copyToBuffer(buff, len); buff[len] = '\0'; buff[len+1] = '\0'; - owner.markersGui->setLabel(owner.obj, evt, row, buff); + owner.markersGui->setLabel(owner.obj, evt, row, buff);*/ + owner.markersGui->setLabel(owner.obj, evt, row, text); break; } owner.parent->objectRefresh(); Added: trunk/ftm/gui/Juce/common/MatrixEditor.cpp =================================================================== --- trunk/ftm/gui/Juce/common/MatrixEditor.cpp (rev 0) +++ trunk/ftm/gui/Juce/common/MatrixEditor.cpp 2008-07-24 10:29:43 UTC (rev 1833) @@ -0,0 +1,611 @@ +/* + * IMTR EDITOR + * Copyright (C) 2004 by IRCAM-Centre Georges Pompidou, Paris, France. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * See file COPYING.LIB + for further informations on licensing terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +//#include "src/juce_WithoutMacros.h" +#ifdef DISABLE_JUCE_NAMESPACE +#define DONT_SET_USING_JUCE_NAMESPACE 1 +#endif +#include "juce.h" +#include "imtrjuce.h" +#include "ImtrEditor.h" + + +#define MINWIDTH 64 // minimum width and height +#define MINHEIGHT 16 +#define DEFWIDTH 256 // default width and height +#define DEFHEIGHT 128 + +#define LINES_VIEW 0 +#define PEEKS_VIEW 1 +#define STEPS_VIEW 2 + +#define float_Pi 3.14159265358979323846f +#define MARKERS_INFO_SIZE 35 + +class MatrixEditor : public JUCE_EDITOR_NAMESPACE::Component, public JUCE_EDITOR_NAMESPACE::TableListBoxModel, public ImtrEditor +{ + JUCE_EDITOR_NAMESPACE::Colour backcolor, lightColor, darkerColor, forecolor, selectColor, labelColor, selectedCellColor; + float opacity; + + imtr_guiInterfaceMatrix *matrixGui; + void *obj; + + ImtrEditorListener *listener; + EditorContainer *container; + float v_range, value_range, original_length; + float v_min, v_max; + float value_min, value_max; + + JUCE_EDITOR_NAMESPACE::TableListBox* table; + JUCE_EDITOR_NAMESPACE::Font font; + + /*-------- offscreen -------*/ + JUCE_EDITOR_NAMESPACE::Image *infoImage; + + int lastClickedCol; + bool activateSelectedCell; + +public: + MatrixEditor(void *obj, imtr_guiInterfaceMatrix *matrixGui, EditorContainer *container, ImtrEditorListener *listener) : font (12.0f), listener(listener), container(container), obj(obj), matrixGui(matrixGui) + { + setInterceptsMouseClicks(true, true); + setWantsKeyboardFocus(true); + setMouseClickGrabsKeyboardFocus(true); + setFocusContainer(true); + + backcolor = container->getBackgroundColor(); + lightColor = container->getBackgroundColor().brighter(0.2f); + darkerColor = container->getBackgroundColor().darker(0.2f); + forecolor = JUCE_EDITOR_NAMESPACE::Colours::black; + selectColor = JUCE_EDITOR_NAMESPACE::Colour::contrasting(backcolor, forecolor); + labelColor = forecolor.withAlpha(0.4f); + selectedCellColor = JUCE_EDITOR_NAMESPACE::Colour::contrasting(JUCE_EDITOR_NAMESPACE::Colours::lightblue, JUCE_EDITOR_NAMESPACE::Colours::black); + opacity = container->getOpacity(); + + /* time range */ + original_length = 0; + /* values in fmat */ + value_min = -20.0f; + value_max = 20.0f; + value_range = value_max - value_min; + /* fmat index */ + v_min = 0.0f; + v_max = 1.0f; + v_range = v_max-v_min; + + infoImage = NULL; + + description = JUCE_EDITOR_NAMESPACE::String("matrix"); + + // Create our table component and add it to this component.. + table = new JUCE_EDITOR_NAMESPACE::TableListBox ("matrix", this); + + // give it a border + table->setColour (JUCE_EDITOR_NAMESPACE::ListBox::outlineColourId, JUCE_EDITOR_NAMESPACE::Colours::grey); + table->setOutlineThickness (1); + //table->setOpaque(true); + + initColumns(); + + addAndMakeVisible(table); + + (dynamic_cast <JUCE_EDITOR_NAMESPACE::Component *>(table))->addMouseListener(dynamic_cast <JUCE_EDITOR_NAMESPACE::MouseListener*> (this), true); + + lastClickedCol = -1; + activateSelectedCell = false; + } + + ~MatrixEditor() + { + } + + void initColumns() + { + table->getHeader()->removeAllColumns(); + + // Add some columns to the table header, based on the column list in our database.. + int flags = (JUCE_EDITOR_NAMESPACE::TableHeaderComponent::visible | JUCE_EDITOR_NAMESPACE::TableHeaderComponent::resizable); + for(int i=0; i < matrixGui->getCols(obj); i++) + table->getHeader()->addColumn(JUCE_EDITOR_NAMESPACE::String(i), i, 200, 50, 400, flags); + + // we could now change some initial settings.. + table->getHeader()->setSortColumnId (1, true); // sort forwards by the ID column + // un-comment this line to have a go of stretch-to-fit mode + table->getHeader()->setStretchToFitActive (true); + table->setHeaderHeight(15); + } + + void mouseDown(const JUCE_EDITOR_NAMESPACE::MouseEvent& e) + { + const JUCE_EDITOR_NAMESPACE::MouseEvent& ev = e.getEventRelativeTo(table); + int row = table->getRowContainingPosition(ev.getMouseDownX(), ev.getMouseDownY()); + + if(row == -1) + lastClickedCol = -1; + else + { + lastClickedCol = table->getHeader()->getColumnIdAtX(ev.getMouseDownX()); + } + table->selectRow(row); + table->repaint(); + //listener->postError(JUCE_EDITOR_NAMESPACE::String(row)); + } + /////////////////////////// Info Image + void drawInfoBackground(JUCE_EDITOR_NAMESPACE::Graphics& g) + { + JUCE_EDITOR_NAMESPACE::Rectangle bounds = g.getClipBounds(); + + g.fillAll(backcolor); + + g.setColour(darkerColor); + if(!container->isVertical()) + { + g.drawLine(bounds.getWidth()-2, 0, bounds.getWidth()-2, bounds.getHeight()); + g.setColour(lightColor); + g.drawLine(bounds.getWidth()-1, 0, bounds.getWidth()-1, bounds.getHeight()); + } + else + { + g.drawLine(0, bounds.getHeight()-2, bounds.getWidth(), bounds.getHeight()-2); + g.setColour(lightColor); + g.drawLine(0, bounds.getHeight()-1, bounds.getWidth(), bounds.getHeight()-1); + } + } + void createAndDrawInfoBackground() + { + if(infoImage != NULL) + delete infoImage; + + if(container->isVertical()) + infoImage = new JUCE_EDITOR_NAMESPACE::Image(JUCE_EDITOR_NAMESPACE::Image::ARGB, getWidth(), MARKERS_INFO_SIZE, true); + else + infoImage = new JUCE_EDITOR_NAMESPACE::Image(JUCE_EDITOR_NAMESPACE::Image::ARGB, MARKERS_INFO_SIZE, getHeight(), true); + + JUCE_EDITOR_NAMESPACE::Graphics info_g (*infoImage); + drawInfoBackground(info_g); + } + + //////////////////////////////////////////////////////////////////////////////////////// + int getNumRows() + { + return matrixGui->getRows(obj); + } + + // This is overloaded from TableListBoxModel, and should fill in the background of the whole row + void paintRowBackground (JUCE_EDITOR_NAMESPACE::Graphics& g, int rowNumber, int width, int height, bool rowIsSelected) + { + if (rowIsSelected) + { + g.fillAll (JUCE_EDITOR_NAMESPACE::Colours::lightblue); + + if(lastClickedCol != -1) + { + JUCE_EDITOR_NAMESPACE::Rectangle bounds = table->getHeader()->getColumnPosition(lastClickedCol); + g.setColour(selectedCellColor); + g.fillRect(bounds.getX(), bounds.getY(), bounds.getWidth(), height); + } + } + } + + void paintCell (JUCE_EDITOR_NAMESPACE::Graphics& g, + int rowNumber, + int columnId, + int width, int height, + bool rowIsSelected) {} + + JUCE_EDITOR_NAMESPACE::Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected, + JUCE_EDITOR_NAMESPACE::Component* existingComponentToUpdate) + { + JUCE_EDITOR_NAMESPACE::String text; + MatrixComponent *label = (MatrixComponent*) existingComponentToUpdate; + + if (label == NULL) + label = new MatrixComponent(*this, rowNumber, columnId); + else + label->setRowAndCol(rowNumber, columnId); + + /*work around to select a selected cell with a return key pressed; in returnKeyPressed updateContent methos is called; + this method call a refreshComponentFor Cell in for every cell; here we test if this cell correspond to the selected cell; + if yes we activate the editor*/ + if(activateSelectedCell && isRowSelected && columnId == lastClickedCol) + { + label->showEditor(); + activateSelectedCell = false; + } + return label; + } + + void returnKeyPressed(int lastRowSelected) + { + if(lastClickedCol >= 0) + { + activateSelectedCell = true; + table->updateContent(); + } + } + /****************************** + Key Listener + *****************************/ + bool keyPressed(const JUCE_EDITOR_NAMESPACE::KeyPress& key) + { + int code = key.getKeyCode(); + + if(code == JUCE_EDITOR_NAMESPACE::KeyPress::leftKey) + { + if(lastClickedCol > 0) + { + lastClickedCol--; + table->repaint(); + } + return true; + } + else if(code == JUCE_EDITOR_NAMESPACE::KeyPress::rightKey) + { + if(lastClickedCol < matrixGui->getCols(obj)-1) + { + lastClickedCol++; + table->repaint(); + } + return true; + } + return false; + } + bool keyStateChanged(){return false;} + + void resized() + { + table->setBoundsInset (JUCE_EDITOR_NAMESPACE::BorderSize(1)); + } + + /************************* + ImtrEditor + **************************/ + void *getObject() + { + return obj; + } + + imtr_guiInterface *getInterface() + { + return (imtr_guiInterface *)matrixGui; + } + + void postError(JUCE_EDITOR_NAMESPACE::String error) + { + container->postError(error); + } + + void objectRefresh() + { + //redraw_offscreen = true; + container->repaint(); + } + + void objectChanged() + { + if(matrixGui->getCols(obj) != table->getHeader()->getNumColumns(false)) + initColumns(); + table->updateContent(); + } + + void layoutChanged(){} + + void setBackgroundColor(JUCE_EDITOR_NAMESPACE::Colour bcolor) + { + backcolor = bcolor; + darkerColor = backcolor.darker(0.2f); + selectColor = JUCE_EDITOR_NAMESPACE::Colour::contrasting(backcolor, forecolor); + lightColor = backcolor.brighter(0.2f); + } + + void backgroundColorChanged(JUCE_EDITOR_NAMESPACE::Colour bcolor){ setBackgroundColor(bcolor);} + + void setForegroundColor(JUCE_EDITOR_NAMESPACE::Colour fcolor) + { + forecolor = fcolor; + selectColor = JUCE_EDITOR_NAMESPACE::Colour::contrasting(backcolor, forecolor); + labelColor = forecolor.withAlpha(0.4f); + } + + JUCE_EDITOR_NAMESPACE::Colour getForegroundColor() + { + return forecolor; + } + + JUCE_EDITOR_NAMESPACE::Colour getBackgroundColor() + { + return backcolor; + } + + void setOpacity(float alpha) + { + opacity = alpha; + } + + void setForemost(bool isForemost) + { + if(isForemost) + setOpacity(container->getOpacity()); + else + { + disposeTableView(); + setOpacity(0.0f); + } + } + + float getOriginalLength() + { + return original_length; + } + void setTool(JUCE_EDITOR_NAMESPACE::MouseListener *tool){} + void openPopupMenu(){} + void addToLocation(int x, int y, bool isShiftDown){} + void commandAltInteraction(int x, int y, bool isShiftDown){} + void startDragging(int x, int y, int w, int h, bool isShiftDown){} + bool isSelecting(){ return false;} + bool isSelectingRegion(){return false;} + bool isMovingSelection(){ return false;} + void setSelectingRegion(bool isSelectingRegion){} + void setSelectionRect(int x, int y, int w, int h){} + void dragSelection(int x, int y, int dx, int dy){} + void endSelecting(){} + void endSelectingRegion(){} + void endMovingSelection(){} + + /************************ + Coordinates conversion + ***********************/ + int editorGetX(double x) + { + if(!container->isVertical()) + { + float dx = getWidth()/container->getHLength(); + return (int)((x+container->getHTransposition())*dx*container->getHZoom()); + } + else + { + float value = x - v_min; + float width = getWidth(); + float dx = width/v_range; + return (int)(value*dx); + } + } + int editorGetY(double y) + { + if(!container->isVertical()) + { + float value = y - v_min; + float height = getHeight(); + float dy = height/v_range; + return (int)(value*dy); + } + else + { + float dy = getHeight()/container->getHLength(); + return (int)((y+container->getHTransposition())*dy*container->getHZoom()); + } + } + double editorGetInvX(float x) + { + if(!container->isVertical()) + { + float dx = getWidth()/container->getHLength(); + return (x/dx)/container->getHZoom() - container->getHTransposition(); + } + else + { + float width = getWidth(); + float dx = width/v_range; + return (x/dx + v_min); + } + } + double editorGetInvY(float y) + { + if(!container->isVertical()) + { + float height = getHeight(); + float dy = height/v_range; + return (y/dy + v_min); + } + else + { + float dy = (getHeight()/container->getHLength()); + return (y/dy)/container->getHZoom() - container->getHTransposition(); + } + } + bool haveInfoPanel() {return true;} + JUCE_EDITOR_NAMESPACE::Image *getInfoImage() + { + if(infoImage == NULL) createAndDrawInfoBackground(); + return infoImage; + } + + class MatrixComponent: public JUCE_EDITOR_NAMESPACE::Component, public JUCE_EDITOR_NAMESPACE::LabelListener + { + public: + MatrixComponent (MatrixEditor& owner_, int col, int row) + : owner (owner_), column(col), row(row) + { + JUCE_EDITOR_NAMESPACE::String text; + double floatVal; + int intVal; + char *stringVal = (char *)alloca(sizeof(char) * 256); + int type = -1; + + type = owner.matrixGui->getValue(owner.obj, row, column, &floatVal, &intVal, &stringVal); + + switch(type) + { + case 0: + text = JUCE_EDITOR_NAMESPACE::String(floatVal); + break; + case 1: + text = JUCE_EDITOR_NAMESPACE::String(intVal); + break; + case 2: + text = JUCE_EDITOR_NAMESPACE::String(stringVal); + break; + case 3: + text = JUCE_EDITOR_NAMESPACE::String(stringVal); + break; + } + + addAndMakeVisible (label = new JUCE_EDITOR_NAMESPACE::Label ("matrix label", text)); + + label->setEditable(false, true, true); + label->addListener(this); + } + + ~MatrixComponent(){} + + void showEditor() + { + label->showEditor(); + } + + void setRowAndCol(int r, int c) + { + JUCE_EDITOR_NAMESPACE::String text; + double floatVal; + int intVal; + char *stringVal = (char *)alloca(sizeof(char) * 256); + int type = -1; + + row = r; + column = c; + + type = owner.matrixGui->getValue(owner.obj, row, column, &floatVal, &intVal, &stringVal); + + switch(type) + { + case 0: + text = JUCE_EDITOR_NAMESPACE::String(floatVal); + break; + case 1: + text = JUCE_EDITOR_NAMESPACE::String(intVal); + break; + case 2: + text = JUCE_EDITOR_NAMESPACE::String(stringVal); + break; + case 3: + text = JUCE_EDITOR_NAMESPACE::String(stringVal); + label->setColour(JUCE_EDITOR_NAMESPACE::Label::backgroundColourId, JUCE_EDITOR_NAMESPACE::Colours::lightgrey.withAlpha(0.5f)); + label->setColour(JUCE_EDITOR_NAMESPACE::Label::outlineColourId, JUCE_EDITOR_NAMESPACE::Colours::grey); + break; + } + + label->setText(text, false); + label->setEditable(false, true, true); + label->addListener(this); + } + void resized() + { + label->setBoundsInset(JUCE_EDITOR_NAMESPACE::BorderSize (1)); + } + + bool stringIsInt(JUCE_EDITOR_NAMESPACE::String text) + { + for(int i=0; i < text.length(); i++) + if(!JUCE_EDITOR_NAMESPACE::CharacterFunctions::isDigit(text[i])) return false; + return true; + } + + bool stringIsFloat(JUCE_EDITOR_NAMESPACE::String text) + { + for(int i=0; i < text.length(); i++) + if(!JUCE_EDITOR_NAMESPACE::CharacterFunctions::isDigit(text[i]) && text[i] != '.') return false; + return true; + } + + bool stringIsObject(JUCE_EDITOR_NAMESPACE::String text) + { + return false;//for the moment... + } + + int getStringType(JUCE_EDITOR_NAMESPACE::String text) + { + if(stringIsInt(text)) + return 1; + else if(stringIsFloat(text)) + return 0; + else if(stringIsObject(text)) + return 3; + else return 2; + } + + void labelTextChanged(JUCE_EDITOR_NAMESPACE::Label *label) + { + JUCE_EDITOR_NAMESPACE::String text = label->getText(); + + if(owner.matrixGui->isFloat()) + { + JUCE_TRY + { + float val = text.getFloatValue(); + owner.matrixGui->setFloat(owner.obj, row, column, val); + } + catch(const std::exception& e) + { + owner.listener->postError(JUCE_EDITOR_NAMESPACE::String("Error: is not a float")); + } + } + else + { + int type = getStringType(text); + + JUCE_TRY + { + switch(type) + { + case 0: + owner.matrixGui->setFloat(owner.obj, row, column, text.getFloatValue()); + break; + case 1: + owner.matrixGui->setInt(owner.obj, row, column, text.getIntValue()); + break; + case 2: + owner.matrixGui->setString(owner.obj, row, column, text); + break; + case 3: + //owner.matrixGui->setObject(owner.obj, row, column, text); + break; + } + } + catch(const std::exception& e) + { + owner.listener->postError(JUCE_EDITOR_NAMESPACE::String("Error: is not a float")); + } + } + } + + private: + MatrixEditor& owner; + JUCE_EDITOR_NAMESPACE::Label* label; + int row, column; + }; +}; + +JUCE_EDITOR_NAMESPACE::Component *createMatrixEditor(void *obj, imtr_guiInterfaceMatrix *matrixGui, EditorContainer *container, ImtrEditorListener *listener) +{ + return new MatrixEditor(obj, matrixGui, container, listener); +} \ No newline at end of file Property changes on: trunk/ftm/gui/Juce/common/MatrixEditor.cpp ___________________________________________________________________ Added: svn:executable + * Modified: trunk/ftm/gui/Juce/common/imtrjuce.h =================================================================== --- trunk/ftm/gui/Juce/common/imtrjuce.h 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/gui/Juce/common/imtrjuce.h 2008-07-24 10:29:43 UTC (rev 1833) @@ -53,6 +53,7 @@ JUCE_EDITOR_NAMESPACE::Component* createMarkersEditor(void *obj, imtr_guiInterfaceMarkers *markersGui, EditorContainer *container, ImtrEditorListener *listener); JUCE_EDITOR_NAMESPACE::Component* createScoreEditor(void *obj, imtr_guiInterfaceScore *scoreGui, EditorContainer *container, ImtrEditorListener *listener); JUCE_EDITOR_NAMESPACE::Component* createFvecEditor(void *obj, imtr_guiInterfaceFvec *fvecGui, EditorContainer *container, ImtrEditorListener *listener); +JUCE_EDITOR_NAMESPACE::Component* createMatrixEditor(void *obj, imtr_guiInterfaceMatrix *matrixGui, EditorContainer *container, ImtrEditorListener *listener); JUCE_EDITOR_NAMESPACE::Component* createBpfTableView(ImtrEditor *parent, void *obj, imtr_guiInterfaceBpf *bpfGui); JUCE_EDITOR_NAMESPACE::Component* createMarkersTableView(ImtrEditor *parent, void *obj, imtr_guiInterfaceMarkers *markersGui); JUCE_EDITOR_NAMESPACE::Component* createScoreTableView(ImtrEditor *parent, void *obj, imtr_guiInterfaceScore *scoreGui); Modified: trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h =================================================================== --- trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/gui/Juce/cpp_gui/guiinterfaces.h 2008-07-24 10:29:43 UTC (rev 1833) @@ -149,4 +149,25 @@ }; /** @} Score gui interface */ +/** + * @brief Matrix gui interface + * @ingroup guiinterfaces + */ +class imtr_guiInterfaceMatrix: public imtr_guiInterface + { + public: + imtr_guiInterfaceMatrix(){setName("matrix");} + virtual ~imtr_guiInterfaceMatrix() {} + + virtual int isFloat() = 0; + virtual int getRows(void *obj) = 0; + virtual int getCols(void *obj) = 0; + + virtual int getValue(void *obj, int row, int col, double *double_value, int *int_value, char **string_value) = 0; + virtual void setFloat(void *obj, int row, int col, double value) = 0; + virtual void setInt(void *obj, int row, int col, int value) = 0; + virtual void setString(void *obj, int row, int col, char *value) = 0; + }; +/** @} Matrix gui interface */ + #endif Modified: trunk/ftm/gui/Juce/examples/osx-application/Main.cpp =================================================================== --- trunk/ftm/gui/Juce/examples/osx-application/Main.cpp 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/gui/Juce/examples/osx-application/Main.cpp 2008-07-24 10:29:43 UTC (rev 1833) @@ -133,6 +133,7 @@ void outputIntegers(StringArray symbols, Array <int> values){} void outputFloats(StringArray symbols, Array <float> values){} void postError(String error){} + void doAction(String action){} /* ButtonListener interface */ void buttonClicked(Button *button) Modified: trunk/ftm/gui/Juce/examples/osx-application/juce_application.xcodeproj/project.pbxproj =================================================================== --- trunk/ftm/gui/Juce/examples/osx-application/juce_application.xcodeproj/project.pbxproj 2008-07-22 14:55:53 UTC (rev 1832) +++ trunk/ftm/gui/Juce/examples/osx-application/juce_application.xcodeproj/project.pbxproj 2008-07-24 10:29:43 UTC (rev 1833) @@ -11,6 +11,11 @@ 3B68AF010DF5899E00A07177 /* Main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B68AF000DF5899E00A07177 /* Main.cpp */; }; 3B68AF130DF58A1E00A07177 /* EditTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B68AF120DF58A1E00A07177 /* EditTool.cpp */; }; 3B8DE2400E1101E9000757BC /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B8DE23F0E1101E9000757BC /* AppKit.framework */; }; + 3BC5AD1B0E35E9FF00AAA94D /* InfoPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BC5AD170E35E9FF00AAA94D /* InfoPanel.cpp */; }; + 3BC5AD1C0E35E9FF00AAA94D /* MatrixEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BC5AD180E35E9FF00AAA94D /* MatrixEditor.cpp */; }; + 3BC5AD1D0E35E9FF00AAA94D /* ScoreEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BC5AD190E35E9FF00AAA94D /* ScoreEditor.cpp */; }; + 3BC5AD1E0E35E9FF00AAA94D /* ScoreTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BC5AD1A0E35E9FF00AAA94D /* ScoreTableView.cpp */; }; + 3BC5AD200E35EA2800AAA94D /* EditorContainerListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BC5AD1F0E35EA2800AAA94D /* EditorContainerListener.h */; }; 3BE201330DF3F5990072ED88 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BE201320DF3F5990072ED88 /* OpenGL.framework */; }; 3BE2017A0DF3F6AB0072ED88 /* BpfEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BE201600DF3F6AB0072ED88 /* BpfEditor.cpp */; }; 3BE2017C0DF3F6AB0072ED88 /* BpfTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BE201620DF3F6AB0072ED88 /* BpfTableView.cpp */; }; @@ -37,6 +42,11 @@ 3B68AF000DF5899E00A07177 /* Main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Main.cpp; sourceTree = SOURCE_ROOT; }; 3B68AF120DF58A1E00A07177 /* EditTool.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = EditTool.cpp; sourceTree = "<group>"; }; 3B8DE23F0E1101E9000757BC /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; + 3BC5AD170E35E9FF00AAA94D /* InfoPanel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InfoPanel.cpp; sourceTree = "<group>"; }; + 3BC5AD180E35E9FF00AAA94D /* MatrixEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MatrixEditor.cpp; sourceTree = "<group>"; }; + 3BC5AD190E35E9FF00AAA94D /* ScoreEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScoreEditor.cpp; sourceTree = "<group>"; }; + 3BC5AD1A0E35E9FF00AAA94D /* ScoreTableView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScoreTableView.cpp; sourceTree = "<group>"; }; + 3BC5AD1F0E35EA2800AAA94D /* EditorContainerListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorContainerListener.h; sourceTree = "<group>"; }; 3BE201320DF3F5990072ED88 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; 3BE201600DF3F6AB0072ED88 /* BpfEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BpfEditor.cpp; sourceTree = "<group>"; }; 3BE201620DF3F6AB0072ED88 /* BpfTableView.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BpfTableView.cpp; sourceTree = "<group>"; }; @@ -115,6 +125,7 @@ 3BE201630DF3F6AB0072ED88 /* CursorTool.cpp */, 3BE201640DF3F6AB0072ED88 /* EditorContainer.cpp */, 3BE201650DF3F6AB0072ED88 /* EditorContainer.h */, + 3BC5AD1F0E35EA2800AAA94D /* EditorContainerListener.h */, 3BE201660DF3F6AB0072ED88 /* EditorResizerBar.cpp */, 3BE201670DF3F6AB0072ED88 /* EditorResizerBar.h */, 3BE201680DF3F6AB0072ED88 /* EditorScrollBar.cpp */, @@ -125,9 +136,13 @@ 3BE2016E0DF3F6AB0072ED88 /* ImtrEditor.h */, 3BE2016F0DF3F6AB0072ED88 /* ImtrEditorListener.h */, 3BE201700DF3F6AB0072ED88 /* imtrjuce.h */, + 3BC5AD170E35E9FF00AAA94D /* InfoPanel.cpp */, 3BE201730DF3F6AB0072ED88 /* MarkersEditor.cpp */, 3BE201740DF3F6AB0072ED88 /* MarkersTableView.cpp */, + 3BC5AD180E35E9FF00AAA94D /* MatrixEditor.cpp */, 3BE201750DF3F6AB0072ED88 /* RegionTool.cpp */, + 3BC5AD190E35E9FF00AAA94D /* ScoreEditor.cpp */, + 3BC5AD1A0E35E9FF00AAA94D /* ScoreTableView.cpp */, 3BE201760DF3F6AB0072ED88 /* ScrollZoomListener.h */, 3BE201770DF3F6AB0072ED88 /* ScrollZoomTool.cpp */, 3BE201780DF3F6AB0072ED88 /* SpectrogramEditor.cpp */, @@ -169,6 +184,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 3BC5AD200E35EA2800AAA94D /* EditorContainerListener.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -240,6 +256,10 @@ 3BE201880DF3F6AB0072ED88 /* SpectrogramEditor.cpp in Sources */, 3B68AF010DF5899E00A07177 /* Main.cpp in Sources */, 3B68AF130DF58A1E00A07177 /* EditTool.cpp in Sources */, + 3BC5AD1B0E35E9FF00AAA94D /* InfoPanel.cpp in Sources */, + 3BC5AD1C0E35E9FF00AAA94D /* MatrixEditor.cpp in Sources */, + 3BC5AD1D0E35E9FF00AAA94D /* ScoreEditor.cpp in Sources */, + 3BC5AD1E0E35E9FF00AAA94D /* ScoreTableView.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -256,7 +276,10 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ../../../../components/juce; + HEADER_SEARCH_PATHS = ( + ../../common, + ../../../../components/juce, + ); INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |