fix #46401: breath segments placed too early

This commit is contained in:
Marc Sabatella 2015-02-06 09:01:41 -07:00
parent b9e10dfa9e
commit d79bd3a502
26 changed files with 895 additions and 69 deletions

View file

@ -773,11 +773,20 @@ Element* ChordRest::drop(const DropData& data)
case Element::Type::BREATH:
{
Breath* b = static_cast<Breath*>(e);
b->setTrack(staffIdx() * VOICES);
int track = staffIdx() * VOICES;
b->setTrack(track);
// find start tick of next note in staff
#if 0
int bt = tick() + actualTicks(); // this could make sense if we allowed breath marks in voice > 1
#else
Segment* next = segment()->nextCR(track);
int bt = next ? next->tick() : score()->lastSegment()->tick();
#endif
// TODO: insert automatically in all staves?
Segment* seg = m->undoGetSegment(Segment::Type::Breath, tick());
Segment* seg = m->undoGetSegment(Segment::Type::Breath, bt);
b->setParent(seg);
score()->undoAddElement(b);
}

View file

@ -817,16 +817,17 @@ void Measure::add(Element* el)
;
if (s) {
if (st == Segment::Type::ChordRest) {
// add ChordRest segment after all other segments with same tick
// except EndBarLine
while (s && s->segmentType() != st && s->tick() == t) {
if (s->segmentType() == Segment::Type::EndBarLine
|| s->segmentType() == Segment::Type::Breath // place chord _before_ breath
) {
if (s->segmentType() == Segment::Type::EndBarLine) {
break;
}
s = s->next();
}
}
else {
// use order of segments in segment.h
if (s && s->tick() == t) {
while (s && s->segmentType() <= st) {
if (s->next() && s->next()->tick() != t)
@ -834,11 +835,6 @@ void Measure::add(Element* el)
s = s->next();
}
}
//
// place breath _after_ chord
//
if (s && st == Segment::Type::Breath)
s = s->next();
}
}
seg->setParent(this);
@ -1941,10 +1937,25 @@ void Measure::read(XmlReader& e, int staffIdx)
breath->setTrack(e.track());
int tick = e.tick();
breath->read(e);
if (e.tick() < tick)
tick = e.tick(); // use our own tick if we explicitly reset to earlier position
else
tick = lastTick; // otherwise use last tick (of previous tick, chord, or rest tag)
if (score()->mscVersion() < 205) {
// older scores placed the breath segment right after the chord to which it applies
// rather than before the next chordrest segment with an element for the staff
// result would be layout too far left if there are other segments due to notes in other staves
// we need to find tick of chord to which this applies, and add its duration
int prevTick;
if (e.tick() < tick)
prevTick = e.tick(); // use our own tick if we explicitly reset to earlier position
else
prevTick = lastTick; // otherwise use tick of previous tick/chord/rest tag
// find segment
Segment* prev = findSegment(Segment::Type::ChordRest, prevTick);
if (prev) {
// find chordrest
ChordRest* lastCR = static_cast<ChordRest*>(prev->element(e.track()));
if (lastCR)
tick = prevTick + lastCR->actualTicks();
}
}
segment = getSegment(Segment::Type::Breath, tick);
segment->add(breath);
}

View file

