annotate transform/CSVFeatureWriter.h @ 1174:0ad516dc5d8d

Presume that the Vamp SDK exists at the directory next door
author Chris Cannam
date Fri, 18 Mar 2016 13:42:54 +0000
parents 870acd589a38
children c01cbe41aeb5
rev   line source
Chris@498 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@498 2
Chris@498 3 /*
Chris@498 4 Sonic Visualiser
Chris@498 5 An audio file viewer and annotation editor.
Chris@498 6
Chris@498 7 Sonic Annotator
Chris@498 8 A utility for batch feature extraction from audio files.
Chris@498 9
Chris@498 10 Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London.
Chris@498 11 Copyright 2007-2008 QMUL.
Chris@498 12
Chris@498 13 This program is free software; you can redistribute it and/or
Chris@498 14 modify it under the terms of the GNU General Public License as
Chris@498 15 published by the Free Software Foundation; either version 2 of the
Chris@498 16 License, or (at your option) any later version. See the file
Chris@498 17 COPYING included with this distribution for more information.
Chris@498 18 */
Chris@498 19
Chris@498 20 #ifndef _CSV_FEATURE_WRITER_H_
Chris@498 21 #define _CSV_FEATURE_WRITER_H_
Chris@498 22
Chris@498 23 #include <string>
Chris@498 24 #include <map>
Chris@498 25 #include <set>
Chris@498 26
Chris@498 27 #include <QString>
Chris@498 28
Chris@498 29 #include "FileFeatureWriter.h"
Chris@498 30
Chris@498 31 using std::string;
Chris@498 32 using std::map;
Chris@498 33
Chris@498 34 class QTextStream;
Chris@498 35 class QFile;
Chris@498 36
Chris@498 37 class CSVFeatureWriter : public FileFeatureWriter
Chris@498 38 {
Chris@498 39 public:
Chris@498 40 CSVFeatureWriter();
Chris@498 41 virtual ~CSVFeatureWriter();
Chris@498 42
Chris@998 43 virtual string getDescription() const;
Chris@998 44
Chris@498 45 virtual ParameterList getSupportedParameters() const;
Chris@498 46 virtual void setParameters(map<string, string> &params);
Chris@498 47
Chris@498 48 virtual void write(QString trackid,
Chris@498 49 const Transform &transform,
Chris@498 50 const Vamp::Plugin::OutputDescriptor &output,
Chris@498 51 const Vamp::Plugin::FeatureList &features,
Chris@498 52 std::string summaryType = "");
Chris@498 53
Chris@1001 54 virtual void finish();
Chris@1001 55
Chris@604 56 virtual QString getWriterTag() const { return "csv"; }
Chris@498 57
Chris@498 58 private:
Chris@498 59 QString m_separator;
Chris@669 60 bool m_sampleTiming;
Chris@1000 61 bool m_endTimes;
Chris@1001 62 bool m_forceEnd;
Chris@1002 63 bool m_omitFilename;
Chris@514 64 QString m_prevPrintedTrackId;
Chris@1001 65
Chris@1006 66 typedef pair<QString, Transform> DataId; // track id, transform
Chris@1006 67 typedef map<DataId, Vamp::Plugin::Feature> PendingFeatures;
Chris@1006 68 typedef map<DataId, std::string> PendingSummaryTypes;
Chris@1001 69 PendingFeatures m_pending;
Chris@1001 70 PendingSummaryTypes m_pendingSummaryTypes;
Chris@1001 71
Chris@1006 72 void writeFeature(DataId,
Chris@1001 73 QTextStream &,
Chris@1001 74 const Vamp::Plugin::Feature &f,
Chris@1001 75 const Vamp::Plugin::Feature *optionalNextFeature,
Chris@1001 76 std::string summaryType);
Chris@1142 77
Chris@1142 78 int m_digits;
Chris@498 79 };
Chris@498 80
Chris@498 81 #endif