Mercurial > hg > svcore
comparison data/fileio/DataFileReaderFactory.cpp @ 1599:ce185d4dd408 bqaudiostream
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 23 Jan 2019 14:43:43 +0000 |
parents | 70e172e6cc59 |
children |
comparison
equal
deleted
inserted
replaced
1598:d2555df635ec | 1599:ce185d4dd408 |
---|---|
35 sv_samplerate_t mainModelSampleRate, | 35 sv_samplerate_t mainModelSampleRate, |
36 ProgressReporter *reporter) | 36 ProgressReporter *reporter) |
37 { | 37 { |
38 QString err; | 38 QString err; |
39 | 39 |
40 DataFileReader *reader = 0; | 40 DataFileReader *reader = nullptr; |
41 | 41 |
42 if (!csv) { | 42 if (!csv) { |
43 reader = new MIDIFileReader(path, | 43 reader = new MIDIFileReader(path, |
44 acquirer, | 44 acquirer, |
45 mainModelSampleRate, | 45 mainModelSampleRate, |
57 if (reader->isOK()) return reader; | 57 if (reader->isOK()) return reader; |
58 if (reader->getError() != "") err = reader->getError(); | 58 if (reader->getError() != "") err = reader->getError(); |
59 delete reader; | 59 delete reader; |
60 } | 60 } |
61 | 61 |
62 return 0; | 62 return nullptr; |
63 } | 63 } |
64 | 64 |
65 DataFileReader * | 65 DataFileReader * |
66 DataFileReaderFactory::createReader(QString path, | 66 DataFileReaderFactory::createReader(QString path, |
67 MIDIFileImportPreferenceAcquirer *acquirer, | 67 MIDIFileImportPreferenceAcquirer *acquirer, |
74 | 74 |
75 reader = createReader | 75 reader = createReader |
76 (path, true, acquirer, CSVFormat(path), mainModelSampleRate, reporter); | 76 (path, true, acquirer, CSVFormat(path), mainModelSampleRate, reporter); |
77 if (reader) return reader; | 77 if (reader) return reader; |
78 | 78 |
79 return 0; | 79 return nullptr; |
80 } | 80 } |
81 | 81 |
82 Model * | 82 Model * |
83 DataFileReaderFactory::load(QString path, | 83 DataFileReaderFactory::load(QString path, |
84 MIDIFileImportPreferenceAcquirer *acquirer, | 84 MIDIFileImportPreferenceAcquirer *acquirer, |
87 { | 87 { |
88 DataFileReader *reader = createReader(path, | 88 DataFileReader *reader = createReader(path, |
89 acquirer, | 89 acquirer, |
90 mainModelSampleRate, | 90 mainModelSampleRate, |
91 reporter); | 91 reporter); |
92 if (!reader) return NULL; | 92 if (!reader) return nullptr; |
93 | 93 |
94 try { | 94 try { |
95 Model *model = reader->load(); | 95 Model *model = reader->load(); |
96 delete reader; | 96 delete reader; |
97 return model; | 97 return model; |
110 DataFileReader *reader = createReader(path, false, | 110 DataFileReader *reader = createReader(path, false, |
111 acquirer, | 111 acquirer, |
112 CSVFormat(), | 112 CSVFormat(), |
113 mainModelSampleRate, | 113 mainModelSampleRate, |
114 reporter); | 114 reporter); |
115 if (!reader) return NULL; | 115 if (!reader) return nullptr; |
116 | 116 |
117 try { | 117 try { |
118 Model *model = reader->load(); | 118 Model *model = reader->load(); |
119 delete reader; | 119 delete reader; |
120 return model; | 120 return model; |
127 Model * | 127 Model * |
128 DataFileReaderFactory::loadCSV(QString path, CSVFormat format, | 128 DataFileReaderFactory::loadCSV(QString path, CSVFormat format, |
129 sv_samplerate_t mainModelSampleRate, | 129 sv_samplerate_t mainModelSampleRate, |
130 ProgressReporter *reporter) | 130 ProgressReporter *reporter) |
131 { | 131 { |
132 DataFileReader *reader = createReader(path, true, 0, format, | 132 DataFileReader *reader = createReader(path, true, nullptr, format, |
133 mainModelSampleRate, | 133 mainModelSampleRate, |
134 reporter); | 134 reporter); |
135 if (!reader) return NULL; | 135 if (!reader) return nullptr; |
136 | 136 |
137 try { | 137 try { |
138 Model *model = reader->load(); | 138 Model *model = reader->load(); |
139 delete reader; | 139 delete reader; |
140 return model; | 140 return model; |