cannam@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ cannam@0: /* cannam@0: Vamp feature extraction plugin using the MATCH audio alignment cannam@0: algorithm. cannam@0: cannam@0: Centre for Digital Music, Queen Mary, University of London. cannam@0: This file copyright 2007 Simon Dixon, Chris Cannam and QMUL. cannam@0: cannam@0: This program is free software; you can redistribute it and/or cannam@0: modify it under the terms of the GNU General Public License as cannam@0: published by the Free Software Foundation; either version 2 of the cannam@0: License, or (at your option) any later version. See the file cannam@0: COPYING included with this distribution for more information. cannam@0: */ cannam@0: Chris@24: #ifndef _MATCH_FEATURE_FEEDER_H_ Chris@24: #define _MATCH_FEATURE_FEEDER_H_ cannam@0: cannam@0: #include "Matcher.h" cannam@0: #include "Finder.h" cannam@0: cannam@0: #include Chris@14: #include cannam@0: Chris@24: class MatchFeatureFeeder cannam@0: { cannam@0: public: Chris@24: MatchFeatureFeeder(Matcher *m1, Matcher *m2); Chris@24: ~MatchFeatureFeeder(); cannam@0: Chris@14: /** Chris@24: * Feed the two supplied feature vectors to feeders 1 and 2 Chris@24: * respectively (depending on their advance status). Matchers must Chris@24: * have been constructed using the external featureSize Chris@24: * constructor. Chris@60: * Chris@60: * f1 and f2 are normally expected to have the same number of Chris@60: * values, and that number should be the featureSize passed to the Chris@60: * constructors for both Matchers. The exception is when one input Chris@60: * ends before the other one: subsequent calls should pass a Chris@60: * feature vector as normal for the input that is still going on, Chris@60: * and an empty vector for the one that has ended. Chris@14: */ Chris@24: void feed(std::vector f1, std::vector f2); Chris@14: Chris@63: /** Chris@167: * Get the best estimate for the frame in the reference (f1) Chris@167: * corresponding to the latest frame in the other input (f2). Chris@167: */ Chris@167: int getEstimatedReferenceFrame(); Chris@167: Chris@167: /** Chris@63: * Indicate that both inputs have come to an end. Chris@63: */ Chris@63: void finish(); Chris@135: Chris@135: /** Chris@135: * Return the forward path, that is, the estimate of the Chris@135: * lowest-cost path that was generated (possibly in real-time) Chris@135: * while initially tracking the inputs. This is the path that is Chris@135: * used to determine the shape of the search zone within which the Chris@135: * eventual reverse path will be sought by the Finder. Chris@135: */ Chris@135: void retrieveForwardPath(std::vector &pathx, std::vector &pathy) { Chris@135: pathx = m_fpx; Chris@135: pathy = m_fpy; Chris@135: } Chris@135: Chris@167: Finder *getFinder() { return &m_finder; } cannam@0: cannam@0: protected: Chris@24: void feedBlock(); Chris@24: void feed1(); Chris@24: void feed2(); cannam@0: Chris@147: Matcher *m_pm1; // I do not own this Chris@147: Matcher *m_pm2; // I do not own this cannam@0: Chris@167: Finder m_finder; // I own this, and it refers to m_pm1 Chris@167: Chris@74: std::queue > m_q1; Chris@74: std::queue > m_q2; Chris@135: Chris@135: vector m_fpx; Chris@135: vector m_fpy; Chris@171: Chris@171: // not provided: Chris@171: MatchFeatureFeeder(const MatchFeatureFeeder &other); Chris@171: MatchFeatureFeeder &operator=(const MatchFeatureFeeder &other); cannam@0: }; cannam@0: cannam@0: #endif