Chris@137
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@137
|
2
|
Chris@137
|
3 /*
|
Chris@137
|
4 Sonic Annotator
|
Chris@137
|
5 A utility for batch feature extraction from audio files.
|
Chris@137
|
6
|
Chris@137
|
7 Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London.
|
Chris@137
|
8 Copyright 2007-2014 QMUL.
|
Chris@137
|
9
|
Chris@137
|
10 This program is free software; you can redistribute it and/or
|
Chris@137
|
11 modify it under the terms of the GNU General Public License as
|
Chris@137
|
12 published by the Free Software Foundation; either version 2 of the
|
Chris@137
|
13 License, or (at your option) any later version. See the file
|
Chris@137
|
14 COPYING included with this distribution for more information.
|
Chris@137
|
15 */
|
Chris@137
|
16
|
Chris@137
|
17 #ifndef _MIDI_FEATURE_WRITER_H_
|
Chris@137
|
18 #define _MIDI_FEATURE_WRITER_H_
|
Chris@137
|
19
|
Chris@137
|
20 #include "transform/FileFeatureWriter.h"
|
Chris@137
|
21 #include "data/model/NoteData.h"
|
Chris@137
|
22
|
Chris@137
|
23 class MIDIFileWriter;
|
Chris@137
|
24
|
Chris@137
|
25 class MIDIFeatureWriter : public FileFeatureWriter
|
Chris@137
|
26 {
|
Chris@137
|
27 public:
|
Chris@137
|
28 MIDIFeatureWriter();
|
Chris@137
|
29 virtual ~MIDIFeatureWriter();
|
Chris@137
|
30
|
Chris@137
|
31 virtual ParameterList getSupportedParameters() const;
|
Chris@137
|
32 virtual void setParameters(map<string, string> ¶ms);
|
Chris@137
|
33
|
Chris@137
|
34 virtual void setTrackMetadata(QString trackid, TrackMetadata metadata);
|
Chris@137
|
35
|
Chris@137
|
36 virtual void write(QString trackid,
|
Chris@137
|
37 const Transform &transform,
|
Chris@137
|
38 const Vamp::Plugin::OutputDescriptor &output,
|
Chris@137
|
39 const Vamp::Plugin::FeatureList &features,
|
Chris@137
|
40 std::string summaryType = "");
|
Chris@137
|
41
|
Chris@137
|
42 virtual void finish();
|
Chris@137
|
43
|
Chris@137
|
44 virtual QString getWriterTag() const { return "midi"; }
|
Chris@137
|
45
|
Chris@137
|
46 private:
|
Chris@137
|
47 class TrivialNoteExportable : public NoteExportable {
|
Chris@137
|
48 public:
|
Chris@137
|
49 TrivialNoteExportable(NoteList notes) : m_notes(notes) { }
|
Chris@137
|
50 virtual NoteList getNotes() const {
|
Chris@137
|
51 return m_notes;
|
Chris@137
|
52 }
|
Chris@140
|
53 virtual NoteList getNotesWithin(int, int) const {
|
Chris@137
|
54 // Not required by MIDIFileWriter, not supported
|
Chris@137
|
55 return NoteList();
|
Chris@137
|
56 }
|
Chris@137
|
57 private:
|
Chris@137
|
58 NoteList m_notes;
|
Chris@137
|
59 };
|
Chris@137
|
60
|
Chris@137
|
61 typedef map<QString, NoteList> NoteMap; // output filename -> notes
|
Chris@137
|
62 NoteMap m_notes;
|
Chris@140
|
63
|
Chris@140
|
64 typedef map<QString, set<TransformId> > FileTransformMap;
|
Chris@140
|
65 FileTransformMap m_fileTransforms;
|
Chris@137
|
66
|
Chris@137
|
67 typedef map<QString, float> SampleRateMap; // NoteData uses sample timing
|
Chris@137
|
68 SampleRateMap m_rates;
|
Chris@137
|
69
|
Chris@137
|
70 typedef map<TransformId, int> ChannelMap;
|
Chris@137
|
71 ChannelMap m_channels;
|
Chris@137
|
72
|
Chris@140
|
73 typedef map<QString, int> NextChannelMap;
|
Chris@140
|
74 NextChannelMap m_nextChannels;
|
Chris@137
|
75 };
|
Chris@137
|
76
|
Chris@137
|
77 #endif
|
Chris@137
|
78
|