comparison data/fileio/MIDIFileWriter.h @ 874:862fe7b20df7 tony_integration

Merge from tonioni branch
author Chris Cannam
date Tue, 28 Jan 2014 15:01:54 +0000
parents d6bd5751b8f6
children c7e9afcbf070
comparison
equal deleted inserted replaced
862:786ee8d1f30e 874:862fe7b20df7
30 #include <vector> 30 #include <vector>
31 #include <map> 31 #include <map>
32 #include <fstream> 32 #include <fstream>
33 33
34 class MIDIEvent; 34 class MIDIEvent;
35 class NoteModel; 35 class NoteExportable;
36 36
37 /** 37 /**
38 * Write a MIDI file. This includes file write code for generic 38 * Write a MIDI file. This includes file write code for generic
39 * simultaneous-track MIDI files, but the conversion stage only 39 * simultaneous-track MIDI files, but the conversion stage only
40 * supports a single-track MIDI file with fixed tempo, time signature 40 * supports a single-track MIDI file with fixed tempo, time signature
41 * and timing division. 41 * and timing division.
42 */ 42 */
43 class MIDIFileWriter 43 class MIDIFileWriter
44 { 44 {
45 public: 45 public:
46 MIDIFileWriter(QString path, NoteModel *model, float tempo = 120.f); 46 MIDIFileWriter(QString path,
47 const NoteExportable *exportable,
48 int sampleRate, // used to convert exportable sample timings
49 float tempo = 120.f);
47 virtual ~MIDIFileWriter(); 50 virtual ~MIDIFileWriter();
48 51
49 virtual bool isOK() const; 52 virtual bool isOK() const;
50 virtual QString getError() const; 53 virtual QString getError() const;
51 54
72 bool writeTrack(int track); 75 bool writeTrack(int track);
73 bool writeComposition(); 76 bool writeComposition();
74 77
75 bool convert(); 78 bool convert();
76 79
77 QString m_path; 80 QString m_path;
78 NoteModel *m_model; 81 const NoteExportable *m_exportable;
79 bool m_modelUsesHz; 82 int m_sampleRate;
80 float m_tempo; 83 float m_tempo;
81 int m_timingDivision; // pulses per quarter note 84 int m_timingDivision; // pulses per quarter note
82 MIDIFileFormatType m_format; 85 MIDIFileFormatType m_format;
83 unsigned int m_numberOfTracks; 86 unsigned int m_numberOfTracks;
84 87
85 MIDIComposition m_midiComposition; 88 MIDIComposition m_midiComposition;
86 89
87 std::ofstream *m_midiFile; 90 std::ofstream *m_midiFile;
88 QString m_error; 91 QString m_error;
89 }; 92 };
90 93
91 #endif 94 #endif