updates for gtp import, fixes mtest testIrrTuplet.gp4

This commit is contained in:
Werner Schweer 2017-11-16 17:28:32 +01:00
parent 5b4553bb3c
commit 84a7ef93d3
6 changed files with 66 additions and 34 deletions

View file

@ -209,14 +209,13 @@ bool GuitarPro4::readNote(int string, int staffIdx, Note* note)
int d = readChar();
if (previousDynamic != d) {
previousDynamic = d;
//addDynamic(note, d);
// addDynamic(note, d); // TODO-ws ??
}
}
else if (previousDynamic != 0)
{
previousDynamic = 0;
//addDynamic(note, 0);
}
else if (previousDynamic) {
previousDynamic = 0;
//addDynamic(note, 0);
}
int fretNumber = -1;
if (noteBits & NOTE_FRET)
@ -773,8 +772,9 @@ bool GuitarPro4::read(QFile* fp)
measures = readInt();
staves = readInt();
curDynam.resize(staves * VOICES);
for (auto& i : curDynam) i = -1;
curDynam.resize(staves * VOICES);
for (auto& i : curDynam)
i = -1;
int tnumerator = 4;
int tdenominator = 4;
@ -832,7 +832,7 @@ bool GuitarPro4::read(QFile* fp)
createMeasures();
setTempo(tempo, score->firstMeasure());
setTempo(tempo, score->firstMeasure());
for (int i = 0; i < staves; ++i) {
int tuning[GP_MAX_STRING_NUMBER];
@ -890,7 +890,7 @@ bool GuitarPro4::read(QFile* fp)
Clef* clef = new Clef(score);
clef->setClefType(clefId);
clef->setTrack(i * VOICES);
Segment* segment = measure->getSegment(SegmentType::Clef, 0);
Segment* segment = measure->getSegment(SegmentType::HeaderClef, 0);
segment->add(clef);
if (capo > 0) {
@ -900,7 +900,7 @@ bool GuitarPro4::read(QFile* fp)
st->setParent(s);
st->setTrack(i * VOICES);
measure->add(st);
}
}
Channel* ch = instr->channel(0);
if (midiChannel == GP_DEFAULT_PERCUSSION_CHANNEL) {
@ -921,9 +921,9 @@ bool GuitarPro4::read(QFile* fp)
}
slurs = new Slur*[staves];
tupleKind.resize(staves);
for (auto& i : tupleKind)
i = 0;
tupleKind.resize(staves);
for (auto& i : tupleKind)
i = 0;
for (int i = 0; i < staves; ++i)
slurs[i] = 0;
@ -1110,7 +1110,7 @@ bool GuitarPro4::read(QFile* fp)
if (dynam != curDynam[track])
{
curDynam[track] = dynam;
//TODO-ws addDynamic(dynamic_cast<Chord*>(cr)->notes().first(), dynam);
addDynamic(toChord(cr)->notes().front(), dynam);
}
}

View file

