Skip to content

Commit a34fdf5

Browse files
committed
add play property to arpeggio
1 parent 0c825c8 commit a34fdf5

File tree

8 files changed

+233
-1
lines changed

8 files changed

+233
-1
lines changed

libmscore/arpeggio.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Arpeggio::Arpeggio(Score* s)
3636
_span = 1;
3737
_userLen1 = 0.0;
3838
_userLen2 = 0.0;
39+
_playArpeggio = true;
3940
}
4041

4142
//---------------------------------------------------------
@@ -64,6 +65,7 @@ void Arpeggio::write(Xml& xml) const
6465
xml.tag("userLen2", _userLen2 / spatium());
6566
if (_span != 1)
6667
xml.tag("span", _span);
68+
writeProperty(xml, P_ID::PLAY);
6769
xml.etag();
6870
}
6971

@@ -83,6 +85,8 @@ void Arpeggio::read(XmlReader& e)
8385
_userLen2 = e.readDouble() * spatium();
8486
else if (tag == "span")
8587
_span = e.readInt();
88+
else if (tag == "play")
89+
_playArpeggio = e.readBool();
8690
else if (!Element::readProperties(e))
8791
e.unknown();
8892
}
@@ -401,6 +405,8 @@ QVariant Arpeggio::getProperty(P_ID propertyId) const
401405
return userLen1();
402406
case P_ID::ARP_USER_LEN2:
403407
return userLen2();
408+
case P_ID::PLAY:
409+
return _playArpeggio;
404410
default:
405411
break;
406412
}
@@ -420,6 +426,9 @@ bool Arpeggio::setProperty(P_ID propertyId, const QVariant& val)
420426
case P_ID::ARP_USER_LEN2:
421427
setUserLen2(val.toDouble());
422428
break;
429+
case P_ID::PLAY:
430+
setPlayArpeggio(val.toBool());
431+
break;
423432
default:
424433
if (!Element::setProperty(propertyId, val))
425434
return false;
@@ -429,6 +438,23 @@ bool Arpeggio::setProperty(P_ID propertyId, const QVariant& val)
429438
return true;
430439
}
431440

441+
//---------------------------------------------------------
442+
// propertyDefault
443+
//---------------------------------------------------------
432444

445+
QVariant Arpeggio::propertyDefault(P_ID propertyId) const
446+
{
447+
switch(propertyId) {
448+
case P_ID::ARP_USER_LEN1:
449+
return 0.0;
450+
case P_ID::ARP_USER_LEN2:
451+
return 0.0;
452+
case P_ID::PLAY:
453+
return true;
454+
default:
455+
break;
456+
}
457+
return Element::propertyDefault(propertyId);
458+
}
433459
}
434460

