annotate runner/LabFeatureWriter.h @ 191:4ef452f5fefc

Add (failing) test for JSON output format (fails for grid output)
author Chris Cannam
date Wed, 22 Jul 2015 14:25:14 +0100
parents 59abb58b1855
children 704a8b27f3ed
rev   line source
Chris@154 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@154 2
Chris@154 3 /*
Chris@154 4 Sonic Visualiser
Chris@154 5 An audio file viewer and annotation editor.
Chris@154 6
Chris@154 7 Sonic Annotator
Chris@154 8 A utility for batch feature extraction from audio files.
Chris@154 9
Chris@154 10 Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London.
Chris@154 11 Copyright 2007-2008 QMUL.
Chris@154 12
Chris@154 13 This program is free software; you can redistribute it and/or
Chris@154 14 modify it under the terms of the GNU General Public License as
Chris@154 15 published by the Free Software Foundation; either version 2 of the
Chris@154 16 License, or (at your option) any later version. See the file
Chris@154 17 COPYING included with this distribution for more information.
Chris@154 18 */
Chris@154 19
Chris@154 20 #ifndef _LAB_FEATURE_WRITER_H_
Chris@154 21 #define _LAB_FEATURE_WRITER_H_
Chris@154 22
Chris@154 23 #include <string>
Chris@154 24 #include <map>
Chris@154 25 #include <set>
Chris@154 26
Chris@154 27 #include <QString>
Chris@154 28
Chris@154 29 #include "transform/FileFeatureWriter.h"
Chris@154 30
Chris@154 31 using std::string;
Chris@154 32 using std::map;
Chris@154 33
Chris@154 34 class QTextStream;
Chris@154 35 class QFile;
Chris@154 36
Chris@154 37 class LabFeatureWriter : public FileFeatureWriter
Chris@154 38 {
Chris@154 39 public:
Chris@154 40 LabFeatureWriter();
Chris@154 41 virtual ~LabFeatureWriter();
Chris@154 42
Chris@154 43 virtual string getDescription() const;
Chris@154 44
Chris@154 45 virtual ParameterList getSupportedParameters() const;
Chris@154 46 virtual void setParameters(map<string, string> &params);
Chris@154 47
Chris@154 48 virtual void write(QString trackid,
Chris@154 49 const Transform &transform,
Chris@154 50 const Vamp::Plugin::OutputDescriptor &output,
Chris@154 51 const Vamp::Plugin::FeatureList &features,
Chris@154 52 std::string summaryType = "");
Chris@154 53
Chris@157 54 virtual void finish();
Chris@157 55
Chris@154 56 virtual QString getWriterTag() const { return "lab"; }
Chris@154 57
Chris@154 58 private:
Chris@154 59 bool m_forceEnd;
Chris@176 60
Chris@176 61 typedef pair<QString, Transform> DataId; // track id, transform
Chris@176 62 typedef map<DataId, Vamp::Plugin::Feature> PendingFeatures;
Chris@157 63 PendingFeatures m_pending;
Chris@157 64
Chris@157 65 void writeFeature(QTextStream &,
Chris@157 66 const Vamp::Plugin::Feature &f,
Chris@157 67 const Vamp::Plugin::Feature *optionalNextFeature);
Chris@154 68 };
Chris@154 69
Chris@154 70 #endif