Fix #23055: Support for tremolos in GP4 and GP5 file formats.

This commit is contained in:
John Pirie 2014-03-12 17:36:43 +00:00
parent d7ecbb10a2
commit 66843ffd92
5 changed files with 363 additions and 4 deletions

View file

@ -20,6 +20,7 @@
#include "libmscore/part.h"
#include "libmscore/measure.h"
#include "libmscore/timesig.h"
#include "libmscore/tremolo.h"
#include "libmscore/rest.h"
#include "libmscore/chord.h"
#include "libmscore/note.h"
@ -1573,8 +1574,25 @@ void GuitarPro4::readNote(int string, Note* note, GpNote* gpNote)
}
if (modMask2 & 0x2) { // palm mute - mute the whole column
}
if (modMask2 & 0x4) // tremolo picking length
readUChar();
if (modMask2 & 0x4) { // tremolo picking length
int tremoloDivision = readUChar();
Chord* chord = note->chord();
Tremolo* t = new Tremolo(chord->score());
if (tremoloDivision == 1) {
t->setTremoloType(TREMOLO_R8);
chord->add(t);
}
else if (tremoloDivision == 2) {
t->setTremoloType(TREMOLO_R16);
chord->add(t);
}
else if (tremoloDivision == 3) {
t->setTremoloType(TREMOLO_R32);
chord->add(t);
}
else
qDebug("Unknown tremolo value");
}
if (modMask2 & 0x8)
readUChar(); // slide kind
if (modMask2 & 0x10)
@ -2005,8 +2023,25 @@ void GuitarPro5::readNoteEffects(Note* note)
}
if (modMask2 & 0x2) { // palm mute - mute the whole column
}
if (modMask2 & 0x4) // tremolo picking length
readUChar();
if (modMask2 & 0x4) { // tremolo picking length
int tremoloDivision = readUChar();
Chord* chord = note->chord();
Tremolo* t = new Tremolo(chord->score());
if (tremoloDivision == 1) {
t->setTremoloType(TREMOLO_R8);
chord->add(t);
}
else if (tremoloDivision == 2) {
t->setTremoloType(TREMOLO_R16);
chord->add(t);
}
else if (tremoloDivision == 3) {
t->setTremoloType(TREMOLO_R32);
chord->add(t);
}
else
qDebug("Unknown tremolo value");
}
if (modMask2 & 0x8)
readUChar(); // slide kind
if (modMask2 & 0x10)

Binary file not shown.

View file

@ -0,0 +1,322 @@
<?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>
<Chord>
<lid>4</lid>
<durationType>quarter</durationType>
<Note>
<lid>5</lid>
<pitch>53</pitch>
<tpc>13</tpc>
<fret>3</fret>
<string>3</string>
</Note>
<Tremolo>
<subtype>r32</subtype>
</Tremolo>
</Chord>
<Rest>
<lid>6</lid>
<durationType>quarter</durationType>
</Rest>
<Chord>
<lid>7</lid>
<durationType>quarter</durationType>
<Note>
<lid>8</lid>
<pitch>59</pitch>
<tpc>19</tpc>
<fret>0</fret>
<string>1</string>
</Note>
<Tremolo>
<subtype>r8</subtype>
</Tremolo>
</Chord>
<Rest>
<lid>9</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">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>
<Chord>
<lid>4</lid>
<durationType>quarter</durationType>
<Note>
<lid>5</lid>
<pitch>53</pitch>
<tpc>13</tpc>
<fret>3</fret>
<string>3</string>
</Note>
</Chord>
<Rest>
<lid>6</lid>
<durationType>quarter</durationType>
</Rest>
<Chord>
<lid>7</lid>
<durationType>quarter</durationType>
<Note>
<lid>8</lid>
<pitch>59</pitch>
<tpc>19</tpc>
<fret>0</fret>
<string>1</string>
</Note>
</Chord>
<Rest>
<lid>9</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>1</lid>
<accidental>0</accidental>
</KeySig>
<Chord>
<lid>4</lid>
<durationType>quarter</durationType>
<Note>
<lid>5</lid>
<pitch>53</pitch>
<tpc>13</tpc>
<fret>3</fret>
<string>3</string>
</Note>
</Chord>
<Rest>
<lid>6</lid>
<durationType>quarter</durationType>
</Rest>
<Chord>
<lid>7</lid>
<durationType>quarter</durationType>
<Note>
<lid>8</lid>
<pitch>59</pitch>
<tpc>19</tpc>
<fret>0</fret>
<string>1</string>
</Note>
</Chord>
<Rest>
<lid>9</lid>
<durationType>quarter</durationType>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>
</Staff>
<name>Track 1</name>
</Score>
</Score>
</museScore>

View file

@ -36,6 +36,7 @@ private slots:
void gpSlur() { gpReadTest("slur", "gp4"); }
void gpSforzato() { gpReadTest("sforzato", "gp4"); }
void gpHeavyAccent() { gpReadTest("heavy-accent", "gp5"); }
void gpTremolos() { gpReadTest("tremolos", "gp5"); }
};
//---------------------------------------------------------

View file

@ -6,3 +6,4 @@ 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
cp $MSCORE/heavy-accent.gp4.mscx heavy-accent.gp4-ref.mscx
cp $MSCORE/tremolos.gp4.mscx tremolos.gp4-ref.mscx