comparison transform/FeatureExtractionModelTransformer.cpp @ 891:8962f80f5d8e tony_integration

Merge from default branch
author Chris Cannam
date Tue, 11 Mar 2014 17:32:31 +0000
parents 4cbf8c6a462d 7f97a4d9d14f
children c3656035240f
comparison
equal deleted inserted replaced
890:4cbf8c6a462d 891:8962f80f5d8e
276 //!!! SV doesn't actually support display of models that have 276 //!!! SV doesn't actually support display of models that have
277 //!!! different underlying rates together -- so we always set 277 //!!! different underlying rates together -- so we always set
278 //!!! the model rate to be the input model's rate, and adjust 278 //!!! the model rate to be the input model's rate, and adjust
279 //!!! the resolution appropriately. We can't properly display 279 //!!! the resolution appropriately. We can't properly display
280 //!!! data with a higher resolution than the base model at all 280 //!!! data with a higher resolution than the base model at all
281 // modelRate = size_t(m_descriptors[n]->sampleRate + 0.001);
282 if (m_descriptors[n]->sampleRate > input->getSampleRate()) { 281 if (m_descriptors[n]->sampleRate > input->getSampleRate()) {
283 modelResolution = 1; 282 modelResolution = 1;
284 } else { 283 } else {
285 modelResolution = size_t(input->getSampleRate() / 284 modelResolution = size_t(round(input->getSampleRate() /
286 m_descriptors[n]->sampleRate); 285 m_descriptors[n]->sampleRate));
287 } 286 }
288 break; 287 break;
289 } 288 }
290 289
291 bool preDurationPlugin = (m_plugin->getVampApiVersion() < 2); 290 bool preDurationPlugin = (m_plugin->getVampApiVersion() < 2);
850 849
851 // cerr << "m_fixedRateFeatureNo = " << m_fixedRateFeatureNo 850 // cerr << "m_fixedRateFeatureNo = " << m_fixedRateFeatureNo
852 // << ", m_descriptor->sampleRate = " << m_descriptor->sampleRate 851 // << ", m_descriptor->sampleRate = " << m_descriptor->sampleRate
853 // << ", inputRate = " << inputRate 852 // << ", inputRate = " << inputRate
854 // << " giving frame = "; 853 // << " giving frame = ";
855
856 frame = lrintf((m_fixedRateFeatureNos[n] / m_descriptors[n]->sampleRate) 854 frame = lrintf((m_fixedRateFeatureNos[n] / m_descriptors[n]->sampleRate)
857 * int(inputRate)); 855 * int(inputRate));
858 } 856 }
859 857
860 if (frame < 0) { 858 if (frame < 0) {
925 if (feature.values.size() > index) { 923 if (feature.values.size() > index) {
926 duration = feature.values[index++]; 924 duration = feature.values[index++];
927 } 925 }
928 } 926 }
929 927
930 if (isOutput<FlexiNoteModel>(n)) { // GF: added for flexi note model 928 if (isOutput<FlexiNoteModel>(n)) { // GF: added for flexi note model
931 929
932 float velocity = 100; 930 float velocity = 100;
933 if (feature.values.size() > index) { 931 if (feature.values.size() > index) {
934 velocity = feature.values[index++]; 932 velocity = feature.values[index++];
935 } 933 }
993 991
994 EditableDenseThreeDimensionalModel *model = 992 EditableDenseThreeDimensionalModel *model =
995 getConformingOutput<EditableDenseThreeDimensionalModel>(n); 993 getConformingOutput<EditableDenseThreeDimensionalModel>(n);
996 if (!model) return; 994 if (!model) return;
997 995
998 model->setColumn(frame / model->getResolution(), values); 996 // cerr << "(note: model resolution = " << model->getResolution() << ")"
997 // << endl;
998
999 if (!feature.hasTimestamp && m_fixedRateFeatureNos[n] >= 0) {
1000 model->setColumn(m_fixedRateFeatureNos[n], values);
1001 } else {
1002 model->setColumn(frame / model->getResolution(), values);
1003 }
999 1004
1000 } else { 1005 } else {
1001 SVDEBUG << "FeatureExtractionModelTransformer::addFeature: Unknown output model type!" << endl; 1006 SVDEBUG << "FeatureExtractionModelTransformer::addFeature: Unknown output model type!" << endl;
1002 } 1007 }
1003 } 1008 }