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@145
|
17 #ifndef _JAMS_FEATURE_WRITER_H_
|
Chris@145
|
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> ¶ms);
|
Chris@145
|
36
|
Chris@145
|
37 virtual void setTrackMetadata(QString trackid, TrackMetadata metadata);
|
Chris@145
|
38
|
Chris@145
|
39 virtual void write(QString trackid,
|
Chris@145
|
40 const Transform &transform,
|
Chris@145
|
41 const Vamp::Plugin::OutputDescriptor &output,
|
Chris@145
|
42 const Vamp::Plugin::FeatureList &features,
|
Chris@145
|
43 std::string summaryType = "");
|
Chris@145
|
44
|
Chris@145
|
45 virtual void finish();
|
Chris@145
|
46
|
Chris@145
|
47 virtual QString getWriterTag() const { return "json"; }
|
Chris@145
|
48
|
Chris@145
|
49 private:
|
Chris@145
|
50 enum Task {
|
Chris@145
|
51 UnknownTask,
|
Chris@145
|
52 BeatTask,
|
Chris@145
|
53 OnsetTask,
|
Chris@145
|
54 ChordTask,
|
Chris@145
|
55 SegmentTask,
|
Chris@145
|
56 KeyTask,
|
Chris@145
|
57 NoteTask,
|
Chris@145
|
58 MelodyTask,
|
Chris@145
|
59 PitchTask,
|
Chris@145
|
60 };
|
Chris@145
|
61
|
Chris@145
|
62 typedef map<QString, PluginRDFDescription> RDFDescriptionMap; // by plugin id
|
Chris@145
|
63 RDFDescriptionMap m_rdfDescriptions;
|
Chris@145
|
64
|
Chris@145
|
65 typedef map<QString, QString> TrackMetadataMap; // track id -> json object
|
Chris@145
|
66 TrackMetadataMap m_metadata;
|
Chris@145
|
67
|
Chris@145
|
68 typedef map<QString, Task> TaskMap; // by transform id
|
Chris@145
|
69 TaskMap m_tasks;
|
Chris@145
|
70
|
Chris@145
|
71 //!!! no -- need to map track-transform (could have same transform for many tracks)
|
Chris@145
|
72 typedef set<QString> StartedSet; // transform or track id
|
Chris@145
|
73 StartedSet m_startedTracks;
|
Chris@145
|
74 StartedSet m_startedTransforms;
|
Chris@145
|
75
|
Chris@145
|
76 void loadRDFDescription(const Transform &);
|
Chris@145
|
77 void identifyTask(const Transform &);
|
Chris@145
|
78
|
Chris@145
|
79 QString getTaskKey(Task);
|
Chris@145
|
80
|
Chris@145
|
81 bool m_network;
|
Chris@145
|
82 bool m_networkRetrieved;
|
Chris@145
|
83 };
|
Chris@145
|
84
|
Chris@145
|
85 #endif
|
Chris@145
|
86
|