Search in sources :

Example 6 with ChannelList

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

the class MixerChannelsColumnHeader method rebuildUI.

protected void rebuildUI() {
    this.removeAll();
    for (ChannelList list : mixer.getChannelListGroups()) {
        this.add(new NamePanel(list, 0));
    }
    this.add(new NamePanel(mixer.getChannels(), 0));
    this.add(new NamePanel(mixer.getSubChannels(), CHANNEL_STRIP_WIDTH));
    repaint();
}
Also used : ChannelList(blue.mixer.ChannelList)

Example 7 with ChannelList

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

the class MixerTopComponent method switchMixerId.

/**
 * Because blue allows multiple instruments to have the same arrangmentId,
 * must handle cases of if channels exist for oldId and newId, as well as
 * creating or destroying channels
 */
private void switchMixerId(String oldId, String newId) {
    ChannelList channels = mixer.getChannels();
    int oldIdCount = 0;
    int newIdCount = 0;
    for (int i = 0; i < arrangement.size(); i++) {
        String instrId = arrangement.getInstrumentAssignment(i).arrangementId;
        if (instrId.equals(oldId)) {
            oldIdCount++;
        } else if (instrId.equals(newId)) {
            newIdCount++;
        }
    }
    if (oldIdCount == 0 && newIdCount == 1) {
        // rename old channel
        for (int i = 0; i < channels.size(); i++) {
            Channel channel = channels.get(i);
            if (channel.getName().equals(oldId)) {
                channel.setName(newId);
                break;
            }
        }
    } else if (oldIdCount == 0 && newIdCount > 1) {
        // remove old channel, use current channel for newId
        for (int i = 0; i < channels.size(); i++) {
            Channel channel = channels.get(i);
            if (channel.getName().equals(oldId)) {
                channels.remove(channel);
                break;
            }
        }
    } else if (oldIdCount > 0 && newIdCount == 1) {
        // create new channel
        Channel channel = new Channel();
        channel.setName(newId);
        channels.add(channel);
    }
// else if(oldIdCount > 0 && newIdCount > 1) {
// do neither, as channels exist for both before and after
// }
}
Also used : Channel(blue.mixer.Channel) ChannelList(blue.mixer.ChannelList)

Example 8 with ChannelList

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

the class MixerTopComponent method reinitialize.

protected void reinitialize() {
    BlueProject project = BlueProjectManager.getInstance().getCurrentProject();
    BlueData data = null;
    channelGroupsPanel.removeAll();
    if (project != null) {
        data = project.getData();
        for (ChannelList list : data.getMixer().getChannelListGroups()) {
            ChannelListPanel panel = new ChannelListPanel();
            channelGroupsPanel.add(panel);
            panel.setChannelList(list, data.getMixer().getSubChannels());
            panel.revalidate();
        }
        channelGroupsPanel.add(channelsPanel);
        channelGroupsPanel.add(subChannelsPanel);
        setMixer(data.getMixer());
        setArrangement(data.getArrangement());
    }
    channelGroupsPanel.revalidate();
    channelGroupsPanel.repaint();
}
Also used : BlueData(blue.BlueData) BlueProject(blue.projects.BlueProject) ChannelList(blue.mixer.ChannelList)

Example 9 with ChannelList

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

the class ArrangementEditPanel method reconcileWithArrangement.

private void reconcileWithArrangement() {
    ChannelList channels = mixer.getChannels();
    ArrayList<String> idList = new ArrayList<>();
    for (int i = 0; i < arrangement.size(); i++) {
        String instrId = arrangement.getInstrumentAssignment(i).arrangementId;
        if (!idList.contains(instrId)) {
            idList.add(instrId);
        }
    }
    for (int i = channels.size() - 1; i >= 0; i--) {
        Channel channel = channels.get(i);
        if (!idList.contains(channel.getName())) {
            channels.remove(channel);
        }
    }
    for (int i = 0; i < idList.size(); i++) {
        channels.checkOrCreate(idList.get(i));
    }
    channels.sort();
// channelsPanel.sort();
}
Also used : Channel(blue.mixer.Channel) ArrayList(java.util.ArrayList) ChannelList(blue.mixer.ChannelList) Point(java.awt.Point)

Example 10 with ChannelList

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

the class AutomationManager method setData.

public void setData(BlueData data) {
    if (this.data != null) {
        Arrangement arrangement = this.data.getArrangement();
        arrangement.removeAutomatableCollectionListener(this);
        for (int i = 0; i < arrangement.size(); i++) {
            Instrument instr = arrangement.getInstrument(i);
            if (instr instanceof Automatable) {
                Automatable temp = (Automatable) instr;
                ParameterList parameters = temp.getParameterList();
                // parameterMap.put(temp, parameters);
                parameters.removeListener(parameterListListener);
            }
        }
        Mixer mixer = this.data.getMixer();
        mixer.getChannelListGroups().removeListener(channelListListener);
        for (ChannelList list : mixer.getChannelListGroups()) {
            list.removeListener(this);
            for (Channel c : list) {
                removeListenerFromChannel(c);
            }
        }
        ChannelList channels = mixer.getChannels();
        channels.removeListener(this);
        for (Channel c : channels) {
            removeListenerFromChannel(c);
        }
        ChannelList subChannels = mixer.getSubChannels();
        subChannels.removeListener(this);
        for (int i = 0; i < subChannels.size(); i++) {
            removeListenerFromChannel(subChannels.get(i));
        }
        removeListenerFromChannel(mixer.getMaster());
        if (this.score != null) {
            for (LayerGroup<? extends Layer> layerGroup : score) {
                layerGroup.removeLayerGroupListener(this);
            }
        }
        this.data.removePropertyChangeListener(renderTimeListener);
    }
    // menu = null;
    // dirty = false;
    allParameters.clear();
    if (data == null) {
        return;
    }
    // Build Map from Instruments
    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;
            ParameterList parameters = temp.getParameterList();
            allParameters.addAll(parameters);
            parameters.addListener(parameterListListener);
        }
    }
    arrangement.addAutomatableCollectionListener(this);
    Mixer mixer = data.getMixer();
    mixer.getChannelListGroups().addListener(channelListListener);
    for (ChannelList list : mixer.getChannelListGroups()) {
        list.addListener(this);
        for (Channel c : list) {
            addListenerToChannel(c);
        }
    }
    ChannelList channels = mixer.getChannels();
    channels.addListener(this);
    for (Channel c : channels) {
        addListenerToChannel(c);
    }
    ChannelList subChannels = mixer.getSubChannels();
    subChannels.addListener(this);
    for (int i = 0; i < subChannels.size(); i++) {
        addListenerToChannel(subChannels.get(i));
    }
    addListenerToChannel(mixer.getMaster());
    // System.err.println(this);
    this.data = data;
    this.score = data.getScore();
    for (LayerGroup<? extends Layer> layerGroup : this.score) {
        layerGroup.addLayerGroupListener(this);
    }
    this.data.addPropertyChangeListener(renderTimeListener);
// Build Map from Mixer Channels
}
Also used : Mixer(blue.mixer.Mixer) Channel(blue.mixer.Channel) Instrument(blue.orchestra.Instrument) ChannelList(blue.mixer.ChannelList) Arrangement(blue.Arrangement)

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