Search in sources :

Example 1 with ParameterList

use of blue.automation.ParameterList in project blue by kunstmusik.

the class Effect method loadFromXML.

public static Effect loadFromXML(Element data) throws Exception {
    Effect effect = new Effect(false);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "name":
                effect.setName(node.getTextString());
                break;
            case "enabled":
                effect.setEnabled(XMLUtilities.readBoolean(node));
                break;
            case "numIns":
                effect.setNumIns(XMLUtilities.readInt(node));
                break;
            case "numOuts":
                effect.setNumOuts(XMLUtilities.readInt(node));
                break;
            case "code":
                effect.setCode(node.getTextString());
                break;
            case "comments":
                effect.setComments(node.getTextString());
                break;
            case "opcodeList":
                effect.opcodeList = OpcodeList.loadFromXML(node);
                break;
            case "graphicInterface":
                effect.setGraphicInterface(BSBGraphicInterface.loadFromXML(node));
                break;
            case "bsbParameterList":
            case "parameterList":
                effect.parameterList = (ParameterList) ParameterList.loadFromXML(node);
                break;
        }
    }
    if (effect.opcodeList == null) {
        effect.opcodeList = new OpcodeList();
    }
    if (effect.graphicInterface == null) {
        effect.graphicInterface = new BSBGraphicInterface();
    }
    if (effect.parameterList == null) {
        effect.parameterList = new ParameterList();
    }
    effect.graphicInterface.getRootGroup().setParameterList(effect.parameterList);
    return effect;
}
Also used : BSBGraphicInterface(blue.orchestra.blueSynthBuilder.BSBGraphicInterface) OpcodeList(blue.udo.OpcodeList) Element(electric.xml.Element) ParameterList(blue.automation.ParameterList) Elements(electric.xml.Elements)

Example 2 with ParameterList

use of blue.automation.ParameterList in project blue by kunstmusik.

the class ParameterHelper method getActiveParameters.

public static List<Parameter> getActiveParameters(Arrangement arr, Mixer mixer) {
    List<Parameter> params = new ArrayList<>();
    for (int i = 0; i < arr.size(); i++) {
        InstrumentAssignment ia = arr.getInstrumentAssignment(i);
        if (ia.enabled) {
            Instrument instr = ia.instr;
            if (instr instanceof Automatable) {
                Automatable auto = (Automatable) instr;
                ParameterList list = auto.getParameterList();
                addActiveParametersFromList(params, list);
            }
        }
    }
    if (mixer != null && mixer.isEnabled()) {
        List<Channel> channels = mixer.getAllSourceChannels();
        for (Channel channel : channels) {
            appendParametersFromChannel(params, channel);
        }
        ChannelList subChannels = mixer.getSubChannels();
        for (Channel subChannel : subChannels) {
            appendParametersFromChannel(params, subChannel);
        }
        appendParametersFromChannel(params, mixer.getMaster());
    }
    return params;
}
Also used : Channel(blue.mixer.Channel) ArrayList(java.util.ArrayList) Instrument(blue.orchestra.Instrument) Parameter(blue.automation.Parameter) InstrumentAssignment(blue.InstrumentAssignment) ParameterList(blue.automation.ParameterList) ChannelList(blue.mixer.ChannelList) Automatable(blue.automation.Automatable)

Example 3 with ParameterList

use of blue.automation.ParameterList in project blue by kunstmusik.

the class ParameterHelper method appendParametersFromChannel.

private static void appendParametersFromChannel(List<Parameter> params, Channel channel) {
    EffectsChain pre = channel.getPreEffects();
    for (int i = 0; i < pre.size(); i++) {
        ParameterList list = ((Automatable) pre.getElementAt(i)).getParameterList();
        addActiveParametersFromList(params, list);
    }
    EffectsChain post = channel.getPostEffects();
    for (int i = 0; i < post.size(); i++) {
        ParameterList list = ((Automatable) post.getElementAt(i)).getParameterList();
        addActiveParametersFromList(params, list);
    }
    if (channel.getLevelParameter().isAutomationEnabled()) {
        params.add(channel.getLevelParameter());
    }
}
Also used : EffectsChain(blue.mixer.EffectsChain) ParameterList(blue.automation.ParameterList) Automatable(blue.automation.Automatable)

