alo@223: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ alo@223: alo@223: /* alo@223: Sonic Annotator alo@223: A utility for batch feature extraction from audio files. alo@223: alo@223: Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London. alo@223: Copyright 2007-2014 QMUL. alo@223: alo@223: This program is free software; you can redistribute it and/or alo@223: modify it under the terms of the GNU General Public License as alo@223: published by the Free Software Foundation; either version 2 of the alo@223: License, or (at your option) any later version. See the file alo@223: COPYING included with this distribution for more information. alo@223: */ alo@223: alo@223: #ifndef JSONLD_FEATURE_WRITER_H alo@223: #define JSONLD_FEATURE_WRITER_H alo@223: alo@223: #include "transform/FileFeatureWriter.h" alo@223: alo@223: #include "rdf/PluginRDFDescription.h" alo@223: alo@223: class JsonLDFileWriter; alo@223: alo@223: class JsonLDFeatureWriter : public FileFeatureWriter alo@223: { alo@223: public: alo@223: JsonLDFeatureWriter(); alo@223: virtual ~JsonLDFeatureWriter(); alo@223: alo@223: string getDescription() const; alo@223: alo@223: virtual ParameterList getSupportedParameters() const; alo@223: virtual void setParameters(map ¶ms); alo@223: alo@223: virtual void setTrackMetadata(QString trackid, TrackMetadata metadata); alo@223: alo@223: virtual void setNofM(int, int); alo@223: alo@223: virtual void write(QString trackid, alo@223: const Transform &transform, alo@223: const Vamp::Plugin::OutputDescriptor &output, alo@223: const Vamp::Plugin::FeatureList &features, alo@223: std::string summaryType = ""); alo@223: alo@223: virtual void finish(); alo@223: alo@223: virtual QString getWriterTag() const { return "jsld"; } alo@223: alo@223: private: alo@223: enum Task { alo@223: UnknownTask, alo@223: BeatTask, alo@223: OnsetTask, alo@223: ChordTask, alo@223: SegmentTask, alo@223: KeyTask, alo@223: NoteTask, alo@223: MelodyTask, alo@223: PitchTask, alo@223: }; alo@223: alo@223: typedef map RDFDescriptionMap; // by plugin id alo@223: RDFDescriptionMap m_rdfDescriptions; alo@223: alo@223: typedef QString TrackId; alo@223: typedef pair DataId; alo@223: alo@223: typedef map TrackMetadataMap; alo@223: TrackMetadataMap m_trackMetadata; alo@223: alo@223: typedef map TrackTimelineMap; alo@223: TrackTimelineMap m_trackTimelineGuids; alo@223: alo@223: typedef set TrackIds; alo@223: typedef map StreamTrackMap; alo@223: StreamTrackMap m_streamTracks; alo@223: alo@223: typedef set Tasks; alo@223: typedef map StreamTaskMap; alo@223: StreamTaskMap m_streamTasks; alo@223: alo@223: typedef set DataIds; alo@223: typedef map StreamDataMap; alo@223: StreamDataMap m_streamData; alo@223: alo@223: typedef map DataMap; alo@223: DataMap m_data; alo@223: alo@223: typedef map TaskMap; alo@223: TaskMap m_tasks; alo@223: alo@223: void loadRDFDescription(const Transform &); alo@223: void identifyTask(const Transform &); alo@223: alo@223: QString getTaskKey(Task); alo@223: alo@223: QString writeTransformToObjectContents(const Transform &); alo@223: alo@223: QString writeContext(); alo@223: alo@223: std::string m_format; alo@223: bool m_network; alo@223: bool m_networkRetrieved; alo@223: int m_n; alo@223: int m_m; alo@223: int m_digits; alo@223: }; alo@223: alo@223: #endif alo@223: