comparison src/Silvet.cpp @ 112:2169e7a448c5 bqvec-openmp

Merge from default branch
author Chris Cannam
date Wed, 07 May 2014 09:01:32 +0100
parents ac750e222ad3 e282930cfca7
children c4eae816bdb3
comparison
equal deleted inserted replaced
111:9b299b087dd4 112:2169e7a448c5
38 static int processingNotes = 88; 38 static int processingNotes = 88;
39 39
40 Silvet::Silvet(float inputSampleRate) : 40 Silvet::Silvet(float inputSampleRate) :
41 Plugin(inputSampleRate), 41 Plugin(inputSampleRate),
42 m_resampler(0), 42 m_resampler(0),
43 m_cq(0) 43 m_cq(0),
44 m_hqMode(false)
44 { 45 {
45 } 46 }
46 47
47 Silvet::~Silvet() 48 Silvet::~Silvet()
48 { 49 {
127 128
128 Silvet::ParameterList 129 Silvet::ParameterList
129 Silvet::getParameterDescriptors() const 130 Silvet::getParameterDescriptors() const
130 { 131 {
131 ParameterList list; 132 ParameterList list;
133
134 ParameterDescriptor desc;
135 desc.identifier = "mode";
136 desc.name = "Processing mode";
137 desc.unit = "";
138 desc.description = "Determines the tradeoff of processing speed against transcription quality";
139 desc.minValue = 0;
140 desc.maxValue = 1;
141 desc.defaultValue = 0;
142 desc.isQuantized = true;
143 desc.quantizeStep = 1;
144 desc.valueNames.push_back("Draft (faster)");
145 desc.valueNames.push_back("Intensive (higher quality)");
146 list.push_back(desc);
147
132 return list; 148 return list;
133 } 149 }
134 150
135 float 151 float
136 Silvet::getParameter(string identifier) const 152 Silvet::getParameter(string identifier) const
137 { 153 {
154 if (identifier == "mode") {
155 return m_hqMode ? 1.f : 0.f;
156 }
138 return 0; 157 return 0;
139 } 158 }
140 159
141 void 160 void
142 Silvet::setParameter(string identifier, float value) 161 Silvet::setParameter(string identifier, float value)
143 { 162 {
163 if (identifier == "mode") {
164 m_hqMode = (value > 0.5);
165 }
144 } 166 }
145 167
146 Silvet::ProgramList 168 Silvet::ProgramList
147 Silvet::getPrograms() const 169 Silvet::getPrograms() const
148 { 170 {
409 sum += filtered[i + k][j]; 431 sum += filtered[i + k][j];
410 } 432 }
411 433
412 if (sum < 1e-5) continue; 434 if (sum < 1e-5) continue;
413 435
414 EM em; 436 EM em(m_hqMode);
415 for (int j = 0; j < iterations; ++j) { 437 for (int j = 0; j < iterations; ++j) {
416 em.iterate(filtered[i + k].data()); 438 em.iterate(filtered[i + k].data());
417 } 439 }
418 440
419 const double *pitches = em.getPitchDistribution(); 441 const double *pitches = em.getPitchDistribution();