Search in sources :

Example 1 with Send

use of blue.mixer.Send in project blue by kunstmusik.

the class AutomationManager method buildChannelMenu.

public JMenu buildChannelMenu(Channel channel, ParameterIdList paramIdList) {
    this.selectedParamIdList = paramIdList;
    JMenu retVal = new JMenu();
    retVal.setText(channel.getName());
    // pre effects
    EffectsChain preEffects = channel.getPreEffects();
    if (preEffects.size() > 0) {
        JMenu preMenu = new JMenu("Pre-Effects");
        retVal.add(preMenu);
        MenuScroller.setScrollerFor(preMenu);
        for (int i = 0; i < preEffects.size(); i++) {
            Automatable automatable = (Automatable) preEffects.getElementAt(i);
            ParameterList params = automatable.getParameterList();
            if (params.size() > 0) {
                JMenu effectMenu = new JMenu();
                MenuScroller.setScrollerFor(effectMenu);
                if (automatable instanceof Effect) {
                    effectMenu.setText(((Effect) automatable).getName());
                } else if (automatable instanceof Send) {
                    effectMenu.setText("Send: " + ((Send) automatable).getSendChannel());
                } else {
                    effectMenu.setText("ERROR");
                }
                preMenu.add(effectMenu);
                for (Parameter param : params.sorted()) {
                    JMenuItem paramItem = new JMenuItem();
                    paramItem.setText(param.getName());
                    paramItem.addActionListener(parameterActionListener);
                    if (param.isAutomationEnabled()) {
                        if (paramIdList.contains(param.getUniqueId())) {
                            paramItem.setForeground(Color.GREEN);
                        } else {
                            paramItem.setForeground(Color.ORANGE);
                        }
                    }
                    paramItem.putClientProperty("param", param);
                    effectMenu.add(paramItem);
                }
            }
        }
    }
    // volume
    JMenuItem volItem = new JMenuItem("Volume");
    Parameter volParam = channel.getLevelParameter();
    volItem.putClientProperty("param", volParam);
    volItem.addActionListener(parameterActionListener);
    if (volParam.isAutomationEnabled()) {
        if (paramIdList.contains(volParam.getUniqueId())) {
            volItem.setForeground(Color.GREEN);
        } else {
            volItem.setForeground(Color.ORANGE);
        }
    }
    retVal.add(volItem);
    // post effects
    EffectsChain postEffects = channel.getPostEffects();
    if (postEffects.size() > 0) {
        JMenu postMenu = new JMenu("Post-Effects");
        MenuScroller.setScrollerFor(postMenu);
        retVal.add(postMenu);
        for (int i = 0; i < postEffects.size(); i++) {
            Automatable automatable = (Automatable) postEffects.getElementAt(i);
            ParameterList params = automatable.getParameterList();
            if (params.size() > 0) {
                JMenu effectMenu = new JMenu();
                MenuScroller.setScrollerFor(effectMenu);
                if (automatable instanceof Effect) {
                    effectMenu.setText(((Effect) automatable).getName());
                } else if (automatable instanceof Send) {
                    effectMenu.setText("Send: " + ((Send) automatable).getSendChannel());
                } else {
                    effectMenu.setText("ERROR");
                }
                postMenu.add(effectMenu);
                for (Parameter param : params.sorted()) {
                    JMenuItem paramItem = new JMenuItem();
                    paramItem.setText(param.getName());
                    paramItem.addActionListener(parameterActionListener);
                    if (param.isAutomationEnabled()) {
                        if (paramIdList.contains(param.getUniqueId())) {
                            paramItem.setForeground(Color.GREEN);
                        } else {
                            paramItem.setForeground(Color.ORANGE);
                        }
                    }
                    paramItem.putClientProperty("param", param);
                    effectMenu.add(paramItem);
                }
            }
        }
    }
    return retVal;
}
Also used : EffectsChain(blue.mixer.EffectsChain) Effect(blue.mixer.Effect) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu) Send(blue.mixer.Send)

Aggregations

Effect (blue.mixer.Effect)1 EffectsChain (blue.mixer.EffectsChain)1 Send (blue.mixer.Send)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1