Search in sources :

Example 1 with ChannelList

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

the class AutomationManager method getAutomationMenu.

public JPopupMenu getAutomationMenu(ParameterIdList paramIdList) {
    this.selectedParamIdList = paramIdList;
    // if (menu == null || dirty) {
    JPopupMenu menu = new JPopupMenu();
    // Build Instrument Menu
    JMenu instrRoot = new JMenu("Instrument");
    MenuScroller.setScrollerFor(instrRoot);
    Arrangement arrangement = data.getArrangement();
    for (int i = 0; i < arrangement.size(); i++) {
        InstrumentAssignment ia = arrangement.getInstrumentAssignment(i);
        if (ia.enabled && ia.instr instanceof Automatable) {
            ParameterList params = ((Automatable) ia.instr).getParameterList();
            if (params.size() <= 0) {
                continue;
            }
            final JMenu instrMenu = new JMenu();
            MenuScroller.setScrollerFor(instrMenu);
            instrMenu.setText(ia.arrangementId + ") " + ia.instr.getName());
            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("instr", ia.instr);
                paramItem.putClientProperty("param", param);
                instrMenu.add(paramItem);
            }
            instrRoot.add(instrMenu);
        }
    }
    menu.add(instrRoot);
    // Build Mixer Menu
    Mixer mixer = data.getMixer();
    if (mixer.isEnabled()) {
        JMenu mixerRoot = new JMenu("Mixer");
        MenuScroller.setScrollerFor(mixerRoot);
        // add channels
        ChannelList channels = mixer.getChannels();
        if (channels.size() > 0) {
            JMenu channelsMenu = new JMenu("Channels");
            for (int i = 0; i < channels.size(); i++) {
                channelsMenu.add(buildChannelMenu(channels.get(i), paramIdList));
            }
            mixerRoot.add(channelsMenu);
        }
        // add subchannels
        ChannelList subChannels = mixer.getSubChannels();
        if (subChannels.size() > 0) {
            JMenu subChannelsMenu = new JMenu("Sub-Channels");
            for (int i = 0; i < subChannels.size(); i++) {
                subChannelsMenu.add(buildChannelMenu(subChannels.get(i), paramIdList));
            }
            mixerRoot.add(subChannelsMenu);
        }
        // add master channel
        Channel master = mixer.getMaster();
        mixerRoot.add(buildChannelMenu(master, paramIdList));
        menu.add(mixerRoot);
    }
    menu.addSeparator();
    JMenuItem clearAll = new JMenuItem("Clear All");
    clearAll.addActionListener((ActionEvent e) -> {
        Object retVal = DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation("Please Confirm Clearing All Parameter Data for this SoundLayer"));
        if (retVal == NotifyDescriptor.YES_OPTION) {
            ParameterIdList idList = selectedParamIdList;
            for (String paramId : idList.getParameters()) {
                Parameter param = getParameter(paramId);
                param.setAutomationEnabled(false);
                idList.removeParameterId(paramId);
            }
        }
    });
    menu.add(clearAll);
    clearAll.setEnabled(selectedParamIdList.size() > 0);
    // System.err.println(parameterMap);
    return menu;
}
Also used : ActionEvent(java.awt.event.ActionEvent) Mixer(blue.mixer.Mixer) Channel(blue.mixer.Channel) JPopupMenu(javax.swing.JPopupMenu) Arrangement(blue.Arrangement) NotifyDescriptor(org.openide.NotifyDescriptor) InstrumentAssignment(blue.InstrumentAssignment) PolyObject(blue.soundObject.PolyObject) JMenuItem(javax.swing.JMenuItem) ChannelList(blue.mixer.ChannelList) JMenu(javax.swing.JMenu)

Example 2 with ChannelList

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

the class CSDRender method clearUnusedMixerChannels.

private void clearUnusedMixerChannels(Mixer mixer, Arrangement arrangement) {
    ArrayList ids = new ArrayList();
    for (int i = 0; i < arrangement.getRowCount(); i++) {
        InstrumentAssignment ia = arrangement.getInstrumentAssignment(i);
        ids.add(ia.arrangementId);
    }
    ChannelList channelList = mixer.getChannels();
    channelList.clearChannelsNotInList(ids);
}
Also used : ArrayList(java.util.ArrayList) InstrumentAssignment(blue.InstrumentAssignment) ChannelList(blue.mixer.ChannelList) LinePoint(blue.components.lines.LinePoint)

Example 3 with ChannelList

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

the class ParameterHelper method clearCompilationVarNames.

public static void clearCompilationVarNames(BlueData data) {
    Arrangement arrangement = data.getArrangement();
    for (int i = 0; i < arrangement.size(); i++) {
        Instrument instr = arrangement.getInstrument(i);
        if (instr instanceof Automatable) {
            Automatable temp = (Automatable) instr;
            temp.getParameterList().clearCompilationVarNames();
        }
    }
    Mixer mixer = data.getMixer();
    List<Channel> channels = mixer.getAllSourceChannels();
    for (Channel channel : channels) {
        clearChannelCompilationVar(channel);
    }
    ChannelList subChannels = mixer.getSubChannels();
    for (Channel subChannel : subChannels) {
        clearChannelCompilationVar(subChannel);
    }
    clearChannelCompilationVar(mixer.getMaster());
}
Also used : Mixer(blue.mixer.Mixer) Channel(blue.mixer.Channel) Instrument(blue.orchestra.Instrument) ChannelList(blue.mixer.ChannelList) Arrangement(blue.Arrangement) Automatable(blue.automation.Automatable)

Example 4 with ChannelList

use of blue.mixer.ChannelList 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 5 with ChannelList

use of blue.mixer.ChannelList 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)

Aggregations

ChannelList (blue.mixer.ChannelList)11 Channel (blue.mixer.Channel)8 InstrumentAssignment (blue.InstrumentAssignment)4 Mixer (blue.mixer.Mixer)4 Instrument (blue.orchestra.Instrument)4 ArrayList (java.util.ArrayList)4 Arrangement (blue.Arrangement)3 Automatable (blue.automation.Automatable)3 Parameter (blue.automation.Parameter)2 ParameterList (blue.automation.ParameterList)2 BlueData (blue.BlueData)1 LinePoint (blue.components.lines.LinePoint)1 BlueProject (blue.projects.BlueProject)1 Score (blue.score.Score)1 AudioLayer (blue.score.layers.audio.core.AudioLayer)1 AudioLayerGroup (blue.score.layers.audio.core.AudioLayerGroup)1 AudioLayerChannelBinding (blue.score.layers.audio.ui.bindings.AudioLayerChannelBinding)1 AudioLayerGroupBinding (blue.score.layers.audio.ui.bindings.AudioLayerGroupBinding)1 PolyObject (blue.soundObject.PolyObject)1 Point (java.awt.Point)1