@ -565,7 +565,7 @@ bool GuitarPro5::readTracks()
Clef* clef = new Clef(score);
clef->setClefType(clefId);
clef->setTrack(i * VOICES);
Segment* segment = measure->getSegment(SegmentType::Clef, 0);
Segment* segment = measure->getSegment(SegmentType::HeaderClef, 0);
segment->add(clef);
if (capo > 0) {
@ -1070,7 +1070,8 @@ bool GuitarPro5::readNoteEffects(Note* note)
gn->setFret(fret);
gn->setString(note->string());*/
int grace_pitch = note->staff()->part()->instrument()->stringData()->getPitch(note->string(), fret, nullptr, 0);
/*gn->setPitch(grace_pitch);
#if 0
gn->setPitch(grace_pitch);
gn->setTpcFromPitch();
Chord* gc = new Chord(score);
@ -1087,7 +1088,8 @@ bool GuitarPro5::readNoteEffects(Note* note)
gc->setNoteType(note_type);
gc->setMag(note->chord()->staff()->mag(0) * score->styleD(StyleIdx::graceNoteMag));
note->chord()->add(gc);
addDynamic(gn, dynamic);*/
addDynamic(gn, dynamic);
#endif
auto gnote = score->setGraceNote(note->chord(), grace_pitch, note_type, MScore::division / 2);
gnote->setString(note->string());
auto sd = note->part()->instrument()->stringData();
@ -1381,9 +1383,9 @@ bool GuitarPro5::readNote(int string, Note* note)
}
int fretNumber = 0;
if (noteBits & NOTE_FRET) {
fretNumber = readChar();
}
if (noteBits & NOTE_FRET) {
fretNumber = readChar();
}
if (noteBits & NOTE_FINGERING) {
int leftFinger = readUChar();

View file

@ -203,7 +203,7 @@ subdirs (
capella
biab
musicxml
# guitarpro
guitarpro
scripting
# testoves
zerberus/comments

View file

@ -120,6 +120,13 @@
<tpc>15</tpc>
<fret>8</fret>
<string>1</string>
<Glissando id="3">
<text>gliss.</text>
<subtype>0</subtype>
<lid>15</lid>
<diagonal>1</diagonal>
<anchor>3</anchor>
</Glissando>
</Note>
</Chord>
<Chord>
@ -134,15 +141,16 @@
<tpc>15</tpc>
<fret>8</fret>
<string>1</string>
<endSpanner id="3"/>
</Note>
</Chord>
<Chord>
<lid>15</lid>
<lid>16</lid>
<Tuplet>1</Tuplet>
<durationType>eighth</durationType>
<Beam>1</Beam>
<Note>
<lid>16</lid>
<lid>17</lid>
<Accidental>
<subtype>accidentalFlat</subtype>
</Accidental>
@ -159,7 +167,6 @@
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<createMultiMeasureRests>1</createMultiMeasureRests>
<Spatium>1.76389</Spatium>
</Style>
<showInvisible>1</showInvisible>
@ -285,13 +292,20 @@
<Beam>2</Beam>
<Note>
<lid>11</lid>
<Tie id="3">
<Tie id="4">
<lid>12</lid>
</Tie>
<pitch>67</pitch>
<tpc>15</tpc>
<fret>8</fret>
<string>1</string>
<Glissando id="5">
<text>gliss.</text>
<subtype>0</subtype>
<lid>15</lid>
<diagonal>1</diagonal>
<anchor>3</anchor>
</Glissando>
</Note>
</Chord>
<Chord>
@ -301,20 +315,21 @@
<Beam>2</Beam>
<Note>
<lid>14</lid>
<endSpanner id="3"/>
<endSpanner id="4"/>
<pitch>67</pitch>
<tpc>15</tpc>
<fret>8</fret>
<string>1</string>
<endSpanner id="5"/>
</Note>
</Chord>
<Chord>
<lid>15</lid>
<lid>16</lid>
<Tuplet>2</Tuplet>
<durationType>eighth</durationType>
<Beam>2</Beam>
<Note>
<lid>16</lid>
<lid>17</lid>
<Accidental>
<subtype>accidentalFlat</subtype>
</Accidental>
@ -366,13 +381,20 @@
<Beam>3</Beam>
<Note>
<lid>11</lid>
<Tie id="4">
<Tie id="6">
<lid>12</lid>
</Tie>
<pitch>67</pitch>
<tpc>15</tpc>
<fret>8</fret>
<string>1</string>
<Glissando id="7">
<text>gliss.</text>
<subtype>0</subtype>
<lid>15</lid>
<diagonal>1</diagonal>
<anchor>3</anchor>
</Glissando>
</Note>
</Chord>
<Chord>
@ -382,20 +404,21 @@
<Beam>3</Beam>
<Note>
<lid>14</lid>
<endSpanner id="4"/>
<endSpanner id="6"/>
<pitch>67</pitch>
<tpc>15</tpc>
<fret>8</fret>
<string>1</string>
<endSpanner id="7"/>
</Note>
</Chord>
<Chord>
<lid>15</lid>
<lid>16</lid>
<Tuplet>3</Tuplet>
<durationType>eighth</durationType>
<Beam>3</Beam>
<Note>
<lid>16</lid>
<lid>17</lid>
<pitch>75</pitch>
<tpc>11</tpc>
<fret>16</fret>

View file

@ -34,7 +34,8 @@ class TestGuitarPro : public QObject, public MTest
private slots:
void initTestCase();
void gpTestIrrTuplet() { gpReadTest("testIrrTuplet", "gp4"); }
void gpSlur() { gpReadTest("slur", "gp4"); }
#if 0
// void gpSlur() { gpReadTest("slur", "gp4"); }
void gpSforzato() { gpReadTest("sforzato", "gp4"); }
void gpHeavyAccent() { gpReadTest("heavy-accent", "gp5"); }
void gpTremolos() { gpReadTest("tremolos", "gp5"); }
@ -149,6 +150,7 @@ private slots:
void gpxOttava5() { gpReadTest("ottava5", "gpx"); }
void gpxChornamesKeyboard() { gpReadTest("chordnames_keyboard", "gpx"); }
void gpxClefs() { gpReadTest("clefs", "gpx"); }
#endif
};
//---------------------------------------------------------

View file

@ -8,6 +8,11 @@ fi
cp $MSCORE/testIrrTuplet.gp4.mscx testIrrTuplet.gp4-ref.mscx
exit
cp $MSCORE/slur.gp4.mscx slur.gp4-ref.mscx
cp $MSCORE/sforzato.gp4.mscx sforzato.gp4-ref.mscx
cp $MSCORE/heavy-accent.gp5.mscx heavy-accent.gp5-ref.mscx