annotate runner/JAMSFeatureWriter.h @ 316:3cd337892a16

Update before install; seems to be necessary (based on other projects) to avoid recent Ruby-related error
author Chris Cannam
date Tue, 10 Oct 2017 13:52:12 +0100
parents c17b184c16db
children
rev   line source
Chris@145 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@145 2
Chris@145 3 /*
Chris@145 4 Sonic Annotator
Chris@145 5 A utility for batch feature extraction from audio files.
Chris@145 6
Chris@145 7 Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London.
Chris@145 8 Copyright 2007-2014 QMUL.
Chris@145 9
Chris@145 10 This program is free software; you can redistribute it and/or
Chris@145 11 modify it under the terms of the GNU General Public License as
Chris@145 12 published by the Free Software Foundation; either version 2 of the
Chris@145 13 License, or (at your option) any later version. See the file
Chris@145 14 COPYING included with this distribution for more information.
Chris@145 15 */
Chris@145 16
Chris@208 17 #ifndef JAMS_FEATURE_WRITER_H
Chris@208 18 #define JAMS_FEATURE_WRITER_H
Chris@145 19
Chris@145 20 #include "transform/FileFeatureWriter.h"
Chris@145 21
Chris@145 22 #include "rdf/PluginRDFDescription.h"
Chris@145 23
Chris@145 24 class JAMSFileWriter;
Chris@145 25
Chris@145 26 class JAMSFeatureWriter : public FileFeatureWriter
Chris@145 27 {
Chris@145 28 public:
Chris@145 29 JAMSFeatureWriter();
Chris@145 30 virtual ~JAMSFeatureWriter();
Chris@145 31
Chris@145 32 string getDescription() const;
Chris@145 33
Chris@145 34 virtual ParameterList getSupportedParameters() const;
Chris@145 35 virtual void setParameters(map<string, string> &params);
Chris@145 36
Chris@145 37 virtual void setTrackMetadata(QString trackid, TrackMetadata metadata);
Chris@145 38
Chris@169 39 virtual void setNofM(int, int);
Chris@169 40
Chris@145 41 virtual void write(QString trackid,
Chris@145 42 const Transform &transform,
Chris@145 43 const Vamp::Plugin::OutputDescriptor &output,
Chris@145 44 const Vamp::Plugin::FeatureList &features,
Chris@145 45 std::string summaryType = "");
Chris@145 46
Chris@145 47 virtual void finish();
Chris@145 48
Chris@202 49 virtual QString getWriterTag() const { return "jams"; }
Chris@145 50
Chris@145 51 private:
Chris@145 52 enum Task {
Chris@145 53 UnknownTask,
Chris@145 54 BeatTask,
Chris@145 55 OnsetTask,
Chris@145 56 ChordTask,
Chris@145 57 SegmentTask,
Chris@145 58 KeyTask,
Chris@145 59 NoteTask,
Chris@145 60 MelodyTask,
Chris@145 61 PitchTask,
Chris@145 62 };
Chris@145 63
Chris@145 64 typedef map<QString, PluginRDFDescription> RDFDescriptionMap; // by plugin id
Chris@145 65 RDFDescriptionMap m_rdfDescriptions;
Chris@145 66
Chris@167 67 typedef QString TrackId;
Chris@167 68 typedef pair<TrackId, Transform> DataId;
Chris@145 69
Chris@167 70 typedef map<TrackId, TrackMetadata> TrackMetadataMap;
Chris@167 71 TrackMetadataMap m_trackMetadata;
Chris@167 72
Chris@167 73 typedef set<TrackId> TrackIds;
Chris@167 74 typedef map<QTextStream *, TrackIds> StreamTrackMap;
Chris@167 75 StreamTrackMap m_streamTracks;
Chris@167 76
Chris@167 77 typedef set<Task> Tasks;
Chris@167 78 typedef map<QTextStream *, Tasks> StreamTaskMap;
Chris@167 79 StreamTaskMap m_streamTasks;
Chris@167 80
Chris@167 81 typedef set<DataId> DataIds;
Chris@167 82 typedef map<QTextStream *, DataIds> StreamDataMap;
Chris@167 83 StreamDataMap m_streamData;
Chris@167 84
Chris@167 85 typedef map<DataId, QString> DataMap;
Chris@152 86 DataMap m_data;
Chris@152 87
Chris@167 88 typedef map<TransformId, Task> TaskMap;
Chris@145 89 TaskMap m_tasks;
Chris@145 90
Chris@145 91 void loadRDFDescription(const Transform &);
Chris@145 92 void identifyTask(const Transform &);
Chris@145 93
Chris@145 94 QString getTaskKey(Task);
Chris@145 95
Chris@165 96 QString writeTransformToObjectContents(const Transform &);
Chris@165 97
Chris@197 98 std::string m_format;
Chris@145 99 bool m_network;
Chris@145 100 bool m_networkRetrieved;
Chris@169 101 int m_n;
Chris@169 102 int m_m;
Chris@204 103 int m_digits;
Chris@145 104 };
Chris@145 105
Chris@145 106 #endif
Chris@145 107