comparison data/model/FlexiNoteModel.h @ 926:926f33d3a8b7 tony_integration

Merge from default branch
author Chris Cannam
date Tue, 17 Jun 2014 12:52:27 +0100
parents 49618f39ff09
children 59e7fe1b1003
comparison
equal deleted inserted replaced
910:55e552b4f1b7 926:926f33d3a8b7
224 224
225 /** 225 /**
226 * NoteExportable methods. 226 * NoteExportable methods.
227 */ 227 */
228 228
229 NoteList getNotes() const { 229 NoteList getNotes() const
230 {
230 return getNotes(getStartFrame(), getEndFrame()); 231 return getNotes(getStartFrame(), getEndFrame());
231 } 232 }
232 233
233 NoteList getNotes(size_t startFrame, size_t endFrame) const { 234 NoteList getNotes(size_t startFrame, size_t endFrame) const
234 235 {
235 PointList points = getPoints(startFrame, endFrame); 236 PointList points = getPoints(startFrame, endFrame);
236 NoteList notes; 237 NoteList notes;
237 238 for (PointList::iterator pli = points.begin(); pli != points.end(); ++pli) {
238 for (PointList::iterator pli = 239 size_t duration = pli->duration;
239 points.begin(); pli != points.end(); ++pli) {
240
241 size_t duration = pli->duration;
242 if (duration == 0 || duration == 1) { 240 if (duration == 0 || duration == 1) {
243 duration = getSampleRate() / 20; 241 duration = getSampleRate() / 20;
244 } 242 }
245
246 int pitch = lrintf(pli->value); 243 int pitch = lrintf(pli->value);
247 244
248 int velocity = 100; 245 int velocity = 100;
249 if (pli->level > 0.f && pli->level <= 1.f) { 246 if (pli->level > 0.f && pli->level <= 1.f) {
250 velocity = lrintf(pli->level * 127); 247 velocity = lrintf(pli->level * 127);
251 } 248 }
252 249
255 if (getScaleUnits() == "Hz") { 252 if (getScaleUnits() == "Hz") {
256 note.frequency = pli->value; 253 note.frequency = pli->value;
257 note.midiPitch = Pitch::getPitchForFrequency(note.frequency); 254 note.midiPitch = Pitch::getPitchForFrequency(note.frequency);
258 note.isMidiPitchQuantized = false; 255 note.isMidiPitchQuantized = false;
259 } 256 }
260
261 notes.push_back(note); 257 notes.push_back(note);
262 } 258 }
263
264 return notes; 259 return notes;
265 } 260 }
266 261
267 protected: 262 protected:
268 float m_valueQuantization; 263 float m_valueQuantization;