comparison runner/JAMSFeatureWriter.h @ 145:3921e0c1f4dd jams

Start to sketch out JAMS writer
author Chris Cannam
date Mon, 13 Oct 2014 16:58:30 +0100
parents
children db83ea0e102d
comparison
equal deleted inserted replaced
144:b3d73c08b6ce 145:3921e0c1f4dd
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 write(QString trackid,
40 const Transform &transform,
41 const Vamp::Plugin::OutputDescriptor &output,
42 const Vamp::Plugin::FeatureList &features,
43 std::string summaryType = "");
44
45 virtual void finish();
46
47 virtual QString getWriterTag() const { return "json"; }
48
49 private:
50 enum Task {
51 UnknownTask,
52 BeatTask,
53 OnsetTask,
54 ChordTask,
55 SegmentTask,
56 KeyTask,
57 NoteTask,
58 MelodyTask,
59 PitchTask,
60 };
61
62 typedef map<QString, PluginRDFDescription> RDFDescriptionMap; // by plugin id
63 RDFDescriptionMap m_rdfDescriptions;
64
65 typedef map<QString, QString> TrackMetadataMap; // track id -> json object
66 TrackMetadataMap m_metadata;
67
68 typedef map<QString, Task> TaskMap; // by transform id
69 TaskMap m_tasks;
70
71 //!!! no -- need to map track-transform (could have same transform for many tracks)
72 typedef set<QString> StartedSet; // transform or track id
73 StartedSet m_startedTracks;
74 StartedSet m_startedTransforms;
75
76 void loadRDFDescription(const Transform &);
77 void identifyTask(const Transform &);
78
79 QString getTaskKey(Task);
80
81 bool m_network;
82 bool m_networkRetrieved;
83 };
84
85 #endif
86