summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-12-01 16:22:51 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-12-01 16:22:51 +0000
commit8480cf69ce693e7effeb677d791fbe1d5ea004cb (patch)
treeec5adb980b473c6be27510295312f95a3b839f90 /libs/ardour/ardour
parentd4030cd32a84ea9bbecc0594f4234e482a1c0bb0 (diff)
provide semantic ordering of simultaneous MIDI events; add operator== to MidiBuffer iterator; add empty() to MidiBuffer for no particular reason
git-svn-id: svn://localhost/ardour2/branches/3.0@10846 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audio_buffer.h1
-rw-r--r--libs/ardour/ardour/buffer.h3
-rw-r--r--libs/ardour/ardour/midi_buffer.h10
3 files changed, 14 insertions, 0 deletions
diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h
index c9aefc3903..57c5de6124 100644
--- a/libs/ardour/ardour/audio_buffer.h
+++ b/libs/ardour/ardour/audio_buffer.h
@@ -157,6 +157,7 @@ public:
*/
void resize (size_t nframes);
+ bool empty() const { return _size == 0; }
const Sample* data (framecnt_t offset = 0) const {
assert(offset <= _capacity);
diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h
index 4775f24e95..15e97ccc10 100644
--- a/libs/ardour/ardour/buffer.h
+++ b/libs/ardour/ardour/buffer.h
@@ -56,6 +56,9 @@ public:
/** Amount of valid data in buffer. Use this over capacity almost always. */
size_t size() const { return _size; }
+ /** Return true if the buffer contains no data, false otherwise */
+ virtual bool empty() const { return _size == 0; }
+
/** Type of this buffer.
* Based on this you can static cast a Buffer* to the desired type. */
DataType type() const { return _type; }
diff --git a/libs/ardour/ardour/midi_buffer.h b/libs/ardour/ardour/midi_buffer.h
index 5db64a50fb..611e890304 100644
--- a/libs/ardour/ardour/midi_buffer.h
+++ b/libs/ardour/ardour/midi_buffer.h
@@ -83,6 +83,9 @@ public:
inline bool operator!=(const iterator_base<BufferType, EventType>& other) const {
return (&buffer != &other.buffer) || (offset != other.offset);
}
+ inline bool operator==(const iterator_base<BufferType, EventType>& other) const {
+ return (&buffer == &other.buffer) && (offset == other.offset);
+ }
BufferType& buffer;
size_t offset;
};
@@ -98,6 +101,13 @@ public:
uint8_t* data() const { return _data; }
+ /**
+ * returns true if the message with the second argument as its MIDI
+ * status byte should preceed the message with the first argument as
+ * its MIDI status byte.
+ */
+ static bool second_simultaneous_midi_byte_is_first (uint8_t, uint8_t);
+
private:
friend class iterator_base< MidiBuffer, Evoral::MIDIEvent<TimeType> >;
friend class iterator_base< const MidiBuffer, const Evoral::MIDIEvent<TimeType> >;