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());
}
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;
}
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;
}
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
// }
}
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();
}
Aggregations