use of com.xenoage.zong.io.musicxml.in.MusicXmlScoreFileInput in project Zong by Xenoage.
the class ScoreLayouterTest method testSampleFiles.
/**
* Try to layout all official MusicXML 1.1 and 2.0 sample files.
* We can not test for the correct layout of course, but at least
* we want to have no exceptions.
*/
@Test
public void testSampleFiles() throws Exception {
SymbolPool symbolPool = sync(new SymbolPoolReader("default"));
LayoutSettings layoutSettings = LayoutSettingsReader.read(jsePlatformUtils().openFile("data/test/layout/LayoutSettingsTest.xml"));
for (String file : MusicXmlScoreFileInputTest.getSampleFiles()) {
try {
// System.out.println(file);
Score score = new MusicXmlScoreFileInput().read(jsePlatformUtils().openFile(file), file);
Size2f areaSize = new Size2f(150, 10000);
Context context = new Context(score, symbolPool, layoutSettings);
Target target = Target.completeLayoutTarget(new ScoreLayoutArea(areaSize));
ScoreLayouter layouter = new ScoreLayouter(context, target);
layouter.createLayoutWithExceptions();
} catch (Exception ex) {
ex.printStackTrace();
fail("Failed to layout file: " + file);
}
}
}
use of com.xenoage.zong.io.musicxml.in.MusicXmlScoreFileInput in project Zong by Xenoage.
the class MidiConverterTest method testSampleFiles.
@Test
public void testSampleFiles() {
boolean writeFiles = true;
for (String file : MusicXmlScoreFileInputTest.getSampleFiles()) {
try {
val score = new MusicXmlScoreFileInput().read(jsePlatformUtils().openFile(file), file);
val sequence = MidiConverter.convertToSequence(score, optionsForPlayback, new JseMidiSequenceWriter());
if (writeFiles) {
// try: write to file
new File("temp").mkdirs();
System.out.println("Converting: " + file);
MidiSystem.write(sequence.getSequence(), 1, new File("temp/" + file.replaceAll("/", "_") + ".mid"));
}
} catch (Exception ex) {
ex.printStackTrace();
fail("Failed to load file: " + file);
}
}
}
use of com.xenoage.zong.io.musicxml.in.MusicXmlScoreFileInput in project Zong by Xenoage.
the class MusicXmlInTest method getScoreOrException.
default Score getScoreOrException() throws Exception {
Base base = (Base) this;
String filepath = Base.dirPath + base.getFileName();
return new MusicXmlScoreFileInput().read(jsePlatformUtils().openFile(filepath), filepath);
}
Aggregations