Fix #23059: Accented notes in guitar pro files now displayed.

This commit is contained in:
John Pirie 2014-03-12 17:34:53 +00:00
parent 2277bc2058
commit 4683f250a0
5 changed files with 343 additions and 1 deletions

View file

@ -1539,6 +1539,14 @@ void GuitarPro4::readNote(int string, Note* note, GpNote* gpNote)
if (noteBits & 0x20)
fretNumber = readUChar();
// check if a note is supposed to be accented, and give it the sforzato type
if (noteBits & 0x40) {
Articulation* art = new Articulation(note->score());
art->setArticulationType(Articulation_Sforzatoaccent);
if (!note->score()->addArticulation(note, art))
delete art;
}
if (noteBits & 0x80) { // fingering
int a = readUChar();
int b = readUChar();
@ -2068,6 +2076,14 @@ void GuitarPro5::readNote(int string, Note* note)
if (noteBits & 0x1)
skip(8);
// check if a note is supposed to be accented, and give it the sforzato type
if (noteBits & 0x40) {
Articulation* art = new Articulation(note->score());
art->setArticulationType(Articulation_Sforzatoaccent);
if (!note->score()->addArticulation(note, art))
delete art;
}
/*int aa =*/ readUChar();
if (noteBits & 0x8) {
readNoteEffects(note);

Binary file not shown.

View file

@ -0,0 +1,325 @@
<?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">Track 1</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>
<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>
<lid>0</lid>
</VBox>
<Measure number="1">
<Clef>
<concertClefType>G8vb</concertClefType>
<transposingClefType>G8vb</transposingClefType>
</Clef>
<KeySig>
<lid>1</lid>
<accidental>0</accidental>
</KeySig>
<TimeSig>
<lid>2</lid>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Tempo>
<tempo>2</tempo>
<lid>3</lid>
<style>Tempo</style>
<text><sym>noteQuarterUp</sym> = 120</text>
</Tempo>
<Rest>
<lid>4</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>5</lid>
<durationType>quarter</durationType>
</Rest>
<Chord>
<lid>6</lid>
<durationType>quarter</durationType>
<Articulation>
<subtype>sforzato</subtype>
</Articulation>
<Note>
<lid>7</lid>
<pitch>59</pitch>
<tpc>19</tpc>
<fret>0</fret>
<string>1</string>
</Note>
</Chord>
<Rest>
<lid>8</lid>
<durationType>quarter</durationType>
</Rest>
</Measure>
<Measure number="2">
<Rest>
<lid>10</lid>
<durationType>measure</durationType>
<duration z="1" n="1"/>
</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">Track 1</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>
<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>
<lid>0</lid>
<Text>
<style>Instrument Name (Part)</style>
<text>Track 1</text>
</Text>
</VBox>
<Measure number="1">
<Clef>
<concertClefType>G8vb</concertClefType>
<transposingClefType>G8vb</transposingClefType>
</Clef>
<KeySig>
<lid>1</lid>
<accidental>0</accidental>
</KeySig>
<TimeSig>
<lid>2</lid>
<sigN>4</sigN>
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Tempo>
<tempo>2</tempo>
<lid>3</lid>
<style>Tempo</style>
<text><sym>noteQuarterUp</sym> = 120</text>
</Tempo>
<Rest>
<lid>4</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>5</lid>
<durationType>quarter</durationType>
</Rest>
<Chord>
<lid>6</lid>
<durationType>quarter</durationType>
<Articulation>
<subtype>sforzato</subtype>
</Articulation>
<Note>
<lid>7</lid>
<pitch>59</pitch>
<tpc>19</tpc>
<fret>0</fret>
<string>1</string>
</Note>
</Chord>
<Rest>
<lid>8</lid>
<durationType>quarter</durationType>
</Rest>
</Measure>
<Measure number="2">
<Rest>
<lid>10</lid>
<durationType>measure</durationType>
<duration z="1" n="1"/>
</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>1</lid>
<accidental>0</accidental>
</KeySig>
<Rest>
<lid>4</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>5</lid>
<durationType>quarter</durationType>
</Rest>
<Chord>
<lid>6</lid>
<durationType>quarter</durationType>
<Articulation>
<subtype>sforzato</subtype>
</Articulation>
<Note>
<lid>7</lid>
<pitch>59</pitch>
<tpc>19</tpc>
<fret>0</fret>
<string>1</string>
</Note>
</Chord>
<Rest>
<lid>8</lid>
<durationType>quarter</durationType>
</Rest>
</Measure>
<Measure number="2">
<Rest>
<lid>10</lid>
<durationType>measure</durationType>
<duration z="1" n="1"/>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<name>Track 1</name>
</Score>
</Score>
</museScore>

View file

@ -34,6 +34,7 @@ private slots:
void initTestCase();
void gpTestIrrTuplet() { gpReadTest("testIrrTuplet", "gp4"); }
void gpSlur() { gpReadTest("slur", "gp4"); }
void gpSforzato() { gpReadTest("sforzato", "gp4"); }
};
//---------------------------------------------------------

View file

@ -4,5 +4,5 @@ MSCORE=../../build.debug/mtest/guitarpro
cp $MSCORE/testIrrTuplet.gp4.mscx testIrrTuplet.gp4-ref.mscx
cp $MSCORE/slur.gp4.mscx slur.gp4-ref.mscx
cp $MSCORE/sforzato.gp4.mscx sforzato.gp4-ref.mscx