comparison data/fileio/MIDIFileReader.h @ 392:183ee2a55fc7

* More work to abstract out interactive components used in the data library, so that it does not need to depend on QtGui.
author Chris Cannam
date Fri, 14 Mar 2008 17:14:21 +0000
parents 73537d900d4b
children eb1b517f5eeb
comparison
equal deleted inserted replaced
391:5858cc462d0a 392:183ee2a55fc7
33 33
34 class MIDIEvent; 34 class MIDIEvent;
35 35
36 typedef unsigned char MIDIByte; 36 typedef unsigned char MIDIByte;
37 37
38 class MIDIFileImportPreferenceAcquirer // welcome to our grand marble foyer
39 {
40 public:
41 enum TrackPreference {
42 ImportNothing,
43 ImportSingleTrack,
44 MergeAllTracks,
45 MergeAllNonPercussionTracks
46 };
47
48 virtual ~MIDIFileImportPreferenceAcquirer() { }
49
50 virtual TrackPreference getTrackImportPreference
51 (QStringList trackNames, bool haveSomePercussion,
52 QString &singleTrack) const = 0;
53
54 virtual void showError(QString error) = 0;
55 };
56
57
38 class MIDIFileReader : public DataFileReader 58 class MIDIFileReader : public DataFileReader
39 { 59 {
40 Q_OBJECT 60 Q_OBJECT
41 61
42 public: 62 public:
43 MIDIFileReader(QString path, size_t mainModelSampleRate); 63 MIDIFileReader(QString path,
64 MIDIFileImportPreferenceAcquirer *pref,
65 size_t mainModelSampleRate);
44 virtual ~MIDIFileReader(); 66 virtual ~MIDIFileReader();
45 67
46 virtual bool isOK() const; 68 virtual bool isOK() const;
47 virtual QString getError() const; 69 virtual QString getError() const;
48 virtual Model *load() const; 70 virtual Model *load() const;
102 QString m_path; 124 QString m_path;
103 std::ifstream *m_midiFile; 125 std::ifstream *m_midiFile;
104 size_t m_fileSize; 126 size_t m_fileSize;
105 QString m_error; 127 QString m_error;
106 size_t m_mainModelSampleRate; 128 size_t m_mainModelSampleRate;
129
130 MIDIFileImportPreferenceAcquirer *m_acquirer;
107 }; 131 };
108 132
109 133
110 #endif // _MIDI_FILE_READER_H_ 134 #endif // _MIDI_FILE_READER_H_