Mercurial > hg > match-vamp
diff src/MatchPipeline.h @ 105:3f46ce2d2874 feature_conditioner
Start MatchPipeline
author | Chris Cannam |
---|---|
date | Thu, 04 Dec 2014 13:35:23 +0000 |
parents | |
children | 921a88e8859d |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/MatchPipeline.h Thu Dec 04 13:35:23 2014 +0000 @@ -0,0 +1,94 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Vamp feature extraction plugin using the MATCH audio alignment + algorithm. + + Centre for Digital Music, Queen Mary, University of London. + This file copyright 2007 Simon Dixon, Chris Cannam and QMUL. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef MATCH_PIPELINE_H +#define MATCH_PIPELINE_H + +#include "Matcher.h" +#include "Finder.h" +#include "FeatureExtractor.h" +#include "FeatureConditioner.h" +#include "MatchFeatureFeeder.h" + +class MatchPipeline +{ +public: + /** + * Pipeline consisting of two Matchers, two FeatureConditioners, + * two FeatureExtractors, and a Finder. Features may be inserted + * at any point in the pipeline. + * + * The pipeline goes: + * Frequency-domain audio + * -> Features + * -> Conditioned features + * -> Matcher + */ + MatchPipeline(FeatureExtractor::Parameters feParams, + FeatureConditioner::Parameters fcParams, + Matcher::Parameters matchParams); + + ~MatchPipeline(); + + /** + * Feed in data at the first pipeline stage. The input arrays + * represent frames of audio from the two different sources. Each + * is provided as a single array of alternating real and imaginary + * components. + * + * Input arrays must have at least 2 * (feParams.fftSize/2 + 1) + * elements. The arrays will be passed to FeatureExtractor and + * then on into the rest of the pipeline. + */ + void feedFrequencyDomainAudio(const float *arr1, const float *arr2); + + /** + * Feed in data at the second pipeline stage. The vectors + * represent feature frames from two different sources. They will + * be passed in to FeatureConditioner and then on to the rest of + * the pipeline. + */ + void feedFeatures(const vector<double> &f1, const vector<double> &f2); + + /** + * Feed in data at the third pipeline stage. The vectors represent + * conditioned feature frames from two different sources. They + * will be passed to MatchFeatureFeeder for feeding to the two + * matchers. + */ + void feedConditionedFeatures(const vector<double> &f1, const vector<double> &f2); + + /** + * Indicate that both inputs have come to an end. + */ + void finish(); + + Finder *getFinder(); + +private: + FeatureExtractor m_fe1; + FeatureExtractor m_fe2; + FeatureConditioner m_fc1; + FeatureConditioner m_fc2; + Matcher m_pm1; + Matcher m_pm2; + MatchFeatureFeeder m_feeder; + int m_lastFrameIn1; + int m_lastFrameIn2; + int m_frameNo; + bool aboveThreshold(const vector<double> &f); +}; + +#endif