Skip to content

Commit

Permalink
fix #22128: slurs in guitar pro
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Oct 15, 2013
1 parent 1c5b63d commit 0d796ba
Show file tree
Hide file tree
Showing 6 changed files with 361 additions and 0 deletions.
22 changes: 22 additions & 0 deletions libmscore/excerpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,28 @@ void cloneStaff(Staff* srcStaff, Staff* dstStaff)
}
}
}

for (auto i : score->spanner()) {
Spanner* s = i.second;
int staffIdx = s->staffIdx();
int dstTrack = -1;
int dstTrack2 = -1;
if(s->type() != Element::VOLTA) {
//export other spanner if staffidx matches
if (srcStaffIdx == staffIdx) {
dstTrack = dstStaffIdx * VOICES + s->voice();
dstTrack2 = dstStaffIdx * VOICES + (s->track2() % VOICES);
}
}
if (dstTrack == -1)
continue;
Spanner* ns = static_cast<Spanner*>(s->linkedClone());
ns->setScore(score);
ns->setParent(0);
ns->setTrack(dstTrack);
ns->setTrack2(dstTrack2);
score->addSpanner(ns);
}
}

}
Expand Down
1 change: 1 addition & 0 deletions mscore/importgtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1934,6 +1934,7 @@ void GuitarPro4::read(QFile* fp)
slur->setTick(cr->tick());
slur->setTick2(cr->tick());
slurs[staffIdx] = slur;
score->addElement(slur);
}
else if (slurs[staffIdx] && !hasSlur) {
// TODO: check slur
Expand Down
Binary file added mtest/guitarpro/slur.gp4
Binary file not shown.
336 changes: 336 additions & 0 deletions mtest/guitarpro/slur.gp4-ref.mscx
Original file line number Diff line number Diff line change
@@ -0,0 +1,336 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="1.24">
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<page-layout>
<page-height>1683.78</page-height>
<page-width>1190.55</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</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>56.6929</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="copyright"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle"></metaTag>
<PageList>
<Page>
<System>
</System>
<System>
</System>
</Page>
</PageList>
<Part>
<Staff id="1">
<type>0</type>
</Staff>
<trackName>Track 1</trackName>
<Instrument>
<longName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Track 1<!--EndFragment--></p></body></html>
</longName>
<trackName></trackName>
<StringData>
<frets>24</frets>
<string>40</string>
<string>45</string>
<string>50</string>
<string>55</string>
<string>59</string>
<string>64</string>
</StringData>
<Channel name="normal">
<program value="25"/>
<controller ctrl="7" value="127"/>
<controller ctrl="10" value="63"/>
<controller ctrl="93" value="255"/>
<controller ctrl="91" value="255"/>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<VBox>
<height>10</height>
</VBox>
<Measure number="1">
<Clef>
<concertClefType>G8vb</concertClefType>
<transposingClefType>G8vb</transposingClefType>
</Clef>
<KeySig>
<lid>0</lid>
<accidental>0</accidental>
</KeySig>
<TimeSig>
<lid>1</lid>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Tempo>
<tempo>2</tempo>
<lid>2</lid>
<style>Tempo</style>
<text>𝅘𝅥 = 120 </text>
</Tempo>
<Slur id="2">
<lid>9</lid>
</Slur>
<Chord>
<lid>3</lid>
<durationType>quarter</durationType>
<Note>
<lid>4</lid>
<pitch>62</pitch>
<tpc>16</tpc>
<fret>3</fret>
<string>1</string>
</Note>
</Chord>
<endSpanner id="2"/>
<Chord>
<lid>5</lid>
<durationType>quarter</durationType>
<Note>
<lid>6</lid>
<pitch>59</pitch>
<tpc>19</tpc>
<fret>0</fret>
<string>1</string>
</Note>
</Chord>
<Rest>
<lid>7</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>8</lid>
<durationType>quarter</durationType>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<createMultiMeasureRests>1</createMultiMeasureRests>
<page-layout>
<page-height>1683.78</page-height>
<page-width>1190.55</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</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>56.6929</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>
<PageList>
<Page>
<System>
</System>
<System>
</System>
</Page>
</PageList>
<Part>
<Staff id="1">
<linkedTo>1</linkedTo>
<type>14</type>
<bracket type="0" span="2"/>
</Staff>
<Staff id="2">
<linkedTo>1</linkedTo>
<type>5</type>
<bracket type="-1" span="0"/>
</Staff>
<trackName></trackName>
<Instrument>
<longName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->Track 1<!--EndFragment--></p></body></html>
</longName>
<trackName></trackName>
<StringData>
<frets>24</frets>
<string>40</string>
<string>45</string>
<string>50</string>
<string>55</string>
<string>59</string>
<string>64</string>
</StringData>
<Channel name="normal">
<program value="25"/>
<controller ctrl="7" value="127"/>
<controller ctrl="10" value="63"/>
<controller ctrl="93" value="255"/>
<controller ctrl="91" value="255"/>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<VBox>
<height>10</height>
<Text>
<style>InstrumentsExcerpt</style>
<text>Track 1</text>
</Text>
</VBox>
<Measure number="1">
<Clef>
<concertClefType>G8vb</concertClefType>
<transposingClefType>G8vb</transposingClefType>
</Clef>
<KeySig>
<lid>0</lid>
<accidental>0</accidental>
</KeySig>
<TimeSig>
<lid>1</lid>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Tempo>
<tempo>2</tempo>
<lid>2</lid>
<style>Tempo</style>
<text>𝅘𝅥 = 120 </text>
</Tempo>
<Slur id="3">
<lid>9</lid>
</Slur>
<Chord>
<lid>3</lid>
<durationType>quarter</durationType>
<Note>
<lid>4</lid>
<pitch>62</pitch>
<tpc>16</tpc>
<fret>3</fret>
<string>1</string>
</Note>
</Chord>
<endSpanner id="3"/>
<Chord>
<lid>5</lid>
<durationType>quarter</durationType>
<Note>
<lid>6</lid>
<pitch>59</pitch>
<tpc>19</tpc>
<fret>0</fret>
<string>1</string>
</Note>
</Chord>
<Rest>
<lid>7</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>8</lid>
<durationType>quarter</durationType>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<Staff id="2">
<Measure number="1">
<Clef>
<concertClefType>G8vb</concertClefType>
<transposingClefType>TAB2</transposingClefType>
</Clef>
<KeySig>
<lid>0</lid>
<accidental>0</accidental>
</KeySig>
<Slur id="4">
<lid>9</lid>
</Slur>
<Chord>
<lid>3</lid>
<durationType>quarter</durationType>
<Note>
<lid>4</lid>
<pitch>62</pitch>
<tpc>16</tpc>
<fret>3</fret>
<string>1</string>
</Note>
</Chord>
<endSpanner id="4"/>
<Chord>
<lid>5</lid>
<durationType>quarter</durationType>
<Note>
<lid>6</lid>
<pitch>59</pitch>
<tpc>19</tpc>
<fret>0</fret>
<string>1</string>
</Note>
</Chord>
<Rest>
<lid>7</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>8</lid>
<durationType>quarter</durationType>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<name>Track 1</name>
</Score>
</Score>
</museScore>
1 change: 1 addition & 0 deletions mtest/guitarpro/tst_guitarpro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class TestGuitarPro : public QObject, public MTest
private slots:
void initTestCase();
void gpTestIrrTuplet() { gpReadTest("testIrrTuplet", "gp4"); }
void gpSlur() { gpReadTest("slur", "gp4"); }
};

//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions mtest/guitarpro/updateReference
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
MSCORE=../../build.debug/mtest/guitarpro

cp $MSCORE/testIrrTuplet.gp4.mscx testIrrTuplet.gp4-ref.mscx
cp $MSCORE/slur.gp4.mscx slur.gp4-ref.mscx


0 comments on commit 0d796ba

Please sign in to comment.