Mercurial > hg > sonic-annotator
comparison runner/MIDIFeatureWriter.h @ 137:65a488d8c1bb midi
Might help to actually commit these files
author | Chris Cannam |
---|---|
date | Mon, 13 Oct 2014 11:28:24 +0100 |
parents | |
children | 9b94545a7fdc |
comparison
equal
deleted
inserted
replaced
136:2260947be4aa | 137:65a488d8c1bb |
---|---|
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 _MIDI_FEATURE_WRITER_H_ | |
18 #define _MIDI_FEATURE_WRITER_H_ | |
19 | |
20 #include "transform/FileFeatureWriter.h" | |
21 #include "data/model/NoteData.h" | |
22 | |
23 class MIDIFileWriter; | |
24 | |
25 class MIDIFeatureWriter : public FileFeatureWriter | |
26 { | |
27 public: | |
28 MIDIFeatureWriter(); | |
29 virtual ~MIDIFeatureWriter(); | |
30 | |
31 virtual ParameterList getSupportedParameters() const; | |
32 virtual void setParameters(map<string, string> ¶ms); | |
33 | |
34 virtual void setTrackMetadata(QString trackid, TrackMetadata metadata); | |
35 | |
36 virtual void write(QString trackid, | |
37 const Transform &transform, | |
38 const Vamp::Plugin::OutputDescriptor &output, | |
39 const Vamp::Plugin::FeatureList &features, | |
40 std::string summaryType = ""); | |
41 | |
42 virtual void finish(); | |
43 | |
44 virtual QString getWriterTag() const { return "midi"; } | |
45 | |
46 private: | |
47 class TrivialNoteExportable : public NoteExportable { | |
48 public: | |
49 TrivialNoteExportable(NoteList notes) : m_notes(notes) { } | |
50 virtual NoteList getNotes() const { | |
51 return m_notes; | |
52 } | |
53 virtual NoteList getNotesWithin(int startFrame, int endFrame) const { | |
54 // Not required by MIDIFileWriter, not supported | |
55 return NoteList(); | |
56 } | |
57 private: | |
58 NoteList m_notes; | |
59 }; | |
60 | |
61 typedef map<QString, NoteList> NoteMap; // output filename -> notes | |
62 NoteMap m_notes; | |
63 | |
64 typedef map<QString, float> SampleRateMap; // NoteData uses sample timing | |
65 SampleRateMap m_rates; | |
66 | |
67 typedef map<TransformId, int> ChannelMap; | |
68 ChannelMap m_channels; | |
69 | |
70 typedef map<QString, int> LastChannelMap; | |
71 LastChannelMap m_lastChannels; | |
72 }; | |
73 | |
74 #endif | |
75 |