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