Mercurial > hg > silvet
comparison src/Silvet.cpp @ 110:e282930cfca7
Add draft/intensive mode setting (determines whether to use shifts)
author | Chris Cannam |
---|---|
date | Tue, 06 May 2014 18:55:11 +0100 |
parents | 9c7e6086192d |
children | 2169e7a448c5 |
comparison
equal
deleted
inserted
replaced
109:e236bf47ed51 | 110:e282930cfca7 |
---|---|
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 { |
394 sum += filtered[i][j]; | 416 sum += filtered[i][j]; |
395 } | 417 } |
396 | 418 |
397 if (sum < 1e-5) continue; | 419 if (sum < 1e-5) continue; |
398 | 420 |
399 EM em; | 421 EM em(m_hqMode); |
400 for (int j = 0; j < iterations; ++j) { | 422 for (int j = 0; j < iterations; ++j) { |
401 em.iterate(filtered[i]); | 423 em.iterate(filtered[i]); |
402 } | 424 } |
403 | 425 |
404 vector<double> pitches = em.getPitchDistribution(); | 426 vector<double> pitches = em.getPitchDistribution(); |