From: <bor...@us...> - 2020-07-17 15:54:52
|
Revision: 3745 http://sourceforge.net/p/ftm/code/3745 Author: borghesi Date: 2020-07-17 15:54:50 +0000 (Fri, 17 Jul 2020) Log Message: ----------- ftm.editor update Modified Paths: -------------- trunk/ftm/ftmlib/classes/ftmdatagui.c Modified: trunk/ftm/ftmlib/classes/ftmdatagui.c =================================================================== --- trunk/ftm/ftmlib/classes/ftmdatagui.c 2020-07-17 15:53:32 UTC (rev 3744) +++ trunk/ftm/ftmlib/classes/ftmdatagui.c 2020-07-17 15:54:50 UTC (rev 3745) @@ -692,6 +692,8 @@ ((imtr_guiInterface *)&bpf_gui_interface_matrix)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&bpf_gui_interface_matrix)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&bpf_gui_interface_matrix)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&bpf_gui_interface_matrix)->getRing = fts_get_ring; + ((imtr_guiInterface *)&bpf_gui_interface_matrix)->setRingOffset = fts_set_ring_offset; bpf_gui_interface_matrix.getMatrixConfig = bpf_gui_matrix_get_matrix_config; bpf_gui_interface_matrix.getRows = bpf_gui_matrix_get_rows; @@ -956,6 +958,8 @@ ((imtr_guiInterface *)&dict_gui_interface_matrix)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&dict_gui_interface_matrix)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&dict_gui_interface_matrix)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&dict_gui_interface_matrix)->getRing = fts_get_ring; + ((imtr_guiInterface *)&dict_gui_interface_matrix)->setRingOffset = fts_set_ring_offset; dict_gui_interface_matrix.getMatrixConfig = dict_gui_matrix_get_matrix_config; dict_gui_interface_matrix.getRows = dict_gui_matrix_get_rows; @@ -1412,6 +1416,8 @@ ((imtr_guiInterface *)&mat_gui_interface_markers)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&mat_gui_interface_markers)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&mat_gui_interface_markers)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&mat_gui_interface_markers)->getRing = fts_get_ring; + ((imtr_guiInterface *)&mat_gui_interface_markers)->setRingOffset = fts_set_ring_offset; mat_gui_interface_markers.isVector = mat_gui_markers_is_vector; mat_gui_interface_markers.getSize = mat_gui_markers_get_size; @@ -1485,6 +1491,14 @@ return duration; } +static void +mat_gui_interface_score_get_column_indexes(void *obj, void *context, const char *colorColName, int *colorColIndex) +{ + mat_t *self = (mat_t *)obj; + fts_schema_t *colschema = mat_get_schema(self, 2); + if(colschema != NULL && fts_schema_get_size(colschema) > 0) + *colorColIndex = fts_schema_get_index(colschema, fts_new_symbol(colorColName)); +} static void * mat_gui_score_get_by_index(void *obj, void *context, int index, double *time, double *pitch, double *duration, double *color, int colorColumnIndex) @@ -1522,6 +1536,147 @@ return NULL; } +static void +mat_gui_score_get_minmax_by_column(void *obj, void *context, double *min, double *max, int columnIndex) +{ + mat_t *self = (mat_t *)obj; + int m = mat_get_m(self); + int n = mat_get_n(self); + double vmax = InitMax; + double vmin = InitMin; + + if(m > 0 && n > 0 && columnIndex < n) + { + mat_lock(self); + int i; + fts_atom_t *val; + float value; + for(i = 0; i < m; i ++) + { + val = mat_get_element(self, i, columnIndex); + if(fts_is_number(val)) + { + value = fts_get_number_float(val); + if(value > vmax) vmax = value; + if(value < vmin) vmin = value; + } + } + } + *max = vmax; + *min = vmin; +} + +static void +mat_gui_score_get_two_minmax_by_column(void *obj, void *context, double *min1, double *max1, double *min2, double *max2, int columnIndex) +{ + mat_t *self = (mat_t *)obj; + int m = mat_get_m(self); + int n = mat_get_n(self); + double vmax1 = 0.0; + double vmin1 = 0.0; + double vmax2 = 0.0; + double vmin2 = 0.0; + + if(m > 0 && n > 0 && columnIndex < n) + { + int i; + fts_atom_t *val; + float value; + + + vmax2 = InitMax; + vmax1 = vmax2; + vmin2 = InitMin; + vmin1 = vmin2; + + mat_lock(self); + + for(i = 0; i < m; i ++) + { + val = mat_get_element(self, i, columnIndex); + if(fts_is_number(val)) + { + value = fts_get_number_float(val); + if(notInfNorNaN(value)) + { + if(value > vmax2) vmax2 = value; + if(value < vmin2) vmin2 = value; + } + } + } + for(i = 0; i < m; i ++) + { + val = mat_get_element(self, i, columnIndex); + if(fts_is_number(val)) + { + value = fts_get_number_float(val); + if(notInfNorNaN(value)) + { + if(value > vmax1 && value < vmax2) vmax1 = value; + if(value < vmin1 && value > vmin2) vmin1 = value; + } + } + } + } + + *max1 = vmax1; + *min1 = vmin1; + *max2 = vmax2; + *min2 = vmin2; +} + +static void +mat_gui_score_get_mean_stddev_by_column(void *obj, void *context, double *mean, double *stddev, int columnIndex) +{ + mat_t *self = (mat_t *)obj; + int m = mat_get_m(self); + int n = mat_get_n(self); + + double vmean = 0.0; + double vstddev = 0.0; + + if(m > 0 && n > 0 && columnIndex < n) + { + double meanOfSquare = 0.0; + double squareOfmean = 0.0; + double norm = 1.0 / (double)m; + int i; + fts_atom_t *val; + float value; + + for(i = 0; i < m; i ++) + { + val = mat_get_element(self, i, columnIndex); + if(fts_is_number(val)) + { + value = fts_get_number_float(val); + if(notInfNorNaN(value)) + { + vmean += value; + meanOfSquare += value * value; + } + } + } + + vmean *= norm; + meanOfSquare *= norm; + squareOfmean = vmean * vmean; + + if(meanOfSquare > squareOfmean) + vstddev = sqrt(meanOfSquare - squareOfmean); + } + + *mean = vmean; + *stddev = vstddev; +} + +static int +mat_gui_score_get_max_num_params(void *obj, void *context) +{ + mat_t *self = (mat_t *)obj; + return self->n; +} + static void * mat_gui_score_add(void *obj, void *context, double time, double pitch, double duration, int *ret_index) { @@ -1676,10 +1831,13 @@ ((imtr_guiInterface *)&mat_gui_interface_score)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&mat_gui_interface_score)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&mat_gui_interface_score)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&mat_gui_interface_score)->getRing = fts_get_ring; + ((imtr_guiInterface *)&mat_gui_interface_score)->setRingOffset = fts_set_ring_offset; mat_gui_interface_score.isVector = mat_gui_score_is_vector; mat_gui_interface_score.getSize = mat_gui_score_get_size; mat_gui_interface_score.getDuration = mat_gui_score_get_duration; + mat_gui_interface_score.getColumnIndexes = mat_gui_interface_score_get_column_indexes; mat_gui_interface_score.move = mat_gui_score_move; mat_gui_interface_score.setDuration = mat_gui_score_set_duration; mat_gui_interface_score.remove = mat_gui_score_remove; @@ -1689,6 +1847,10 @@ mat_gui_interface_score.getPrevious = NULL; mat_gui_interface_score.getValues = NULL; mat_gui_interface_score.getByIndex = mat_gui_score_get_by_index; + mat_gui_interface_score.getMinMaxByColumn = mat_gui_score_get_minmax_by_column; + mat_gui_interface_score.getTwoMinMaxByColumn = mat_gui_score_get_two_minmax_by_column; + mat_gui_interface_score.getMeanStdDevByColumn = mat_gui_score_get_mean_stddev_by_column; + mat_gui_interface_score.getMaxNumParams = mat_gui_score_get_max_num_params; mat_gui_interface_score.setPitch = mat_gui_score_set_pitch; fts_class_instantiate(mat_class); @@ -1930,6 +2092,8 @@ ((imtr_guiInterface *)&mat_gui_interface_matrix)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&mat_gui_interface_matrix)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&mat_gui_interface_matrix)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&mat_gui_interface_matrix)->getRing = fts_get_ring; + ((imtr_guiInterface *)&mat_gui_interface_matrix)->setRingOffset = fts_set_ring_offset; mat_gui_interface_matrix.getMatrixConfig = mat_gui_matrix_get_matrix_config; mat_gui_interface_matrix.getRows = mat_gui_matrix_get_rows; @@ -2521,6 +2685,12 @@ return 1; } +static int +fmat_gui_sonogram_is_timetagged(void *obj, void *context) +{ + return 0; +} + static void fmat_gui_sonogram_get_min_max(void *obj, void *context, int rangeStartIndex, int rangeSize, double *min, double *max) { @@ -2659,6 +2829,8 @@ ((imtr_guiInterface *)&fmat_gui_interface_sonogram)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&fmat_gui_interface_sonogram)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&fmat_gui_interface_sonogram)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&fmat_gui_interface_sonogram)->getRing = fts_get_ring; + ((imtr_guiInterface *)&fmat_gui_interface_sonogram)->setRingOffset = fts_set_ring_offset; fmat_gui_interface_sonogram.getLength = fmat_gui_sonogram_get_length; fmat_gui_interface_sonogram.getSpectrumSize = fmat_gui_sonogram_get_spectrum_size; @@ -2666,6 +2838,7 @@ fmat_gui_interface_sonogram.getValues = fmat_gui_sonogram_get_values; fmat_gui_interface_sonogram.releaseValues = fmat_gui_sonogram_release_values; fmat_gui_interface_sonogram.isVector = fmat_gui_sonogram_is_vector; + fmat_gui_interface_sonogram.isTimeTagged = fmat_gui_sonogram_is_timetagged; fmat_gui_interface_sonogram.getMinMax = fmat_gui_sonogram_get_min_max; fmat_gui_interface_sonogram.getTwoMinMax = fmat_gui_sonogram_get_two_min_max; fmat_gui_interface_sonogram.getMeanStdDev = fmat_gui_sonogram_get_mean_stddev; @@ -2718,6 +2891,18 @@ return self->m; } +static int +fmat_gui_traces_get_max_num_params(void *obj, void *context) +{ + fmat_t *self = (fmat_t *)obj; + int maxNumParams = 0; + fmat_lock(self); + maxNumParams = fmat_get_n(self); + fmat_unlock(self); + + return maxNumParams; +} + static void fmat_gui_traces_get_column_indexes(void *obj, void *context, const char *valueColName, const char *colorColName, const char *thicknessColName, int *valueColIndex, int *colorColIndex, int *thicknessColIndex, int *indexColIndex, void **readHash, void **writeHash) @@ -2810,6 +2995,34 @@ *max = color_max; } +static void +fmat_gui_traces_get_minmax_by_column(void *obj, void *context, double *min, double *max, int columnIndex) +{ + fmat_t *self = (fmat_t *)obj; + float vmin = InitMax; + float vmax = InitMin; + + if(columnIndex >= 0 && self->n > columnIndex) + { + float *ptr = fmat_lock(self); + int stride = fmat_get_n(self); + float value; + int i; + + vmin = ptr[columnIndex]; + vmax = ptr[columnIndex]; + for(i = 0; i < self->m; i ++) + { + value = ptr[(i)*stride + columnIndex]; + if(value < vmin) vmin = value; + if(value > vmax) vmax = value; + } + fmat_unlock(self); + } + *min = vmin; + *max = vmax; +} + static double fmat_gui_traces_get_duration(void *obj, void *context) { @@ -2967,10 +3180,13 @@ ((imtr_guiInterface *)&fmat_gui_interface_traces)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&fmat_gui_interface_traces)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&fmat_gui_interface_traces)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&fmat_gui_interface_traces)->getRing = fts_get_ring; + ((imtr_guiInterface *)&fmat_gui_interface_traces)->setRingOffset = fts_set_ring_offset; fmat_gui_interface_traces.isVector = fmat_gui_traces_is_vector; fmat_gui_interface_traces.isTimeTagged = fmat_gui_traces_is_time_tagged; fmat_gui_interface_traces.getLength = fmat_gui_traces_get_length; + fmat_gui_interface_traces.getMaxNumParams = fmat_gui_traces_get_max_num_params; fmat_gui_interface_traces.getTracesNum = fmat_gui_traces_get_traces_num; fmat_gui_interface_traces.getColumnIndexes = fmat_gui_traces_get_column_indexes; fmat_gui_interface_traces.getValueRange = fmat_gui_traces_get_value_range; @@ -2981,6 +3197,7 @@ fmat_gui_interface_traces.setTrace = fmat_gui_traces_set_trace; fmat_gui_interface_traces.getPointer = fmat_gui_traces_get_ptr; fmat_gui_interface_traces.releasePointer = fmat_gui_traces_release_ptr; + fmat_gui_interface_traces.getMinMaxByColumn = fmat_gui_traces_get_minmax_by_column; fmat_gui_interface_traces.getByTime = NULL; fmat_gui_interface_traces.getFirst = NULL; fmat_gui_interface_traces.getNext = NULL; @@ -3166,6 +3383,8 @@ ((imtr_guiInterface *)&fmat_gui_interface_pixels)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&fmat_gui_interface_pixels)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&fmat_gui_interface_pixels)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&fmat_gui_interface_pixels)->getRing = fts_get_ring; + ((imtr_guiInterface *)&fmat_gui_interface_pixels)->setRingOffset = fts_set_ring_offset; fmat_gui_interface_pixels.getLength = fmat_gui_pixels_get_length; fmat_gui_interface_pixels.getSize = fmat_gui_pixels_get_size; @@ -3735,6 +3954,8 @@ ((imtr_guiInterface *)&fmat_gui_interface_matrix)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&fmat_gui_interface_matrix)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&fmat_gui_interface_matrix)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&fmat_gui_interface_matrix)->getRing = fts_get_ring; + ((imtr_guiInterface *)&fmat_gui_interface_matrix)->setRingOffset = fts_set_ring_offset; fmat_gui_interface_matrix.getMatrixConfig = fmat_gui_matrix_get_matrix_config; fmat_gui_interface_matrix.getRows = fmat_gui_matrix_get_rows; @@ -3901,6 +4122,22 @@ fts_object_changed((fts_object_t *)self->fmat); } +static float +fvec_gui_wave_get(void *obj, void *context, int onset, int index) +{ + fvec_t *self = (fvec_t *)obj; + float *ptr; + int size, stride; + float value = 0.0; + + fvec_vector_lock(self, &ptr, &size, &stride); + + if(index < size) + value = ptr[index*stride]; + + return value; +} + static void fvec_gui_wave_shift_data(void *obj, void *context, int onset, int index, int shiftSize) { @@ -3940,7 +4177,23 @@ fts_object_changed((fts_object_t *)self->fmat); } +static void +fvec_gui_wave_append(void *obj, void *context, int onset, int num, double startValue, double endValue) +{ + fvec_t *self = (fvec_t *)obj; + int i; + float *ptr; + int size, stride; + + fvec_vector_lock(self, &ptr, &size, &stride); + + //if(mubuTrack_append(track, num) > 0) + // fvec_gui_wave_interpolate(obj, context, onset, oldSize, size+num, startValue, endValue); + + fvec_unlock(self); +} + static void fvec_gui_fvec_install(void) { @@ -3966,8 +4219,10 @@ fvec_gui_interface_fvec.interpolate = fvec_gui_wave_interpolate; fvec_gui_interface_fvec.increment = fvec_gui_wave_increment; fvec_gui_interface_fvec.set = fvec_gui_wave_set; + fvec_gui_interface_fvec.get = fvec_gui_wave_get; fvec_gui_interface_fvec.shiftData = fvec_gui_wave_shift_data; fvec_gui_interface_fvec.deleteInterval = fvec_gui_wave_delete_interval; + fvec_gui_interface_fvec.append = fvec_gui_wave_append; fts_class_instantiate(fvec_class); fts_class_gui_interface(fvec_class, fts_s_fvec, &fvec_gui_interface_fvec); @@ -3994,11 +4249,14 @@ fvec_gui_interface_wave.getPointer = fvec_gui_wave_get_ptr; fvec_gui_interface_wave.releasePointer = fvec_gui_wave_release_ptr; fvec_gui_interface_wave.getMinMaxMean = fvec_gui_wave_get_min_max_mean; + fvec_gui_interface_wave.getTwoMinMax = fvec_gui_wave_get_two_min_max; fvec_gui_interface_wave.interpolate = fvec_gui_wave_interpolate; fvec_gui_interface_wave.increment = fvec_gui_wave_increment; fvec_gui_interface_wave.set = fvec_gui_wave_set; + fvec_gui_interface_wave.get = fvec_gui_wave_get; fvec_gui_interface_wave.shiftData = fvec_gui_wave_shift_data; fvec_gui_interface_wave.deleteInterval = fvec_gui_wave_delete_interval; + fvec_gui_interface_wave.append = fvec_gui_wave_append; fts_class_instantiate(fvec_class); fts_class_gui_interface(fvec_class, fts_s_wave, &fvec_gui_interface_wave); @@ -4102,6 +4360,8 @@ ((imtr_guiInterface *)&fvec_gui_interface_matrix)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&fvec_gui_interface_matrix)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&fvec_gui_interface_matrix)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&fvec_gui_interface_matrix)->getRing = fts_get_ring; + ((imtr_guiInterface *)&fvec_gui_interface_matrix)->setRingOffset = fts_set_ring_offset; fvec_gui_interface_matrix.getMatrixConfig = fvec_gui_matrix_get_matrix_config; fvec_gui_interface_matrix.getRows = fvec_gui_matrix_get_rows; @@ -5087,6 +5347,8 @@ ((imtr_guiInterface *)&sequence_gui_interface_markers)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&sequence_gui_interface_markers)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&sequence_gui_interface_markers)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&sequence_gui_interface_markers)->getRing = fts_get_ring; + ((imtr_guiInterface *)&sequence_gui_interface_markers)->setRingOffset = fts_set_ring_offset; sequence_gui_interface_markers.isVector = sequence_gui_markers_is_vector; sequence_gui_interface_markers.getSize = sequence_gui_markers_get_size; @@ -5139,6 +5401,12 @@ return sequence_get_total_duration((sequence_t *)obj); } +static void +sequence_gui_interface_score_get_column_indexes(void *obj, void *context, const char *colorColName, int *colorColIndex) +{ + *colorColIndex = -1; +} + static void * sequence_gui_score_get_first(void *obj, void *context, double *time, double *pitch, double *duration) { @@ -5371,6 +5639,30 @@ sequence_unlock(sequence); } +static int +sequence_gui_score_get_max_num_params(void *obj, void *context) +{ + return 0; +} + +static void +sequence_gui_score_get_minmax_by_column(void *obj, void *context, double *min, double *max, int columnIndex) +{ + *min = *max = 0; +} + +static void +sequence_gui_score_get_two_minmax_by_column(void *obj, void *context, double *min1, double *max1, double *min2, double *max2, int columnIndex) +{ + *min1 = *max1 = *min2 = *max2 = 0; +} + +static void +sequence_gui_score_get_mean_stddev_by_column(void *obj, void *context, double *mean, double *stddev, int columnIndex) +{ + *mean = 0.0; + *stddev = 0.5; +} static void sequence_gui_score_set_pitch(void *obj, void *context, void *evt, int index, double pitch) { @@ -5397,10 +5689,13 @@ ((imtr_guiInterface *)&sequence_gui_interface_score)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&sequence_gui_interface_score)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&sequence_gui_interface_score)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&sequence_gui_interface_score)->getRing = fts_get_ring; + ((imtr_guiInterface *)&sequence_gui_interface_score)->setRingOffset = fts_set_ring_offset; sequence_gui_interface_score.isVector = sequence_gui_score_is_vector; sequence_gui_interface_score.getSize = sequence_gui_score_get_size; sequence_gui_interface_score.getDuration = sequence_gui_score_get_duration; + sequence_gui_interface_score.getColumnIndexes = sequence_gui_interface_score_get_column_indexes; sequence_gui_interface_score.move = sequence_gui_score_move; sequence_gui_interface_score.setDuration = sequence_gui_score_set_duration; sequence_gui_interface_score.remove = sequence_gui_score_remove; @@ -5410,6 +5705,10 @@ sequence_gui_interface_score.getPrevious = sequence_gui_score_get_previous; sequence_gui_interface_score.getValues = sequence_gui_score_get_values; sequence_gui_interface_score.getByIndex = sequence_gui_score_get_by_index; + sequence_gui_interface_score.getMinMaxByColumn = sequence_gui_score_get_minmax_by_column; + sequence_gui_interface_score.getTwoMinMaxByColumn = sequence_gui_score_get_two_minmax_by_column; + sequence_gui_interface_score.getMeanStdDevByColumn = sequence_gui_score_get_mean_stddev_by_column; + sequence_gui_interface_score.getMaxNumParams = sequence_gui_score_get_max_num_params; sequence_gui_interface_score.setPitch = sequence_gui_score_set_pitch; fts_class_instantiate(sequence_class); @@ -5935,7 +6234,10 @@ ((imtr_guiInterface *)&sequence_gui_interface_matrix)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&sequence_gui_interface_matrix)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&sequence_gui_interface_matrix)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&sequence_gui_interface_matrix)->getRing = fts_get_ring; + ((imtr_guiInterface *)&sequence_gui_interface_matrix)->setRingOffset = fts_set_ring_offset; + sequence_gui_interface_matrix.getMatrixConfig = sequence_gui_matrix_get_matrix_config; sequence_gui_interface_matrix.getRows = sequence_gui_matrix_get_rows; sequence_gui_interface_matrix.getCols = sequence_gui_matrix_get_cols; @@ -6190,6 +6492,12 @@ return 0; } +static int +sequence_gui_sonogram_is_timetagged(void *obj, void *context) +{ + return 1; +} + static void * sequence_gui_sonogram_get_first(void *obj, void *context, double *time, int *rows, int *cols, float **ptr) { @@ -6313,6 +6621,8 @@ ((imtr_guiInterface *)&sequence_gui_interface_sonogram)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&sequence_gui_interface_sonogram)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&sequence_gui_interface_sonogram)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&sequence_gui_interface_sonogram)->getRing = fts_get_ring; + ((imtr_guiInterface *)&sequence_gui_interface_sonogram)->setRingOffset = fts_set_ring_offset; sequence_gui_interface_sonogram.getLength = sequence_gui_sonogram_get_length; sequence_gui_interface_sonogram.getSpectrumSize = sequence_gui_sonogram_get_spectrum_size; @@ -6323,6 +6633,7 @@ sequence_gui_interface_sonogram.getValues = NULL; sequence_gui_interface_sonogram.releaseValues = NULL; sequence_gui_interface_sonogram.isVector = sequence_gui_sonogram_is_vector; + sequence_gui_interface_sonogram.isTimeTagged = sequence_gui_sonogram_is_timetagged; sequence_gui_interface_sonogram.getFirst = sequence_gui_sonogram_get_first; sequence_gui_interface_sonogram.getByTime = sequence_gui_sonogram_get_by_time; sequence_gui_interface_sonogram.getNext = sequence_gui_sonogram_get_next; @@ -6452,6 +6763,45 @@ *max = color_max; } +static void +sequence_gui_traces_get_thickness_range(void *obj, void *context, int thicknessColumnIndex, double *min, double *max) +{ + sequence_t *sequence = (sequence_t *)obj; + float thick_min = 0.0; + float thick_max = 1.0; + + sequence_lock_read(sequence); + + if(sequence_get_type(sequence) == fmat_class) + { + fmat_t *trace = NULL; + event_t *evt = sequence_get_first(sequence); + float thickness; + if(evt != NULL && event_get_value(evt) != NULL) + trace = (fmat_t *)fts_get_object(event_get_value(evt)); + if(trace != NULL && trace->n > 2) + { + thick_min = (trace->n > 1) ? fmat_get_element(trace, 0, 2) : 0.0; + thick_max = (trace->n > 1) ? fmat_get_element(trace, 0, 2) : 1.0; + } + while(evt != NULL) + { + if(evt != NULL && event_get_value(evt) != NULL) + trace = (fmat_t *)fts_get_object(event_get_value(evt)); + if(trace != NULL && trace->n > 2) + { + thickness = fmat_get_element(trace, 0, 2); + if(thickness < thick_min) thick_min = thickness; + if(thickness > thick_max) thick_max = thickness; + } + evt = event_get_next(evt); + } + } + sequence_unlock(sequence); + + *min = thick_min; + *max = thick_max; +} static double sequence_gui_traces_get_duration(void *obj, void *context) { @@ -6475,6 +6825,30 @@ return 1; } +static int +sequence_gui_traces_get_max_num_params(void *obj, void *context) +{ + sequence_t *sequence = (sequence_t *)obj; + int maxNumParams = 0; + + sequence_lock_read(sequence); + + if(sequence_get_type(sequence) == fmat_class) + { + fmat_t *trace = NULL; + event_t *evt = sequence_get_first(sequence); + if(evt != NULL && event_get_value(evt) != NULL) + { + trace = (fmat_t *)fts_get_object(event_get_value(evt)); + if(trace != NULL) + maxNumParams = fmat_get_n(trace); + } + } + sequence_unlock(sequence); + + return maxNumParams; +} + static void sequence_gui_traces_get_column_indexes(void *obj, void *context, const char *valueColName, const char *colorColName, const char *thicknessColName, int *valueColIndex, int *colorColIndex, int *thicknessColIndex, int *indexColIndex, void **readHash, void **writeHash) @@ -6484,6 +6858,29 @@ *thicknessColIndex = 2; } +static void +sequence_gui_traces_get_minmax_by_column(void *obj, void *context, double *min, double *max, int columnIndex) +{ + switch(columnIndex) + { + default: + case 0: + { + int size = sequence_gui_traces_get_length(obj, context); + sequence_gui_traces_get_value_range(obj, context, 0, 2, 0, size, min, max); + break; + } + case 1: + { + sequence_gui_traces_get_color_range(obj, context, 1, min, max); + break; + } + case 2: + sequence_gui_traces_get_thickness_range(obj, context, 2, min, max); + break; + } +} + static void * sequence_gui_traces_get_by_time(void *obj, void *context, double the_time, double *time) { @@ -6638,10 +7035,13 @@ ((imtr_guiInterface *)&sequence_gui_interface_traces)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&sequence_gui_interface_traces)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&sequence_gui_interface_traces)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&sequence_gui_interface_traces)->getRing = fts_get_ring; + ((imtr_guiInterface *)&sequence_gui_interface_traces)->setRingOffset = fts_set_ring_offset; sequence_gui_interface_traces.isVector = sequence_gui_traces_is_vector; sequence_gui_interface_traces.isTimeTagged = sequence_gui_traces_is_time_tagged; sequence_gui_interface_traces.getTracesNum = sequence_gui_traces_get_traces_num; + sequence_gui_interface_traces.getMaxNumParams = sequence_gui_traces_get_max_num_params; sequence_gui_interface_traces.getColumnIndexes = sequence_gui_traces_get_column_indexes; sequence_gui_interface_traces.getLength = sequence_gui_traces_get_length; sequence_gui_interface_traces.getValueRange = sequence_gui_traces_get_value_range; @@ -6648,9 +7048,11 @@ sequence_gui_interface_traces.getColorRange = sequence_gui_traces_get_color_range; sequence_gui_interface_traces.getDuration = sequence_gui_traces_get_duration; sequence_gui_interface_traces.getTrace = NULL; + sequence_gui_interface_traces.getTraceTime = NULL; sequence_gui_interface_traces.setTrace = NULL; sequence_gui_interface_traces.getPointer = NULL; sequence_gui_interface_traces.releasePointer = NULL; + sequence_gui_interface_traces.getMinMaxByColumn = sequence_gui_traces_get_minmax_by_column; sequence_gui_interface_traces.getByTime = sequence_gui_traces_get_by_time; sequence_gui_interface_traces.getFirst = sequence_gui_traces_get_first; sequence_gui_interface_traces.getNext = sequence_gui_traces_get_next; @@ -6657,6 +7059,8 @@ sequence_gui_interface_traces.getPrev = sequence_gui_traces_get_prev; sequence_gui_interface_traces.getTraceValues = sequence_gui_traces_get_trace_values; sequence_gui_interface_traces.setTraceValues = sequence_gui_traces_set_trace_values; + sequence_gui_interface_traces.clearHashtable = NULL; + sequence_gui_interface_traces.releaseHashtable = NULL; fts_class_instantiate(sequence_class); fts_class_gui_interface(sequence_class, fts_s_traces, &sequence_gui_interface_traces); @@ -6971,6 +7375,12 @@ return 0; } +static int +track_gui_sonogram_is_timetagged(void *obj, void *context) +{ + return 1; +} + static void track_gui_sonogram_get_min_max(void *obj, void *context, int rangeStartIndex, int rangeSize, double *min, double *max) { @@ -7270,6 +7680,8 @@ ((imtr_guiInterface *)&track_gui_interface_sonogram)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&track_gui_interface_sonogram)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&track_gui_interface_sonogram)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&track_gui_interface_sonogram)->getRing = fts_get_ring; + ((imtr_guiInterface *)&track_gui_interface_sonogram)->setRingOffset = fts_set_ring_offset; track_gui_interface_sonogram.getLength = track_gui_sonogram_get_length; track_gui_interface_sonogram.getSpectrumSize = track_gui_sonogram_get_spectrum_size; @@ -7280,6 +7692,7 @@ track_gui_interface_sonogram.getValues = NULL; track_gui_interface_sonogram.releaseValues = NULL; track_gui_interface_sonogram.isVector = track_gui_sonogram_is_vector; + track_gui_interface_sonogram.isTimeTagged = track_gui_sonogram_is_timetagged; track_gui_interface_sonogram.getFirst = track_gui_sonogram_get_first; track_gui_interface_sonogram.getByTime = track_gui_sonogram_get_by_time; track_gui_interface_sonogram.getNext = track_gui_sonogram_get_next; @@ -7302,6 +7715,30 @@ return sequence_get_size(track_get_events((track_t *)obj)); } +static int +track_gui_traces_get_max_num_params(void *obj, void *context) +{ + sequence_t *sequence = track_get_events((track_t *)obj); + int maxNumParams = 0; + + sequence_lock_read(sequence); + + if(sequence_get_type(sequence) == fmat_class) + { + fmat_t *trace = NULL; + event_t *evt = sequence_get_first(sequence); + if(evt != NULL && event_get_value(evt) != NULL) + { + trace = (fmat_t *)fts_get_object(event_get_value(evt)); + if(trace != NULL) + maxNumParams = fmat_get_n(trace); + } + } + sequence_unlock(sequence); + + return maxNumParams; +} + static int track_gui_traces_get_traces_num(void *obj, void *context) { @@ -7399,6 +7836,46 @@ *max = color_max; } +static void +track_gui_traces_get_thickness_range(void *obj, void *context, int thicknessColumnIndex, double *min, double *max) +{ + sequence_t *sequence = track_get_events((track_t *)obj); + float thick_min = 0.0; + float thick_max = 1.0; + + sequence_lock_read(sequence); + + if(sequence_get_type(sequence) == fmat_class) + { + fmat_t *trace = NULL; + event_t *evt = sequence_get_first(sequence); + float thickness; + if(evt != NULL && event_get_value(evt) != NULL) + trace = (fmat_t *)fts_get_object(event_get_value(evt)); + if(trace != NULL && trace->n > 2) + { + thick_min = (trace->n > 1) ? fmat_get_element(trace, 0, 2) : 0.0; + thick_max = (trace->n > 1) ? fmat_get_element(trace, 0, 2) : 1.0; + } + while(evt != NULL) + { + if(evt != NULL && event_get_value(evt) != NULL) + trace = (fmat_t *)fts_get_object(event_get_value(evt)); + if(trace != NULL && trace->n > 2) + { + thickness = fmat_get_element(trace, 0, 2); + if(thickness < thick_min) thick_min = thickness; + if(thickness > thick_max) thick_max = thickness; + } + evt = event_get_next(evt); + } + } + sequence_unlock(sequence); + + *min = thick_min; + *max = thick_max; +} + static void track_gui_traces_get_column_indexes(void *obj, void *context, const char *valueColName, const char *colorColName, const char *thicknessColName, int *valueColIndex, int *colorColIndex, int *thicknessColIndex, int *indexColIndex, void **readHash, void **writeHash) @@ -7408,6 +7885,29 @@ *thicknessColIndex = 2; } +static void +track_gui_traces_get_minmax_by_column(void *obj, void *context, double *min, double *max, int columnIndex) +{ + switch(columnIndex) + { + default: + case 0: + { + int size = sequence_gui_traces_get_length(obj, context); + track_gui_traces_get_value_range(obj, context, 0, 2, 0, size, min, max); + break; + } + case 1: + { + track_gui_traces_get_color_range(obj, context, 1, min, max); + break; + } + case 2: + track_gui_traces_get_thickness_range(obj, context, 2, min, max); + break; + } +} + static double track_gui_traces_get_duration(void *obj, void *context) { @@ -7574,10 +8074,13 @@ ((imtr_guiInterface *)&track_gui_interface_traces)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&track_gui_interface_traces)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&track_gui_interface_traces)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&track_gui_interface_traces)->getRing = fts_get_ring; + ((imtr_guiInterface *)&track_gui_interface_traces)->setRingOffset = fts_set_ring_offset; track_gui_interface_traces.isVector = track_gui_traces_is_vector; track_gui_interface_traces.isTimeTagged = track_gui_traces_is_time_tagged; track_gui_interface_traces.getLength = track_gui_traces_get_length; + track_gui_interface_traces.getMaxNumParams = track_gui_traces_get_max_num_params; track_gui_interface_traces.getTracesNum = track_gui_traces_get_traces_num; track_gui_interface_traces.getColumnIndexes = track_gui_traces_get_column_indexes; track_gui_interface_traces.getValueRange = track_gui_traces_get_value_range; @@ -7584,9 +8087,11 @@ track_gui_interface_traces.getColorRange = track_gui_traces_get_color_range; track_gui_interface_traces.getDuration = track_gui_traces_get_duration; track_gui_interface_traces.getTrace = NULL; + track_gui_interface_traces.getTraceTime = NULL; track_gui_interface_traces.setTrace = NULL; track_gui_interface_traces.getPointer = NULL; track_gui_interface_traces.releasePointer = NULL; + track_gui_interface_traces.getMinMaxByColumn = track_gui_traces_get_minmax_by_column; track_gui_interface_traces.getByTime = track_gui_traces_get_by_time; track_gui_interface_traces.getFirst = track_gui_traces_get_first; track_gui_interface_traces.getNext = track_gui_traces_get_next; @@ -7593,6 +8098,8 @@ track_gui_interface_traces.getPrev = track_gui_traces_get_prev; track_gui_interface_traces.getTraceValues = track_gui_traces_get_trace_values; track_gui_interface_traces.setTraceValues = track_gui_traces_set_trace_values; + track_gui_interface_traces.clearHashtable = NULL; + track_gui_interface_traces.releaseHashtable = NULL; fts_class_instantiate(track_class); fts_class_gui_interface(track_class, fts_s_traces, &track_gui_interface_traces); @@ -7780,6 +8287,12 @@ return (void *)evt; } +static void +track_gui_interface_score_get_column_indexes(void *obj, void *context, const char *colorColName, int *colorColIndex) +{ + *colorColIndex = -1; +} + static void track_gui_score_move(void *obj, void *context, void *evt, int index, double time) { @@ -7857,10 +8370,13 @@ ((imtr_guiInterface *)&track_gui_interface_score)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&track_gui_interface_score)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&track_gui_interface_score)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&track_gui_interface_score)->getRing = fts_get_ring; + ((imtr_guiInterface *)&track_gui_interface_score)->setRingOffset = fts_set_ring_offset; track_gui_interface_score.isVector = track_gui_score_is_vector; track_gui_interface_score.getSize = track_gui_score_get_size; track_gui_interface_score.getDuration = track_gui_score_get_duration; + track_gui_interface_score.getColumnIndexes = track_gui_interface_score_get_column_indexes; track_gui_interface_score.move = track_gui_score_move; track_gui_interface_score.setDuration = track_gui_score_set_duration; track_gui_interface_score.remove = track_gui_score_remove; @@ -8580,6 +9096,8 @@ ((imtr_guiInterface *)&track_gui_interface_markers)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&track_gui_interface_markers)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&track_gui_interface_markers)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&track_gui_interface_markers)->getRing = fts_get_ring; + ((imtr_guiInterface *)&track_gui_interface_markers)->setRingOffset = fts_set_ring_offset; track_gui_interface_markers.isVector = track_gui_markers_is_vector; track_gui_interface_markers.getSize = track_gui_markers_get_size; @@ -9106,6 +9624,8 @@ ((imtr_guiInterface *)&track_gui_interface_matrix)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&track_gui_interface_matrix)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&track_gui_interface_matrix)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&track_gui_interface_matrix)->getRing = fts_get_ring; + ((imtr_guiInterface *)&track_gui_interface_matrix)->setRingOffset = fts_set_ring_offset; track_gui_interface_matrix.getMatrixConfig = track_gui_matrix_get_matrix_config; track_gui_interface_matrix.getRows = track_gui_matrix_get_rows; @@ -10183,6 +10703,9 @@ ((imtr_guiInterface *)&mat_gui_interface_scatterplot)->getNumBuffers = fts_get_num_buffers_default; ((imtr_guiInterface *)&mat_gui_interface_scatterplot)->getBufferObject = fts_get_buffer_object_default; ((imtr_guiInterface *)&mat_gui_interface_scatterplot)->getBufferIndex = fts_get_buffer_index_default; + ((imtr_guiInterface *)&mat_gui_interface_scatterplot)->getRing = fts_get_ring; + ((imtr_guiInterface *)&mat_gui_interface_scatterplot)->setRingOffset = fts_set_ring_offset; + mat_gui_interface_scatterplot.getSize = mat_gui_scatterplot_get_size; mat_gui_interface_scatterplot.getColumns = mat_gui_scatterplot_get_columns; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |