Mercurial > hg > svcore
diff data/model/SparseOneDimensionalModel.h @ 855:42bbc538d983 tonioni_multi_transform
Merge from tonioni branch
author | Chris Cannam |
---|---|
date | Wed, 04 Dec 2013 18:29:15 +0000 |
parents | d6bd5751b8f6 |
children | 6d07bcc844a1 |
line wrap: on
line diff
--- a/data/model/SparseOneDimensionalModel.h Mon Dec 02 11:17:24 2013 +0000 +++ b/data/model/SparseOneDimensionalModel.h Wed Dec 04 18:29:15 2013 +0000 @@ -17,6 +17,7 @@ #define _SPARSE_ONE_DIMENSIONAL_MODEL_H_ #include "SparseModel.h" +#include "NoteData.h" #include "base/PlayParameterRepository.h" #include "base/RealTime.h" @@ -69,7 +70,8 @@ }; -class SparseOneDimensionalModel : public SparseModel<OneDimensionalPoint> +class SparseOneDimensionalModel : public SparseModel<OneDimensionalPoint>, + public NoteExportable { Q_OBJECT @@ -181,6 +183,32 @@ if (column == 2) return SortAlphabetical; return SortNumeric; } + + /** + * NoteExportable methods. + */ + + NoteList getNotes() const { + return getNotes(getStartFrame(), getEndFrame()); + } + + NoteList getNotes(size_t startFrame, size_t endFrame) const { + + PointList points = getPoints(startFrame, endFrame); + NoteList notes; + + for (PointList::iterator pli = + points.begin(); pli != points.end(); ++pli) { + + notes.push_back + (NoteData(pli->frame, + getSampleRate() / 6, // arbitrary short duration + 64, // default pitch + 100)); // default velocity + } + + return notes; + } }; #endif