~mixxxdevelopers/mixxx/engine-control-refactor

« back to all changes in this revision

Viewing changes to mixxx/src/vamp/vampanalyser.cpp

  • Committer: RJ Ryan
  • Date: 2013-06-04 00:41:29 UTC
  • mfrom: (2890.22.101 mixxx)
  • Revision ID: rryan@mixxx.org-20130604004129-8jjxkicsb3givu4a
MergingĀ fromĀ lp:mixxx.

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
                        const int samplerate, const int TotalSamples, bool bFastAnalysis) {
96
96
    m_iOutput = 0;
97
97
    m_rate = 0;
 
98
    m_iMaxSamplesToAnalyse = 0;
98
99
    m_iRemainingSamples = TotalSamples;
99
100
    m_rate = samplerate;
100
101
    m_iSampleCount = 0;
141
142
        qDebug() << "Please copy libmixxxminimal.so from build dir to one of the following:";
142
143
 
143
144
        std::vector<std::string> path = PluginHostAdapter::getPluginPath();
144
 
        for (int i = 0; i < path.size(); i++) {
 
145
        for (unsigned int i = 0; i < path.size(); i++) {
145
146
            qDebug() << QString::fromStdString(path[i]);
146
147
        }
147
148
        return false;
180
181
        qDebug() << "VampAnalyser: Cannot initialise plugin";
181
182
        return false;
182
183
    }
183
 
 
184
184
    // Here we are using m_iBlockSize: it cannot be 0
185
185
    m_pluginbuf[0] = new CSAMPLE[m_iBlockSize];
186
186
    m_pluginbuf[1] = new CSAMPLE[m_iBlockSize];
187
 
 
188
187
    m_FastAnalysisEnabled = bFastAnalysis;
189
188
    if (m_FastAnalysisEnabled) {
190
189
        qDebug() << "Using fast analysis methods for BPM and Replay Gain.";
191
190
        m_iMaxSamplesToAnalyse = 120 * m_rate; //only consider the first minute
192
 
    } else {
193
 
        // Analyse 10 minutes otherwise. If track is longer than 10 min do not
194
 
        // care. It might be some recorded mix.
195
 
        m_iMaxSamplesToAnalyse = 1200 * m_rate;
196
191
    }
197
 
 
198
192
    return true;
199
193
}
200
194
 
278
272
                m_iOUT++;
279
273
            }
280
274
 
281
 
            // If a track has a duration of more than 10minutes do not analyse
282
 
            // more. It may be a recorded mix.
283
 
            if (m_iSampleCount >= m_iMaxSamplesToAnalyse) {
 
275
            // If a track has a duration of more than our set limit, do not
 
276
            // analyse more.
 
277
            if (m_iMaxSamplesToAnalyse > 0 && m_iSampleCount >= m_iMaxSamplesToAnalyse) {
284
278
                m_bDoNotAnalyseMoreSamples = true;
285
279
                m_iRemainingSamples = 0;
286
280
            }
307
301
}
308
302
 
309
303
bool VampAnalyser::SetParameter(const QString parameter, const double value) {
 
304
    Q_UNUSED(parameter);
 
305
    Q_UNUSED(value);
310
306
    return true;
311
307
}
312
308
 
313
 
void VampAnalyser::SelectOutput(int outputnumber) {
 
309
void VampAnalyser::SelectOutput(const int outputnumber) {
314
310
    Plugin::OutputList outputs = m_plugin->getOutputDescriptors();
315
 
    if (outputnumber >= 0 && outputnumber < outputs.size()) {
 
311
    if (outputnumber >= 0 && outputnumber < int(outputs.size())) {
316
312
        m_iOutput = outputnumber;
317
313
    }
318
314
}