use of com.xenoage.zong.io.ScoreDocFactory in project Zong by Xenoage.
the class MusicXmlScoreDocFileReader method read.
public Promise<ScoreDoc> read() {
return new Promise<>(ret -> {
MusicXmlFileReader reader = new MusicXmlFileReader(stream, filePath, new AllFilter<>());
reader.produce(new AsyncResult<List<Score>>() {
@Override
public void onSuccess(List<Score> scores) {
if (scores.size() == 0) {
// no score was opened
ret.resolve(null);
} else {
// open first selected score
Score score = scores.get(0);
ScoreDoc scoreDoc;
try {
scoreDoc = new ScoreDocFactory().read(score);
// add credit elements - TIDY
Object o = score.getMetaData().get("mxldoc");
if (o != null && o instanceof MxlScorePartwise) {
MxlScorePartwise doc = (MxlScorePartwise) o;
CreditsReader.read(doc, scoreDoc.getLayout(), score.getFormat());
}
ret.resolve(scoreDoc);
} catch (Exception ex) {
ret.reject(ex);
}
}
}
@Override
public void onFailure(Exception ex) {
ret.reject(ex);
}
});
});
}
Aggregations