Search in sources :

Example 1 with OggScoreDocFileOutput

use of com.xenoage.zong.desktop.io.ogg.out.OggScoreDocFileOutput in project Zong by Xenoage.

the class Content method saveAs.

/**
 * Saves the current score using the given format.
 * pdf, png, mid and ogg is supported by this demo.
 */
public void saveAs(String format) {
    FileOutput<ScoreDoc> out = null;
    switch(format) {
        case "pdf":
            out = new PdfScoreDocFileOutput();
            break;
        case "png":
            out = new PngScoreDocFileOutput();
            break;
        case "mid":
            out = new MidiScoreDocFileOutput();
            break;
        case "ogg":
            out = new OggScoreDocFileOutput();
            break;
        default:
            return;
    }
    String filePath = "demo." + format;
    try {
        DocumentIO.write(scoreDoc, new File(filePath), out);
        mainWindow.showMessageDialog(filePath + " saved.");
    } catch (Exception ex) {
        Err.handle(Report.Companion.error(ex));
    }
}
Also used : PngScoreDocFileOutput(com.xenoage.zong.desktop.io.png.out.PngScoreDocFileOutput) OggScoreDocFileOutput(com.xenoage.zong.desktop.io.ogg.out.OggScoreDocFileOutput) PdfScoreDocFileOutput(com.xenoage.zong.desktop.io.pdf.out.PdfScoreDocFileOutput) MidiScoreDocFileOutput(com.xenoage.zong.desktop.io.midi.out.MidiScoreDocFileOutput) File(java.io.File) ScoreDoc(com.xenoage.zong.documents.ScoreDoc)

Aggregations

MidiScoreDocFileOutput (com.xenoage.zong.desktop.io.midi.out.MidiScoreDocFileOutput)1 OggScoreDocFileOutput (com.xenoage.zong.desktop.io.ogg.out.OggScoreDocFileOutput)1 PdfScoreDocFileOutput (com.xenoage.zong.desktop.io.pdf.out.PdfScoreDocFileOutput)1 PngScoreDocFileOutput (com.xenoage.zong.desktop.io.png.out.PngScoreDocFileOutput)1 ScoreDoc (com.xenoage.zong.documents.ScoreDoc)1 File (java.io.File)1