Mercurial > hg > svgui
diff layer/NoteLayer.h @ 507:efe0f232685f
* Make it possible to record live MIDI to a note layer.
Now we're a proper MIDI sequencer. Ha, ha.
author | Chris Cannam |
---|---|
date | Wed, 25 Feb 2009 12:02:53 +0000 |
parents | 681542f0c8c5 |
children | d666f5f8b154 |
line wrap: on
line diff
--- a/layer/NoteLayer.h Wed Feb 25 11:33:03 2009 +0000 +++ b/layer/NoteLayer.h Wed Feb 25 12:02:53 2009 +0000 @@ -102,6 +102,24 @@ virtual void setVerticalZoomStep(int); virtual RangeMapper *getNewVerticalZoomRangeMapper() const; + /** + * Add a note-on. Used when recording MIDI "live". The note will + * not be finally added to the layer until the corresponding + * note-off. + */ + void addNoteOn(long frame, int pitch, int velocity); + + /** + * Add a note-off. This will cause a note to appear, if and only + * if there is a matching pending note-on. + */ + void addNoteOff(long frame, int pitch); + + /** + * Abandon all pending note-on events. + */ + void abandonNoteOns(); + virtual void toXml(QTextStream &stream, QString indent = "", QString extraAttributes = "") const; @@ -124,6 +142,9 @@ NoteModel::EditCommand *m_editingCommand; VerticalScale m_verticalScale; + typedef std::set<NoteModel::Point, NoteModel::Point::Comparator> NoteSet; + NoteSet m_pendingNoteOns; + mutable float m_scaleMinimum; mutable float m_scaleMaximum;