use of com.xenoage.zong.io.symbols.SymbolPoolReader in project Zong by Xenoage.
the class GwtZongPlatformUtils method init.
/**
* Initializes the {@link GwtZongPlatformUtils} as the {@link ZongPlatformUtils} instance
* and {@link GwtPlatformUtils} as the {@link PlatformUtils} instance.
*/
public static void init(final AsyncCallback finished) {
GwtPlatformUtils.init();
ZongPlatformUtils.init(instance);
// load default symbol pool
new SymbolPoolReader("default").produce(new AsyncResult<SymbolPool>() {
@Override
public void onSuccess(SymbolPool symbolPool) {
instance.symbolPool = symbolPool;
finished.onSuccess();
}
@Override
public void onFailure(Exception ex) {
finished.onFailure(ex);
}
});
}
use of com.xenoage.zong.io.symbols.SymbolPoolReader in project Zong by Xenoage.
the class DemoScoreLayoutTry method main.
public static void main(String... args) throws Exception {
SymbolPool symbolPool = sync(new SymbolPoolReader("default"));
LayoutSettings layoutSettings = LayoutSettingsReader.read(jsePlatformUtils().openFile("data/test/layout/LayoutSettingsTest.xml"));
try {
Score score = ScoreRevolutionary.createScore();
Size2f areaSize = new Size2f(150, 10000);
Context context = new Context(score, symbolPool, layoutSettings);
Target target = Target.completeLayoutTarget(new ScoreLayoutArea(areaSize));
ScoreLayout layout = new ScoreLayouter(context, target).createLayoutWithExceptions();
System.out.println(layout.toString());
} catch (Exception ex) {
ex.printStackTrace();
}
}
use of com.xenoage.zong.io.symbols.SymbolPoolReader 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);
}
}
}
Aggregations