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