libmscore/arpeggio.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class Arpeggio : public Element {
3838
qreal _height;
3939
int _span; // spanning staves
4040
QList<SymId> symbols;
41+
bool _playArpeggio;
4142

4243
void symbolLine(SymId start, SymId fill);
4344
void symbolLine2(SymId end, SymId fill);
@@ -79,8 +80,12 @@ class Arpeggio : public Element {
7980
void setUserLen1(qreal v) { _userLen1 = v; }
8081
void setUserLen2(qreal v) { _userLen2 = v; }
8182

83+
bool playArpeggio() { return _playArpeggio; }
84+
void setPlayArpeggio(bool p) { _playArpeggio = p; }
85+
8286
virtual QVariant getProperty(P_ID propertyId) const override;
8387
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
88+
virtual QVariant propertyDefault(P_ID propertyId) const override;
8489
};
8590

8691

libmscore/rendermidi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ static QList<NoteEventList> renderChord(Chord* chord, int gateTime, int ontime)
12611261
renderTremolo(chord, ell);
12621262

12631263
}
1264-
else if (chord->arpeggio()) {
1264+
else if (chord->arpeggio() && chord->arpeggio()->playArpeggio()) {
12651265
renderArpeggio(chord, ell);
12661266
return ell; // dont apply gateTime to arpeggio events
12671267
}

mscore/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ QT5_WRAP_UI (ui_headers
124124
inspector/inspector_fret.ui
125125
inspector/inspector_break.ui
126126
inspector/inspector_bend.ui
127+
inspector/inspector_arpeggio.ui
127128
${SCRIPT_UI}
128129
)
129130

@@ -256,6 +257,7 @@ add_executable ( ${ExecutableName}
256257
musicxmlfonthandler.cpp musicxmlsupport.cpp exportxml.cpp importxml.cpp importxmlfirstpass.cpp
257258
savePositions.cpp inspector/inspectorJump.cpp inspector/inspectorMarker.cpp
258259
inspector/inspectorGlissando.cpp inspector/inspectorNote.cpp inspector/inspectorAmbitus.cpp
260+
inspector/inspectorArpeggio.cpp
259261
paletteBoxButton.cpp driver.cpp exportmidi.cpp noteGroups.cpp
260262
pathlistdialog.cpp exampleview.cpp inspector/inspectorTextLine.cpp miconengine.cpp
261263
importmidi/importmidi.cpp

mscore/inspector/inspector.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "inspectorMarker.h"
2525
#include "inspectorJump.h"
2626
#include "inspectorGlissando.h"
27+
#include "inspectorArpeggio.h"
2728
#include "inspectorNote.h"
2829
#include "inspectorAmbitus.h"
2930
#include "inspectorFret.h"
@@ -247,6 +248,9 @@ void Inspector::setElements(const QList<Element*>& l)
247248
case Element::Type::BEND:
248249
ie = new InspectorBend(this);
249250
break;
251+
case Element::Type::ARPEGGIO:
252+
ie = new InspectorArpeggio(this);
253+
break;
250254
default:
251255
if (_element->isText())
252256
ie = new InspectorText(this);
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//=============================================================================
2+
// MuseScore
3+
// Music Composition & Notation
4+
// $Id:$
5+
//
6+
// Copyright (C) 2013 Werner Schweer
7+
//
8+
// This program is free software; you can redistribute it and/or modify
9+
// it under the terms of the GNU General Public License version 2
10+
// as published by the Free Software Foundation and appearing in
11+
// the file LICENSE.GPL
12+
//=============================================================================
13+
14+
#include "inspectorArpeggio.h"
15+
#include "musescore.h"
16+
#include "libmscore/arpeggio.h"
17+
#include "libmscore/score.h"
18+
19+
namespace Ms {
20+
21+
//---------------------------------------------------------
22+
// InspectorArpeggio
23+
//---------------------------------------------------------
24+
25+
InspectorArpeggio::InspectorArpeggio(QWidget* parent)
26+
: InspectorBase(parent)
27+
{
28+
e.setupUi(addWidget());
29+
g.setupUi(addWidget());
30+
31+
iList = {
32+
{ P_ID::COLOR, 0, false, e.color, e.resetColor },
33+
{ P_ID::VISIBLE, 0, false, e.visible, e.resetVisible },
34+
{ P_ID::USER_OFF, 0, false, e.offsetX, e.resetX },
35+
{ P_ID::USER_OFF, 1, false, e.offsetY, e.resetY },
36+
37+
{ P_ID::PLAY, 0, 0, g.playArpeggio, g.resetPlayArpeggio}
38+
};
39+
40+
mapSignals();
41+
}
42+
}
43+

mscore/inspector/inspectorArpeggio.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//=============================================================================
2+
// MuseScore
3+
// Music Composition & Notation
4+
// $Id:$
5+
//
6+
// Copyright (C) 2013 Werner Schweer and others
7+
//
8+
// This program is free software; you can redistribute it and/or modify
9+
// it under the terms of the GNU General Public License version 2
10+
// as published by the Free Software Foundation and appearing in
11+
// the file LICENSE.GPL
12+
//=============================================================================
13+
14+
#ifndef __INSPECTOR_ARPEGGIO_H__
15+
#define __INSPECTOR_ARPEGGIO_H__
16+
17+
#include "inspector.h"
18+
#include "ui_inspector_arpeggio.h"
19+
#include "libmscore/property.h"
20+
21+
namespace Ms {
22+
23+
//---------------------------------------------------------
24+
// InspectorArpeggio
25+
//---------------------------------------------------------
26+
27+
class InspectorArpeggio : public InspectorBase {
28+
Q_OBJECT
29+
30+
UiInspectorElement e;
31+
Ui::InspectorArpeggio g;
32+
33+
public:
34+
InspectorArpeggio(QWidget* parent);
35+
};
36+
37+
38+
} // namespace Ms
39+
#endif
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>InspectorArpeggio</class>
4+
<widget class="QWidget" name="InspectorArpeggio">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>270</width>
10+
<height>151</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string/>
15+
</property>
16+
<property name="accessibleName">
17+
<string>Glissando Inspector</string>
18+
</property>
19+
<layout class="QVBoxLayout" name="verticalLayout">
20+
<property name="spacing">
21+
<number>0</number>
22+
</property>
23+
<property name="leftMargin">
24+
<number>0</number>
25+
</property>
26+
<property name="topMargin">
27+
<number>0</number>
28+
</property>
29+
<property name="rightMargin">
30+
<number>0</number>
31+
</property>
32+
<property name="bottomMargin">
33+
<number>0</number>
34+
</property>
35+
<item>
36+
<widget class="QLabel" name="elementName">
37+
<property name="font">
38+
<font>
39+
<weight>75</weight>
40+
<bold>true</bold>
41+
</font>
42+
</property>
43+
<property name="accessibleName">
44+
<string/>
45+
</property>
46+
<property name="text">
47+
<string>Arpeggio</string>
48+
</property>
49+
<property name="alignment">
50+
<set>Qt::AlignCenter</set>
51+
</property>
52+
</widget>
53+
</item>
54+
<item>
55+
<widget class="QFrame" name="frame">
56+
<property name="minimumSize">
57+
<size>
58+
<width>0</width>
59+
<height>6</height>
60+
</size>
61+
</property>
62+
<property name="frameShape">
63+
<enum>QFrame::HLine</enum>
64+
</property>
65+
<property name="frameShadow">
66+
<enum>QFrame::Raised</enum>
67+
</property>
68+
<property name="lineWidth">
69+
<number>2</number>
70+
</property>
71+
</widget>
72+
</item>
73+
<item>
74+
<layout class="QGridLayout" name="gridLayout">
75+
<property name="leftMargin">
76+
<number>3</number>
77+
</property>
78+
<property name="rightMargin">
79+
<number>3</number>
80+
</property>
81+
<property name="horizontalSpacing">
82+
<number>3</number>
83+
</property>
84+
<property name="verticalSpacing">
85+
<number>0</number>
86+
</property>
87+
<item row="0" column="0">
88+
<widget class="QCheckBox" name="playArpeggio">
89+
<property name="text">
90+
<string>Play</string>
91+
</property>
92+
<property name="checked">
93+
<bool>false</bool>
94+
</property>
95+
</widget>
96+
</item>
97+
<item row="0" column="1">
98+
<widget class="QToolButton" name="resetPlayArpeggio">
99+
<property name="accessibleName">
100+
<string>Reset Play value</string>
101+
</property>
102+
<property name="text">
103+
<string notr="true">...</string>
104+
</property>
105+
</widget>
106+
</item>
107+
</layout>
108+
</item>
109+
</layout>
110+
</widget>
111+
<resources/>
112+
<connections/>
113+
</ui>

0 commit comments

Comments
 (0)