use of de.mossgrabers.framework.daw.data.IDeviceMetadata in project DrivenByMoss by git-moss.
the class AbstractTrackBankImpl method addChannel.
private void addChannel(final ChannelType type, final String name, final ColorEx color, final List<IDeviceMetadata> devices) {
this.addTrack(type);
if (name == null && color == null)
return;
this.host.scheduleTask(() -> {
if (!this.cursorTrack.doesExist())
return;
if (name != null)
this.cursorTrack.setName(name);
if (color != null)
this.cursorTrack.setColor(color);
this.bank.get().scrollIntoView(this.cursorTrack.getPosition());
for (final IDeviceMetadata device : devices) this.cursorTrack.addDevice(device);
}, 300);
}
use of de.mossgrabers.framework.daw.data.IDeviceMetadata in project DrivenByMoss by git-moss.
the class AddTrackMode method onFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
if (event != ButtonEvent.UP)
return;
final PushConfiguration conf = this.surface.getConfiguration();
final List<IDeviceMetadata> devices = new ArrayList<>();
final ChannelType channelType;
String channelName = null;
if (index < 4) {
channelType = ChannelType.AUDIO;
if (index > 0) {
final Optional<IDeviceMetadata> audioFavorite = conf.getAudioFavorite(index - 1);
if (audioFavorite.isPresent()) {
final IDeviceMetadata deviceMetadata = audioFavorite.get();
devices.add(deviceMetadata);
channelName = deviceMetadata.name();
}
}
} else {
channelType = ChannelType.EFFECT;
if (index > 4) {
final Optional<IDeviceMetadata> effectFavorite = conf.getEffectFavorite(index - 5);
if (effectFavorite.isPresent()) {
final IDeviceMetadata deviceMetadata = effectFavorite.get();
devices.add(deviceMetadata);
channelName = deviceMetadata.name();
}
}
}
this.model.getTrackBank().addChannel(channelType, channelName, devices);
this.surface.getModeManager().restore();
}
use of de.mossgrabers.framework.daw.data.IDeviceMetadata in project DrivenByMoss by git-moss.
the class AddTrackMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1(final ITextDisplay display) {
final PushConfiguration conf = this.surface.getConfiguration();
display.setCell(0, 0, STR_EMPTY);
for (int i = 0; i < 7; i++) {
final Optional<IDeviceMetadata> instrumentFavorite = conf.getInstrumentFavorite(i);
display.setCell(0, i + 1, instrumentFavorite.isPresent() ? StringUtils.shortenAndFixASCII(instrumentFavorite.get().name(), 8) : "");
}
display.setBlock(1, 0, "INSTRUMENT");
display.setBlock(2, 0, "AUDIO").setBlock(2, 2, "EFFECT");
display.setCell(3, 0, STR_EMPTY);
display.setCell(3, 4, STR_EMPTY);
for (int i = 0; i < 3; i++) {
final Optional<IDeviceMetadata> audioFavorite = conf.getAudioFavorite(i);
final Optional<IDeviceMetadata> effectFavorite = conf.getEffectFavorite(i);
display.setCell(3, 1 + i, audioFavorite.isPresent() ? StringUtils.shortenAndFixASCII(audioFavorite.get().name(), 8) : "");
display.setCell(3, 5 + i, effectFavorite.isPresent() ? StringUtils.shortenAndFixASCII(effectFavorite.get().name(), 8) : "");
}
}
use of de.mossgrabers.framework.daw.data.IDeviceMetadata in project DrivenByMoss by git-moss.
the class AddTrackMode method onSecondRow.
/**
* {@inheritDoc}
*/
@Override
public void onSecondRow(final int index, final ButtonEvent event) {
if (event != ButtonEvent.UP)
return;
String channelName = null;
final List<IDeviceMetadata> devices = new ArrayList<>();
if (index > 0) {
final PushConfiguration conf = this.surface.getConfiguration();
final Optional<IDeviceMetadata> instrumentFavorite = conf.getInstrumentFavorite(index - 1);
if (instrumentFavorite.isPresent()) {
final IDeviceMetadata deviceMetadata = instrumentFavorite.get();
devices.add(deviceMetadata);
channelName = deviceMetadata.name();
}
}
this.model.getTrackBank().addChannel(ChannelType.INSTRUMENT, channelName, devices);
this.surface.getModeManager().restore();
}
use of de.mossgrabers.framework.daw.data.IDeviceMetadata in project DrivenByMoss by git-moss.
the class AddTrackMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2(final IGraphicDisplay display) {
final PushConfiguration conf = this.surface.getConfiguration();
display.addOptionElement("Instrument", STR_EMPTY, false, ColorEx.YELLOW, "Audio", STR_EMPTY, false, ColorEx.GREEN, false, false);
Optional<IDeviceMetadata> instrFav = conf.getInstrumentFavorite(0);
Optional<IDeviceMetadata> audioFav = conf.getAudioFavorite(0);
display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", audioFav.isEmpty() ? "" : audioFav.get().name(), false, false);
instrFav = conf.getInstrumentFavorite(1);
audioFav = conf.getAudioFavorite(1);
display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", audioFav.isEmpty() ? "" : audioFav.get().name(), false, false);
instrFav = conf.getInstrumentFavorite(2);
audioFav = conf.getAudioFavorite(2);
display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", audioFav.isEmpty() ? "" : audioFav.get().name(), false, false);
instrFav = conf.getInstrumentFavorite(3);
display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, null, "Effect", STR_EMPTY, false, ColorEx.BLUE, false, false);
instrFav = conf.getInstrumentFavorite(4);
Optional<IDeviceMetadata> effectFavorite = conf.getEffectFavorite(0);
display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", effectFavorite.isEmpty() ? "" : effectFavorite.get().name(), false, false);
instrFav = conf.getInstrumentFavorite(5);
effectFavorite = conf.getEffectFavorite(1);
display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", effectFavorite.isEmpty() ? "" : effectFavorite.get().name(), false, false);
instrFav = conf.getInstrumentFavorite(6);
effectFavorite = conf.getEffectFavorite(2);
display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", effectFavorite.isEmpty() ? "" : effectFavorite.get().name(), false, false);
}
Aggregations