@ -15,8 +15,8 @@
namespace Ms {
#define MSC_VERSION "2.04"
static const int MSCVERSION = 204;
#define MSC_VERSION "2.05"
static const int MSCVERSION = 205;
// History:
// 1.3 added staff->_barLineSpan
@ -50,6 +50,7 @@ static const int MSCVERSION = 204;
// 2.02 save instrumentId, note slashes
// 2.03 save Box topGap, bottomGap in spatium units
// 2.04 added hideSystemBarLine flag to Staff
// 2.05 breath segment changed to use tick of following chord rather than preceding chord

View file

@ -511,19 +511,12 @@ void Score::fixTicks()
if (s->segmentType() == Segment::Type::Breath) {
qreal length = 0.0;
int tick = s->tick();
// find breath elements
// find longest pause
for (int i = 0, n = ntracks(); i < n; ++i) {
Element* e = s->element(i);
if (e && e->type() == Element::Type::BREATH) {
Breath* b = static_cast<Breath*>(e);
length = qMax(length, b->pause());
// find start tick of next note
// currently, breaths are always added in voice 0
Segment* next = s->nextCR(i);
if (next)
tick = qMax(tick, next->tick());
else
tick = lastSegment()->tick();
}
}
if (length != 0.0)

View file

@ -75,8 +75,8 @@ public:
TimeSig = 0x8,
StartRepeatBarLine = 0x10,
BarLine = 0x20,
ChordRest = 0x40,
Breath = 0x80,
Breath = 0x40,
ChordRest = 0x80,
EndBarLine = 0x100,
TimeSigAnnounce = 0x200,
KeySigAnnounce = 0x400,

View file

@ -1267,6 +1267,9 @@ void Score::undoAddElement(Element* element)
Breath* breath = static_cast<Breath*>(element);
int tick = breath->segment()->tick();
Measure* m = score->tick2measure(tick);
// breath appears before barline
if (m->tick() == tick)
m = m->prevMeasure();
Segment* seg = m->undoGetSegment(Segment::Type::Breath, tick);
Breath* nbreath = static_cast<Breath*>(ne);
int ntrack = staffIdx * VOICES + nbreath->voice();

View file

@ -221,7 +221,7 @@ static void processBasicDrawObj(QList<BasicDrawObj*> objects, Segment* s, int tr
Breath* b = new Breath(score);
b->setTrack(track);
b->setBreathType(3);
Segment* seg = s->measure()->getSegment(Segment::Type::Breath, s->tick());
Segment* seg = s->measure()->getSegment(Segment::Type::Breath, s->tick() + cr ? cr->actualTicks() : 0);
seg->add(b);
}
break;

View file

@ -1685,12 +1685,9 @@ void ExportMusicXml::wavyLineStartStop(Chord* chord, Notations& notations, Ornam
static Breath* hasBreathMark(Chord* ch)
{
Segment* s = ch->segment();
s = s->next1();
Breath* b = 0;
if (s && s->segmentType() == Segment::Type::Breath)
b = static_cast<Breath*>(s->element(ch->track()));
return b;
int tick = ch->tick() + ch->actualTicks();
Segment* s = ch->measure()->findSegment(Segment::Type::Breath, tick);
return s ? static_cast<Breath*>(s->element(ch->track())) : 0;
}
//---------------------------------------------------------
@ -4698,12 +4695,9 @@ void ExportMusicXml::write(QIODevice* dev)
continue;
// generate backup or forward to the start time of the element
// but not for breath, which has the same start time as the
// previous note, while tick is already at the end of that note
if (tick != seg->tick()) {
attr.doAttr(xml, false);
if (el->type() != Element::Type::BREATH)
moveToTick(seg->tick());
moveToTick(seg->tick());
}
// handle annotations and spanners (directions attached to this note or rest)

View file

@ -1750,11 +1750,12 @@ void OveToMScore::convertArticulation(
case OVE::ArticulationType::Pause :{
Breath* b = new Breath(score_);
b->setTrack(track);
Segment* seg = measure->getSegment(Segment::Type::Breath, absTick);
Segment* seg = measure->getSegment(Segment::Type::Breath, absTick + cr ? cr->actualTicks() : 0);
seg->add(b);
break;
}
case OVE::ArticulationType::Grand_Pause :{
// TODO?
break;
}
case OVE::ArticulationType::Up_Bow :{

View file

@ -5085,7 +5085,7 @@ void MusicXml::xmlNotations(Note* note, ChordRest* cr, int trk, int tick, int ti
// b->setTrack(trk + voice); TODO check next line
b->setTrack(track);
b->setBreathType(breath);
Segment* seg = measure->getSegment(Segment::Type::Breath, tick);
Segment* seg = measure->getSegment(Segment::Type::Breath, tick + ticks);
seg->add(b);
}

View file

@ -12,7 +12,7 @@
#=============================================================================
subdirs(
album barline beam chordsymbol clef clef_courtesy compat concertpitch copypaste
album barline beam breath chordsymbol clef clef_courtesy compat concertpitch copypaste
copypastesymbollist dynamic element hairpin instrumentchange join keysig layout parts measure midi
note plugins repeat selectionfilter selectionrangedelete split splitstaff timesig tools transpose tuplet text
)

View file

@ -0,0 +1,17 @@
#=============================================================================
# MuseScore
# Music Composition & Notation
# $Id:$
#
# Copyright (C) 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 LICENSE.GPL
#=============================================================================
set(TARGET tst_breath)
include(${PROJECT_SOURCE_DIR}/mtest/cmake.inc)

View file

@ -0,0 +1,240 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="2.00">
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<lastSystemFillLimit>0</lastSystemFillLimit>
<page-layout>
<page-height>1584</page-height>
<page-width>1224</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>90.1417</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>56.6929</left-margin>
<right-margin>90.1417</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
</page-layout>
<Spatium>1.76389</Spatium>
</Style>
<showInvisible>1</showInvisible>
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<metaTag name="arranger"></metaTag>
<metaTag name="composer"></metaTag>
<metaTag name="copyright"></metaTag>
<metaTag name="lyricist"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="poet"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="translator"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle"></metaTag>
<PageList>
<Page>
<System>
</System>
</Page>
</PageList>
<Part>
<Staff id="1">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
<bracket type="-1" span="0"/>
</Staff>
<trackName>Flute</trackName>
<Instrument>
<longName pos="0">Flute</longName>
<shortName pos="0">Fl.</shortName>
<trackName>Flute</trackName>
<minPitchP>59</minPitchP>
<maxPitchP>98</maxPitchP>
<minPitchA>60</minPitchA>
<maxPitchA>93</maxPitchA>
<instrumentId>wind.flutes.flute</instrumentId>
<Articulation>
<velocity>100</velocity>
<gateTime>95</gateTime>
</Articulation>
<Articulation name="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="73"/>
</Channel>
</Instrument>
</Part>
<Part>
<Staff id="2">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
</Staff>
<trackName>Piano</trackName>
<Instrument>
<longName pos="0">Piano</longName>
<shortName pos="0">Pno.</shortName>
<trackName>Piano</trackName>
<minPitchP>21</minPitchP>
<maxPitchP>108</maxPitchP>
<minPitchA>21</minPitchA>
<maxPitchA>108</maxPitchA>
<instrumentId>keyboard.piano</instrumentId>
<clef staff="2">F</clef>
<Articulation>
<velocity>100</velocity>
<gateTime>95</gateTime>
</Articulation>
<Articulation name="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="0"/>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<Measure number="1">
<KeySig>
<accidental>0</accidental>
</KeySig>
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Chord>
<dots>1</dots>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
</Measure>
<Measure number="2">
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<Staff id="2">
<Measure number="1">
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
</Measure>
<Measure number="2">
<Chord>
<dots>1</dots>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
</Score>
</museScore>

View file

@ -0,0 +1,261 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="2.00">
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<lastSystemFillLimit>0</lastSystemFillLimit>
<page-layout>
<page-height>1584</page-height>
<page-width>1224</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>90.1417</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>56.6929</left-margin>
<right-margin>90.1417</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
</page-layout>
<Spatium>1.76389</Spatium>
</Style>
<showInvisible>1</showInvisible>
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<metaTag name="arranger"></metaTag>
<metaTag name="composer"></metaTag>
<metaTag name="copyright"></metaTag>
<metaTag name="lyricist"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="poet"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="translator"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle"></metaTag>
<PageList>
<Page>
<System>
</System>
</Page>
</PageList>
<Part>
<Staff id="1">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
<bracket type="-1" span="0"/>
</Staff>
<trackName>Flute</trackName>
<Instrument>
<longName pos="0">Flute</longName>
<shortName pos="0">Fl.</shortName>
<trackName>Flute</trackName>
<minPitchP>59</minPitchP>
<maxPitchP>98</maxPitchP>
<minPitchA>60</minPitchA>
<maxPitchA>93</maxPitchA>
<instrumentId>wind.flutes.flute</instrumentId>
<Articulation>
<velocity>100</velocity>
<gateTime>95</gateTime>
</Articulation>
<Articulation name="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="73"/>
</Channel>
</Instrument>
</Part>
<Part>
<Staff id="2">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
</Staff>
<trackName>Piano</trackName>
<Instrument>
<longName pos="0">Piano</longName>
<shortName pos="0">Pno.</shortName>
<trackName>Piano</trackName>
<minPitchP>21</minPitchP>
<maxPitchP>108</maxPitchP>
<minPitchA>21</minPitchA>
<maxPitchA>108</maxPitchA>
<instrumentId>keyboard.piano</instrumentId>
<clef staff="2">F</clef>
<Articulation>
<velocity>100</velocity>
<gateTime>95</gateTime>
</Articulation>
<Articulation name="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="0"/>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<Measure number="1">
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Chord>
<dots>1</dots>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Breath>
<subtype>0</subtype>
</Breath>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Breath>
<subtype>0</subtype>
</Breath>
</Measure>
<Measure number="2">
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Breath>
<subtype>0</subtype>
</Breath>
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Breath>
<subtype>0</subtype>
</Breath>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<Staff id="2">
<Measure number="1">
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Breath>
<subtype>0</subtype>
</Breath>
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Breath>
<subtype>0</subtype>
</Breath>
</Measure>
<Measure number="2">
<Chord>
<dots>1</dots>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Breath>
<subtype>0</subtype>
</Breath>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Breath>
<subtype>0</subtype>
</Breath>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
</Score>
</museScore>

View file

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="2.00">
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<lastSystemFillLimit>0</lastSystemFillLimit>
<page-layout>
<page-height>1584</page-height>
<page-width>1224</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>90.1417</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>56.6929</left-margin>
<right-margin>90.1417</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
</page-layout>
<Spatium>1.76389</Spatium>
</Style>
<showInvisible>1</showInvisible>
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<metaTag name="arranger"></metaTag>
<metaTag name="composer"></metaTag>
<metaTag name="copyright"></metaTag>
<metaTag name="lyricist"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="poet"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="translator"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle"></metaTag>
<PageList>
<Page>
<System>
</System>
</Page>
</PageList>
<Part>
<Staff id="1">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
<bracket type="-1" span="0"/>
</Staff>
<trackName>Flute</trackName>
<Instrument>
<longName pos="0">Flute</longName>
<shortName pos="0">Fl.</shortName>
<trackName>Flute</trackName>
<minPitchP>59</minPitchP>
<maxPitchP>98</maxPitchP>
<minPitchA>60</minPitchA>
<maxPitchA>93</maxPitchA>
<instrumentId>wind.flutes.flute</instrumentId>
<Articulation>
<velocity>100</velocity>
<gateTime>95</gateTime>
</Articulation>
<Articulation name="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="73"/>
</Channel>
</Instrument>
</Part>
<Part>
<Staff id="2">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
</Staff>
<trackName>Piano</trackName>
<Instrument>
<longName pos="0">Piano</longName>
<shortName pos="0">Pno.</shortName>
<trackName>Piano</trackName>
<minPitchP>21</minPitchP>
<maxPitchP>108</maxPitchP>
<minPitchA>21</minPitchA>
<maxPitchA>108</maxPitchA>
<instrumentId>keyboard.piano</instrumentId>
<clef staff="2">F</clef>
<Articulation>
<velocity>100</velocity>
<gateTime>95</gateTime>
</Articulation>
<Articulation name="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="0"/>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<Measure number="1">
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Chord>
<dots>1</dots>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
</Measure>
<Measure number="2">
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<Staff id="2">
<Measure number="1">
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
</Measure>
<Measure number="2">
<Chord>
<dots>1</dots>
<durationType>half</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>72</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
</Score>
</museScore>

View file

@ -0,0 +1,86 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id:$
//
// Copyright (C) 2012 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 <QtTest/QtTest>
#include "mtest/testutils.h"
#include "libmscore/score.h"
#include "libmscore/undo.h"
#include "libmscore/measure.h"
#include "libmscore/breath.h"
#define DIR QString("libmscore/breath/")
using namespace Ms;
//---------------------------------------------------------
// TestBreath
//---------------------------------------------------------
class TestBreath : public QObject, public MTest
{
Q_OBJECT
private slots:
void initTestCase();
void breath();
};
//---------------------------------------------------------
// initTestCase
//---------------------------------------------------------
void TestBreath::initTestCase()
{
initMTest();
}
//---------------------------------------------------------
// breath
//---------------------------------------------------------
void TestBreath::breath()
{
QString readFile(DIR + "breath.mscx");
QString writeFile1("breath01-test.mscx");
QString reference1(DIR + "breath01-ref.mscx");
QString writeFile2("breath02-test.mscx");
QString reference2(DIR + "breath02-ref.mscx");
Score* score = readScore(readFile);
score->doLayout();
// do
score->startCmd();
score->cmdSelectAll();
for (Element* e : score->selection().elements()) {
DropData dd;
dd.view = 0;
Breath* b = new Breath(score);
b->setBreathType(0);
dd.element = b;
if (e->acceptDrop(dd))
e->drop(dd);
}
score->endCmd();
QVERIFY(saveCompareScore(score, writeFile1, reference1));
// undo
score->undo()->undo();
QVERIFY(saveCompareScore(score, writeFile2, reference2));
delete score;
}
QTEST_MAIN(TestBreath)
#include "tst_breath.moc"

View file

@ -165,12 +165,10 @@
<tpc>16</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<lid>118</lid>
</Breath>
<tick>960</tick>
<Chord>
<lid>10</lid>
<durationType>quarter</durationType>
@ -804,12 +802,10 @@
<tpc>16</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<lid>118</lid>
</Breath>
<tick>960</tick>
<Chord>
<lid>10</lid>
<durationType>quarter</durationType>

View file

@ -170,12 +170,10 @@
<tpc>16</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<lid>10</lid>
</Breath>
<tick>960</tick>
<Chord>
<lid>11</lid>
<durationType>quarter</durationType>
@ -444,12 +442,10 @@
<tpc>17</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<lid>84</lid>
</Breath>
<tick>960</tick>
<Chord>
<lid>85</lid>
<durationType>quarter</durationType>
@ -822,12 +818,10 @@
<tpc>16</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<lid>10</lid>
</Breath>
<tick>960</tick>
<Chord>
<lid>11</lid>
<durationType>quarter</durationType>
@ -1197,12 +1191,10 @@
<tpc>17</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<lid>84</lid>
</Breath>
<tick>960</tick>
<Chord>
<lid>85</lid>
<durationType>quarter</durationType>

View file

@ -165,12 +165,10 @@
<tpc>16</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<lid>87</lid>
</Breath>
<tick>960</tick>
<Chord>
<lid>10</lid>
<durationType>quarter</durationType>
@ -804,12 +802,10 @@
<tpc>16</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<lid>87</lid>
</Breath>
<tick>960</tick>
<Chord>
<lid>10</lid>
<durationType>quarter</durationType>

View file

@ -165,12 +165,10 @@
<tpc>16</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<lid>119</lid>
</Breath>
<tick>960</tick>
<Chord>
<lid>10</lid>
<durationType>quarter</durationType>
@ -804,12 +802,10 @@
<tpc>16</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<lid>119</lid>
</Breath>
<tick>960</tick>
<Chord>
<lid>10</lid>
<durationType>quarter</durationType>

View file

@ -160,11 +160,9 @@
<tpc>16</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
</Breath>
<tick>960</tick>
<Chord>
<durationType>quarter</durationType>
<Note>
@ -392,11 +390,9 @@
<tpc>17</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
</Breath>
<tick>960</tick>
<Chord>
<durationType>quarter</durationType>
<Note>

View file

@ -21,12 +21,10 @@
<tpc>16</tpc>
</Note>
</Chord>
<tick>480</tick>
<Breath>
<subtype>0</subtype>
<track>0</track>
</Breath>
<tick>960</tick>
<Chord>
<track>0</track>
<durationType>quarter</durationType>
@ -45,7 +43,6 @@
<tpc>13</tpc>
</Note>
</Chord>
<tick>1440</tick>
<Breath>
<subtype>0</subtype>
<track>0</track>

BIN
vtest/breath-1-ref.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
vtest/breath-1.mscz Normal file

Binary file not shown.

View file

@ -44,7 +44,7 @@ else
chord-layout-11 chord-layout-12 chord-layout-13 chord-layout-14 chord-layout-15 cross-1\
accidental-1 accidental-2 accidental-3 accidental-4 accidental-5\
accidental-6 accidental-7 accidental-8 accidental-9\
tie-1 tie-2 tie-3 grace-1 grace-2 grace-3 grace-4 tuplets-1\
tie-1 tie-2 tie-3 grace-1 grace-2 grace-3 grace-4 tuplets-1 breath-1\
harmony-1 harmony-2 harmony-3 harmony-4 harmony-5 harmony-6 harmony-7 harmony-8 harmony-9 harmony-10 harmony-11\
beams-1 beams-2 beams-3 beams-4 beams-5 beams-6 beams-7 beams-8 beams-9\
user-offset-1 user-offset-2 chord-space-1 chord-space-2 tablature-1 image-1\

View file

@ -19,7 +19,7 @@ set SRC=mmrest-1,bravura-mmrest,gonville-mmrest,mmrest-2,mmrest-4,mmrest-5,mmres
chord-layout-11,chord-layout-12,chord-layout-13,chord-layout-14,chord-layout-15,cross-1, ^
accidental-1,accidental-2,accidental-3,accidental-4,accidental-5, ^
accidental-6,accidental-7,accidental-8,accidental-9, ^
tie-1,tie-2,tie-3,grace-1,grace-2,grace-3,grace-4,tuplets-1, ^
tie-1,tie-2,tie-3,grace-1,grace-2,grace-3,grace-4,tuplets-1,breath-1 ^
harmony-1,harmony-2,harmony-3,harmony-4,harmony-5,harmony-6,harmony-7,harmony-8,harmony-9,harmony-10,harmony-11, ^
beams-1,beams-2,beams-3,beams-4,beams-5,beams-6,beams-7,beams-8,beams-9, ^
user-offset-1,user-offset-2,chord-space-1,chord-space-2,tablature-1,image-1, ^