summaryrefslogtreecommitdiff
path: root/muse2/muse/midievent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/muse/midievent.cpp')
-rw-r--r--muse2/muse/midievent.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/muse2/muse/midievent.cpp b/muse2/muse/midievent.cpp
index 5330b518..fb6517cd 100644
--- a/muse2/muse/midievent.cpp
+++ b/muse2/muse/midievent.cpp
@@ -41,6 +41,21 @@ MidiEventBase::MidiEventBase(EventType t)
c = 0;
}
+bool MidiEventBase::isSimilarTo(const EventBase& other_) const
+{
+ const MidiEventBase* other = dynamic_cast<const MidiEventBase*>(&other_);
+ if (other==NULL) // dynamic cast hsa failed: "other_" is not of type MidiEventBase.
+ return false;
+
+ if ((a==other->a && b==other->b && c==other->c && edata.dataLen==other->edata.dataLen && this->PosLen::operator==(*other)) == false)
+ return false;
+
+ if (edata.dataLen > 0)
+ return (memcmp(edata.data, other->edata.data, edata.dataLen) == 0);
+ else
+ return true; // no data equals no data.
+}
+
//---------------------------------------------------------
// MidiEventBase::mid
//---------------------------------------------------------