Example 4 with ParameterList

use of blue.automation.ParameterList in project blue by kunstmusik.

the class ParameterHelper method getAllParameters.

public static ArrayList<Parameter> getAllParameters(Arrangement arr, Mixer mixer) {
    ArrayList<Parameter> params = new ArrayList<>();
    for (int i = 0; i < arr.size(); i++) {
        InstrumentAssignment ia = arr.getInstrumentAssignment(i);
        if (ia.enabled) {
            Instrument instr = ia.instr;
            if (instr instanceof Automatable) {
                Automatable auto = (Automatable) instr;
                ParameterList list = auto.getParameterList();
                params.addAll(list);
            }
        }
    }
    if (mixer != null && mixer.isEnabled()) {
        List<Channel> channels = mixer.getAllSourceChannels();
        for (Channel channel : channels) {
            appendAllParametersFromChannel(params, channel);
        }
        ChannelList subChannels = mixer.getSubChannels();
        for (Channel channel : subChannels) {
            appendAllParametersFromChannel(params, channel);
        }
        appendAllParametersFromChannel(params, mixer.getMaster());
    }
    return params;
}
Also used : Channel(blue.mixer.Channel) ArrayList(java.util.ArrayList) Instrument(blue.orchestra.Instrument) Parameter(blue.automation.Parameter) InstrumentAssignment(blue.InstrumentAssignment) ParameterList(blue.automation.ParameterList) ChannelList(blue.mixer.ChannelList) Automatable(blue.automation.Automatable)

Example 5 with ParameterList

use of blue.automation.ParameterList in project blue by kunstmusik.

the class BSBGroupTest method testSetParameterList.

/**
 * Test of setParameterList method, of class BSBGroup.
 */
@Test
public void testSetParameterList() {
    System.out.println("setParameterList");
    ParameterList paramList = new ParameterList();
    BSBGroup instance = new BSBGroup();
    instance.setUniqueNameManager(new UniqueNameManager());
    instance.setAllSet(FXCollections.observableSet(new HashSet<>()));
    instance.setParameterList(paramList);
    BSBKnob knob = new BSBKnob();
    knob.setObjectName("test1");
    instance.addBSBObject(knob);
    assertEquals(1, paramList.size());
    instance.interfaceItemsProperty().remove(knob);
    assertEquals(0, paramList.size());
    BSBGroup subNode = new BSBGroup();
    subNode.addBSBObject(knob);
    knob.setAutomationAllowed(true);
    instance.addBSBObject(subNode);
    assertEquals(1, paramList.size());
    subNode.interfaceItemsProperty().remove(knob);
    assertEquals(0, paramList.size());
    knob.setAutomationAllowed(true);
    subNode.addBSBObject(knob);
    assertEquals(1, paramList.size());
    instance.interfaceItemsProperty().remove(subNode);
    assertEquals(0, paramList.size());
}
Also used : ParameterList(blue.automation.ParameterList) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

ParameterList (blue.automation.ParameterList)11 Automatable (blue.automation.Automatable)5 Parameter (blue.automation.Parameter)5 InstrumentAssignment (blue.InstrumentAssignment)2 Channel (blue.mixer.Channel)2 ChannelList (blue.mixer.ChannelList)2 EffectsChain (blue.mixer.EffectsChain)2 Instrument (blue.orchestra.Instrument)2 OpcodeList (blue.udo.OpcodeList)2 Element (electric.xml.Element)2 Elements (electric.xml.Elements)2 ArrayList (java.util.ArrayList)2 BSBGraphicInterface (blue.orchestra.blueSynthBuilder.BSBGraphicInterface)1 StringChannel (blue.orchestra.blueSynthBuilder.StringChannel)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1