This commit is contained in:
Leon Vinken 2013-04-30 16:49:15 +02:00
parent 2e88035bc7
commit e7cfc20f4c
5 changed files with 272 additions and 20 deletions

View file

@ -283,13 +283,12 @@ static int readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, int tick,
else
qDebug("Capella: unknown tuplet");
tuplet->setRatio(f);
tuplet->setBaseLen(d);
tuplet->setBaseLen(d); // TODO check if necessary (the MusicXML importer doesn't do this)
tuplet->setTrack(track);
tuplet->setTick(tick);
// tuplet->setParent(m);
tuplet->setParent(m);
int nn = ((tupletCount * ticks) * f.denominator()) / f.numerator();
tuplet->setDuration(Fraction::fromTicks(nn));
m->add(tuplet);
tuplet->setDuration(Fraction::fromTicks(nn)); // TODO check if necessary (the MusicXML importer doesn't do this)
}
}
@ -311,6 +310,10 @@ static int readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, int tick,
if (!o->invisible || voice == 0) {
Segment* s = m->getSegment(Segment::SegChordRest, tick);
Rest* rest = new Rest(score);
if (tuplet) {
rest->setTuplet(tuplet);
tuplet->add(rest);
}
TDuration d;
if (o->fullMeasures) {
d.setType(TDuration::V_MEASURE);
@ -326,7 +329,18 @@ static int readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, int tick,
s->add(rest);
processBasicDrawObj(o->objects, s, track);
}
tick += ticks;
if (tuplet) {
if (++nTuplet >= tupletCount) {
tick = tupletTick + tuplet->actualTicks();
tuplet = 0;
}
else {
tick += (ticks * tuplet->ratio().denominator()) / tuplet->ratio().numerator();
}
}
else
tick += ticks;
}
break;
case T_CHORD:
@ -357,13 +371,12 @@ static int readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, int tick,
else
qDebug("Capella: unknown tuplet");
tuplet->setRatio(f);
tuplet->setBaseLen(d);
tuplet->setBaseLen(d); // TODO check if necessary (the MusicXML importer doesn't do this)
tuplet->setTrack(track);
tuplet->setTick(tick);
// tuplet->setParent(m);
tuplet->setParent(m);
int nn = ((tupletCount * ticks) * f.denominator()) / f.numerator();
tuplet->setDuration(Fraction::fromTicks(nn));
m->add(tuplet);
tuplet->setDuration(Fraction::fromTicks(nn)); // TODO check if necessary (the MusicXML importer doesn't do this)
}
qDebug("Tuplet at %d: count: %d tri: %d prolonging: %d ticks %d objects %d",
tick, o->count, o->tripartite, o->isProlonging, ticks,
@ -371,7 +384,10 @@ static int readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, int tick,
}
Chord* chord = new Chord(score);
chord->setTuplet(tuplet);
if (tuplet) {
chord->setTuplet(tuplet);
tuplet->add(chord);
}
if (isgracenote) { // grace notes
SetCapGraceDuration(chord,o);
chord->setDuration(chord->durationType().fraction());

48
mtest/capella/io/iotest Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash
# simple standalone iotest for Capella import
# run mtest/capella/io directory as "./iotest"
# note that the debug build must be used with the -t option to get the beams right in the .mscx files
MSCORE=../../../build.debug/mscore/mscore
echo "---------------------------------------------"
echo "Regression Tests for MuseScore Capella import"
echo "---------------------------------------------"
echo
$MSCORE -v
echo
capfiles=`cat tst_capella_io.cpp | grep "{ capReadTest" | awk -F\" '{print $2}' | sort`
capxfiles=`cat tst_capella_io.cpp | grep "{ capxReadTest" | awk -F\" '{print $2}' | sort`
testcount=0
failures=0
captest() {
echo -n "testing load/save $1$2";
$MSCORE -t $1$2 -o mops.mscx &> /dev/null
if diff -q $1$2-ref.mscx mops.mscx &> /dev/null; then
echo -e "\r\t\t\t\t\t\t...OK";
else
echo -e "\r\t\t\t\t\t\t...FAILED";
failures=$(($failures+1));
echo "+++++++++DIFF++++++++++++++"
diff $1$2-ref.mscx mops.mscx
echo "+++++++++++++++++++++++++++"
fi
rm mops.mscx
testcount=$(($testcount+1))
}
echo "Capella files ..."
for f in $capfiles; do
captest ${f} .cap
done
echo "CapellaXML files ..."
for f in $capxfiles; do
captest ${f} .capx
done
echo
echo "$testcount test(s), $failures failure(s)"

Binary file not shown.

View file

@ -0,0 +1,187 @@
<?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>
<minSystemDistance>8</minSystemDistance>
<maxSystemDistance>12</maxSystemDistance>
<measureSpacing>1</measureSpacing>
<smallStaffMag>0.681818</smallStaffMag>
<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.76</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></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="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /><!--EndFragment--></p></body></html>
</longName>
<shortName pos="0">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /><!--EndFragment--></p></body></html>
</shortName>
<trackName></trackName>
<Channel name="normal">
<program value="24"/>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<VBox>
<height>14</height>
</VBox>
<Measure number="1">
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>60</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Beam id="1">
<l1>7</l1>
<l2>7</l2>
</Beam>
<Tuplet id="1">
<normalNotes>2</normalNotes>
<actualNotes>3</actualNotes>
<baseNote>eighth</baseNote>
<Number>
<style>Tuplets</style>
<text>3</text>
</Number>
</Tuplet>
<Chord>
<Tuplet>1</Tuplet>
<durationType>eighth</durationType>
<Beam>1</Beam>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<Tuplet>1</Tuplet>
<durationType>eighth</durationType>
<Beam>1</Beam>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<Tuplet>1</Tuplet>
<durationType>eighth</durationType>
<Beam>1</Beam>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>64</pitch>
<tpc>18</tpc>
</Note>
</Chord>
</Measure>
<Measure number="2">
<LayoutBreak>
<subtype>line</subtype>
<pause>3</pause>
</LayoutBreak>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>60</pitch>
<tpc>14</tpc>
</Note>
</Chord>
<Tuplet id="2">
<normalNotes>2</normalNotes>
<actualNotes>3</actualNotes>
<baseNote>eighth</baseNote>
<Number>
<style>Tuplets</style>
<text>3</text>
</Number>
</Tuplet>
<Chord>
<Tuplet>2</Tuplet>
<durationType>eighth</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Rest>
<Tuplet>2</Tuplet>
<durationType>eighth</durationType>
</Rest>
<Chord>
<Tuplet>2</Tuplet>
<durationType>eighth</durationType>
<Note>
<pitch>62</pitch>
<tpc>16</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>64</pitch>
<tpc>18</tpc>
</Note>
</Chord>
</Measure>
</Staff>
</Score>
</museScore>

View file

@ -40,21 +40,22 @@ private slots:
void capTest1() { capReadTest("test1"); }
void capTest2() { capReadTest("test2"); }
// void capTest3() { capReadTest("test3"); } generates spurious natural accidental
// void capTest4() { capReadTest("test4"); } generates spurious natural accidental
// void capTest5() { capReadTest("test5"); } generates spurious natural accidental
// void capTest6() { capReadTest("test6"); } generates spurious natural accidental
// void capTest7() { capReadTest("test7"); } generates different (incorrect ?) l1 and l2 values in beams
// void capTest3() { capReadTest("test3"); } // generates spurious natural accidental
// void capTest4() { capReadTest("test4"); } // generates spurious natural accidental
// void capTest5() { capReadTest("test5"); } // generates spurious natural accidental
// void capTest6() { capReadTest("test6"); } // generates spurious natural accidental
// void capTest7() { capReadTest("test7"); } // generates different (incorrect ?) l1 and l2 values in beams
void capTest8() { capReadTest("test8"); }
void capxTest1() { capxReadTest("test1"); }
void capxTest2() { capxReadTest("test2"); }
// void capxTest3() { capxReadTest("test3"); } generates spurious natural accidental
// void capxTest4() { capxReadTest("test4"); } generates spurious natural accidental
// void capxTest5() { capxReadTest("test5"); } generates spurious natural accidental
// void capxTest6() { capxReadTest("test6"); } generates spurious natural accidental
// void capxTest7() { capxReadTest("test7"); } generates different (incorrect ?) l1 and l2 values in beams
// void capxTest3() { capxReadTest("test3"); } // generates spurious natural accidental
// void capxTest4() { capxReadTest("test4"); } // generates spurious natural accidental
// void capxTest5() { capxReadTest("test5"); } // generates spurious natural accidental
// void capxTest6() { capxReadTest("test6"); } // generates spurious natural accidental
// void capxTest7() { capxReadTest("test7"); } // generates different (incorrect ?) l1 and l2 values in beams
void capxTestPianoG4G5() { capxReadTest("testPianoG4G5"); }
void capxTestScaleC4C5() { capxReadTest("testScaleC4C5"); }
// void capxTestTuplet1() { capxReadTest("testTuplet1"); } // generates different (incorrect ?) l1 and l2 values in beams
};
//---------------------------------------------------------