Chris@137: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@137: Chris@137: /* Chris@137: Sonic Annotator Chris@137: A utility for batch feature extraction from audio files. Chris@137: Chris@137: Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London. Chris@137: Copyright 2007-2014 QMUL. Chris@137: Chris@137: This program is free software; you can redistribute it and/or Chris@137: modify it under the terms of the GNU General Public License as Chris@137: published by the Free Software Foundation; either version 2 of the Chris@137: License, or (at your option) any later version. See the file Chris@137: COPYING included with this distribution for more information. Chris@137: */ Chris@137: Chris@137: #ifndef _MIDI_FEATURE_WRITER_H_ Chris@137: #define _MIDI_FEATURE_WRITER_H_ Chris@137: Chris@137: #include "transform/FileFeatureWriter.h" Chris@137: #include "data/model/NoteData.h" Chris@137: Chris@137: class MIDIFileWriter; Chris@137: Chris@137: class MIDIFeatureWriter : public FileFeatureWriter Chris@137: { Chris@137: public: Chris@137: MIDIFeatureWriter(); Chris@137: virtual ~MIDIFeatureWriter(); Chris@137: Chris@144: string getDescription() const; Chris@144: Chris@137: virtual ParameterList getSupportedParameters() const; Chris@137: virtual void setParameters(map ¶ms); Chris@137: Chris@137: virtual void setTrackMetadata(QString trackid, TrackMetadata metadata); Chris@137: Chris@137: virtual void write(QString trackid, Chris@137: const Transform &transform, Chris@137: const Vamp::Plugin::OutputDescriptor &output, Chris@137: const Vamp::Plugin::FeatureList &features, Chris@137: std::string summaryType = ""); Chris@137: Chris@137: virtual void finish(); Chris@137: Chris@137: virtual QString getWriterTag() const { return "midi"; } Chris@137: Chris@137: private: Chris@137: class TrivialNoteExportable : public NoteExportable { Chris@137: public: Chris@137: TrivialNoteExportable(NoteList notes) : m_notes(notes) { } Chris@137: virtual NoteList getNotes() const { Chris@137: return m_notes; Chris@137: } Chris@195: virtual NoteList getNotesWithin(sv_frame_t, sv_frame_t) const { Chris@137: // Not required by MIDIFileWriter, not supported Chris@137: return NoteList(); Chris@137: } Chris@137: private: Chris@137: NoteList m_notes; Chris@137: }; Chris@137: Chris@137: typedef map NoteMap; // output filename -> notes Chris@137: NoteMap m_notes; Chris@140: Chris@175: typedef map > FileTransformMap; Chris@140: FileTransformMap m_fileTransforms; Chris@137: Chris@331: typedef map SampleRateMap; // NoteData uses sample timing Chris@137: SampleRateMap m_rates; Chris@137: Chris@175: typedef map ChannelMap; Chris@137: ChannelMap m_channels; Chris@137: Chris@140: typedef map NextChannelMap; Chris@140: NextChannelMap m_nextChannels; Chris@137: }; Chris@137: Chris@137: #endif Chris@137: