Search in sources :

Example 1 with Scale

use of blue.soundObject.pianoRoll.Scale in project blue by kunstmusik.

the class TuningProcessor method loadFromXML.

public static NoteProcessor loadFromXML(Element data) {
    TuningProcessor tp = new TuningProcessor();
    Elements nodes = data.getElements();
    double baseFreq = -1;
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        switch(node.getName()) {
            case "baseFrequency":
                baseFreq = Double.parseDouble(node.getTextString());
                break;
            case "pfield":
                tp.setPfield(node.getTextString());
                break;
            case "scale":
                Scale scale;
                if (node.getElements().size() == 0) {
                    String scaleDir = BlueSystem.getUserConfigurationDirectory() + File.separator + "scl";
                    String scalePath = scaleDir + File.separator + node.getTextString();
                    File scaleFile = new File(scalePath);
                    scale = Scale.loadScale(scaleFile);
                } else {
                    scale = Scale.loadFromXML(node);
                }
                tp.setScale(scale);
                break;
        }
    }
    if (baseFreq > 0) {
        tp.getScale().setBaseFrequency(baseFreq);
    }
    // tp.setFileName(data.getElement("fileName").getTextString());
    return tp;
}
Also used : Element(electric.xml.Element) Scale(blue.soundObject.pianoRoll.Scale) Elements(electric.xml.Elements) File(java.io.File)

Example 2 with Scale

use of blue.soundObject.pianoRoll.Scale in project blue by kunstmusik.

the class TrackEditor method scaleChooserButtonActionPerformed.

// GEN-LAST:event_outputFreqCheckBoxActionPerformed
private void scaleChooserButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_scaleChooserButtonActionPerformed
    if (selectedColumn == null) {
        return;
    }
    List<File> rValue = FileChooserManager.getDefault().showOpenDialog(FILE_CHOOSER_ID, null);
    if (!rValue.isEmpty()) {
        File f = rValue.get(0);
        if (!f.exists()) {
            return;
        }
        Scale scale = Scale.loadScale(f);
        selectedColumn.setScale(scale);
        scaleNameTextField.setText(scale.getScaleName());
    }
}
Also used : Scale(blue.soundObject.pianoRoll.Scale) File(java.io.File)

Example 3 with Scale

use of blue.soundObject.pianoRoll.Scale in project blue by kunstmusik.

the class ScaleEditor method selectScale.

protected void selectScale() {
    List<File> rValue = FileChooserManager.getDefault().showOpenDialog(ScaleSelectionPanel.FILE_CHOOSER_ID, null);
    if (!rValue.isEmpty()) {
        File f = rValue.get(0);
        if (!f.exists()) {
            return;
        }
        Scale scale = Scale.loadScale(f);
        if (scale != null) {
            scale.setBaseFrequency(this.scale.getBaseFrequency());
            this.scale.copyValues(scale);
        }
    }
    fireActionPerformed();
}
Also used : Scale(blue.soundObject.pianoRoll.Scale) File(java.io.File)

Aggregations

Scale (blue.soundObject.pianoRoll.Scale)3 File (java.io.File)3 Element (electric.xml.Element)1 Elements (electric.xml.Elements)1