comparison runner/JAMSFeatureWriter.h @ 171:c1834a31029c

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