Search in sources :

Example 6 with Channel

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

use of blue.mixer.Channel 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 8 with Channel

use of blue.mixer.Channel 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 9 with Channel

use of blue.mixer.Channel 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 10 with Channel

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

Aggregations

Channel (blue.mixer.Channel)12 ChannelList (blue.mixer.ChannelList)8 Mixer (blue.mixer.Mixer)4 Instrument (blue.orchestra.Instrument)4 Arrangement (blue.Arrangement)3 InstrumentAssignment (blue.InstrumentAssignment)3 Automatable (blue.automation.Automatable)3 ArrayList (java.util.ArrayList)3 Parameter (blue.automation.Parameter)2 ParameterList (blue.automation.ParameterList)2 AudioLayer (blue.score.layers.audio.core.AudioLayer)2 LinePoint (blue.components.lines.LinePoint)1 GenericInstrument (blue.orchestra.GenericInstrument)1 StringChannel (blue.orchestra.blueSynthBuilder.StringChannel)1 Score (blue.score.Score)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