Chris@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: /* Chris@0: Sonic Annotator Chris@0: A utility for batch feature extraction from audio files. Chris@0: Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London. Chris@0: Copyright 2007-2008 QMUL. Chris@0: Chris@0: This program is free software; you can redistribute it and/or Chris@0: modify it under the terms of the GNU General Public License as Chris@0: published by the Free Software Foundation; either version 2 of the Chris@0: License, or (at your option) any later version. See the file Chris@0: COPYING included with this distribution for more information. Chris@0: */ Chris@0: Chris@0: #include Chris@0: #include Chris@0: Chris@0: using namespace std; Chris@0: Chris@0: #include "DefaultFeatureWriter.h" Chris@0: Chris@0: void DefaultFeatureWriter::write(QString trackid, Chris@0: const Transform &transform, Chris@0: const Vamp::Plugin::OutputDescriptor& output, Chris@0: const Vamp::Plugin::FeatureList& featureList, Chris@0: std::string summaryType) Chris@0: { Chris@0: // generic XML output Chris@0: Chris@0: /* Chris@0: Chris@0: Chris@0: output.name Chris@0: feature.timestamp Chris@0: output.binName[0]:feature.value[0]... Chris@0: Chris@0: Chris@0: Chris@0: */ Chris@0: Chris@0: for (int i = 0; i < featureList.size(); ++i) Chris@0: { Chris@0: if (summaryType == "") { Chris@0: cout << "" << endl; Chris@0: } else { Chris@0: cout << "" << endl; Chris@0: } Chris@0: cout << "\t" << output.name << "" << endl; Chris@0: if (featureList[i].hasTimestamp) { Chris@0: cout << "\t" << featureList[i].timestamp << "" << endl; Chris@0: } Chris@0: if (featureList[i].hasDuration) { Chris@0: cout << "\t" << featureList[i].duration << "" << endl; Chris@0: } Chris@0: if (featureList[i].values.size() > 0) Chris@0: { Chris@0: cout << "\t"; Chris@0: for (int j = 0; j < featureList[i].values.size(); ++j) Chris@0: { Chris@0: if (j > 0) Chris@0: cout << " "; Chris@0: if (output.binNames.size() > 0) Chris@0: cout << output.binNames[j] << ":"; Chris@0: cout << featureList[i].values[j]; Chris@0: } Chris@0: cout << "" << endl; Chris@0: } Chris@0: if (featureList[i].label.length() > 0) Chris@0: cout << "\t" << endl; Chris@0: if (summaryType == "") { Chris@0: cout << "" << endl; Chris@0: } else { Chris@0: cout << "" << endl; Chris@0: } Chris@0: } Chris@0: }