2012-05-26 14:26:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
|
|
|
// Copyright (C) 2010-2011 Werner Schweer
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2
|
|
|
|
// as published by the Free Software Foundation and appearing in
|
|
|
|
// the file LICENCE.GPL
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#include "noteevent.h"
|
|
|
|
#include "xml.h"
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// read
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-01-11 18:10:18 +01:00
|
|
|
void NoteEvent::read(XmlReader& e)
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
2013-01-11 18:10:18 +01:00
|
|
|
while (e.readNextStartElement()) {
|
|
|
|
const QStringRef& tag(e.name());
|
2012-05-26 14:26:10 +02:00
|
|
|
if (tag == "pitch")
|
2013-01-11 18:10:18 +01:00
|
|
|
_pitch = e.readInt();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "ontime")
|
2013-01-11 18:10:18 +01:00
|
|
|
_ontime = e.readInt();
|
2012-05-26 14:26:10 +02:00
|
|
|
else if (tag == "len")
|
2013-01-11 18:10:18 +01:00
|
|
|
_len = e.readInt();
|
2012-05-26 14:26:10 +02:00
|
|
|
else
|
2013-01-11 18:10:18 +01:00
|
|
|
e.unknown();
|
2012-05-26 14:26:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// write
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2016-11-19 11:51:21 +01:00
|
|
|
void NoteEvent::write(XmlWriter& xml) const
|
2012-05-26 14:26:10 +02:00
|
|
|
{
|
|
|
|
xml.stag("Event");
|
2020-02-14 09:03:15 +01:00
|
|
|
xml.tag("pitch", _pitch, 0);
|
|
|
|
xml.tag("ontime", _ontime, 0);
|
|
|
|
xml.tag("len", _len, NOTE_LENGTH);
|
2012-05-26 14:26:10 +02:00
|
|
|
xml.etag();
|
|
|
|
}
|
2012-11-19 10:08:15 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// NoteEventList
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
NoteEventList::NoteEventList()
|
|
|
|
: QList<NoteEvent>()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-11-20 20:51:18 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// operator==
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
bool NoteEvent::operator==(const NoteEvent& e) const
|
|
|
|
{
|
|
|
|
return (e._pitch == _pitch) && (e._ontime == _ontime) && (e._len == _len);
|
|
|
|
}
|
2012-11-19 10:08:15 +01:00
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
}
|
|
|
|
|