Mercurial > hg > svcore
comparison data/model/FlexiNoteModel.h @ 914:515c654770ca tonioni
implemented move by one note (replacing big jumps left/right)
author | matthiasm |
---|---|
date | Thu, 22 May 2014 17:49:58 +0100 |
parents | ecb34638ce1b |
children | 49618f39ff09 |
comparison
equal
deleted
inserted
replaced
912:2175c2ebd5c6 | 914:515c654770ca |
---|---|
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 { |
239 points.begin(); pli != points.end(); ++pli) { | 240 size_t duration = pli->duration; |
240 | |
241 size_t duration = pli->duration; | |
242 if (duration == 0 || duration == 1) { | 241 if (duration == 0 || duration == 1) { |
243 duration = getSampleRate() / 20; | 242 duration = getSampleRate() / 20; |
244 } | 243 } |
245 | |
246 int pitch = lrintf(pli->value); | 244 int pitch = lrintf(pli->value); |
247 | 245 |
248 int velocity = 100; | 246 int velocity = 100; |
249 if (pli->level > 0.f && pli->level <= 1.f) { | 247 if (pli->level > 0.f && pli->level <= 1.f) |
248 { | |
250 velocity = lrintf(pli->level * 127); | 249 velocity = lrintf(pli->level * 127); |
251 } | 250 } |
252 | 251 |
253 NoteData note(pli->frame, duration, pitch, velocity); | 252 NoteData note(pli->frame, duration, pitch, velocity); |
254 | 253 |
255 if (getScaleUnits() == "Hz") { | 254 if (getScaleUnits() == "Hz") { |
256 note.frequency = pli->value; | 255 note.frequency = pli->value; |
257 note.midiPitch = Pitch::getPitchForFrequency(note.frequency); | 256 note.midiPitch = Pitch::getPitchForFrequency(note.frequency); |
258 note.isMidiPitchQuantized = false; | 257 note.isMidiPitchQuantized = false; |
259 } | 258 } |
260 | |
261 notes.push_back(note); | 259 notes.push_back(note); |
262 } | 260 } |
263 | |
264 return notes; | 261 return notes; |
265 } | 262 } |
266 | 263 |
267 protected: | 264 protected: |
268 float m_valueQuantization; | 265 float m_valueQuantization; |