use of de.mossgrabers.framework.daw.data.ISlot in project DrivenByMoss by git-moss.
the class AbstractModel method canConvertClip.
/**
* {@inheritDoc}
*/
@Override
public boolean canConvertClip() {
final ITrack selectedTrack = this.getCursorTrack();
if (!selectedTrack.doesExist() || !selectedTrack.canHoldAudioData())
return false;
final List<ISlot> slots = selectedTrack.getSlotBank().getSelectedItems();
if (slots.isEmpty())
return false;
for (final ISlot slot : slots) {
if (slot.hasContent())
return true;
}
return false;
}
use of de.mossgrabers.framework.daw.data.ISlot in project DrivenByMoss by git-moss.
the class OSCParser method parseTrackValue.
private void parseTrackValue(final ITrack track, final LinkedList<String> parts, final Object value) {
final double numValue = value instanceof Number ? ((Number) value).doubleValue() : -1;
final int intValue = value instanceof Number ? ((Number) value).intValue() : -1;
if (parts.isEmpty()) {
this.host.errorln("Missing Track command.");
return;
}
final String command = parts.removeFirst();
switch(command) {
case "activated":
track.setIsActivated(intValue > 0);
break;
case "crossfadeMode":
if (numValue == 1)
track.setCrossfadeMode(parts.removeFirst());
break;
case "selected":
if (intValue > 0)
track.selectAndMakeVisible();
break;
case PART_VOLUME:
if (parts.isEmpty())
track.setVolume(numValue);
else if (PART_INDICATE.equals(parts.get(0)))
track.setVolumeIndication(numValue > 0);
else if (PART_RESET.equals(parts.get(0)))
track.resetVolume();
else if (PART_TOUCH.equals(parts.get(0)))
track.touchVolume(numValue > 0);
break;
case "pan":
if (parts.isEmpty())
track.setPan(numValue);
else if (PART_INDICATE.equals(parts.get(0)))
track.setPanIndication(numValue > 0);
else if (PART_RESET.equals(parts.get(0)))
track.resetPan();
else if (PART_TOUCH.equals(parts.get(0)))
track.touchPan(numValue > 0);
break;
case "mute":
if (numValue < 0)
track.toggleMute();
else
track.setMute(numValue > 0);
break;
case "solo":
if (numValue < 0)
track.toggleSolo();
else
track.setSolo(numValue > 0);
break;
case "recarm":
if (numValue < 0)
track.toggleRecArm();
else
track.setRecArm(numValue > 0);
break;
case "monitor":
if (numValue < 0)
track.toggleMonitor();
else
track.setMonitor(numValue > 0);
break;
case "autoMonitor":
if (numValue < 0)
track.toggleAutoMonitor();
else
track.setAutoMonitor(numValue > 0);
break;
case "send":
final int sendNo = Integer.parseInt(parts.removeFirst());
this.parseSendValue(track, sendNo - 1, parts, value);
break;
case "clip":
if (parts.isEmpty()) {
this.host.errorln("Missing Clip subcommand.");
return;
}
final String cmd = parts.removeFirst();
try {
final int clipNo = Integer.parseInt(cmd);
if (parts.isEmpty()) {
this.host.errorln("Missing Clip subcommand.");
return;
}
final String clipCommand = parts.removeFirst();
final ISlot slot = track.getSlot(clipNo - 1);
switch(clipCommand) {
case "select":
slot.select();
break;
case "launch":
slot.launch();
break;
case "record":
slot.record();
break;
case "color":
final Matcher matcher = RGB_COLOR_PATTERN.matcher(value.toString());
if (!matcher.matches())
return;
final int count = matcher.groupCount();
if (count != 7)
return;
slot.setColor(Double.parseDouble(matcher.group(2)) / 255.0, Double.parseDouble(matcher.group(4)) / 255.0, Double.parseDouble(matcher.group(6)) / 255.0);
break;
default:
this.host.println("Unknown Clip subcommand: " + clipCommand);
break;
}
} catch (final NumberFormatException ex) {
switch(cmd) {
case "stop":
track.stop();
break;
case "returntoarrangement":
track.returnToArrangement();
break;
default:
this.host.println("Unknown Clip command: " + cmd);
break;
}
}
break;
case "enter":
final IChannelBank tb = this.model.getCurrentTrackBank();
if (tb instanceof ITrackBank) {
track.select();
((ITrackBank) tb).selectChildren();
}
break;
case "color":
final Matcher matcher = RGB_COLOR_PATTERN.matcher(value.toString());
if (!matcher.matches())
return;
final int count = matcher.groupCount();
if (count == 7)
track.setColor(Double.parseDouble(matcher.group(2)) / 255.0, Double.parseDouble(matcher.group(4)) / 255.0, Double.parseDouble(matcher.group(6)) / 255.0);
break;
default:
this.host.println("Unknown Track Parameter: " + command);
break;
}
}
use of de.mossgrabers.framework.daw.data.ISlot in project DrivenByMoss by git-moss.
the class SessionView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity == 0)
return;
final int channel = note % 8;
final int scene = 7 - note / 8;
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getTrack(channel);
final ISlot slot = track.getSlot(scene);
if (track.isRecArm() && !slot.isRecording())
slot.record();
slot.launch();
if (this.doSelectClipOnLaunch())
slot.select();
}
use of de.mossgrabers.framework.daw.data.ISlot in project DrivenByMoss by git-moss.
the class ShiftView method onNew.
private void onNew() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack t = tb.getSelectedTrack();
if (t != null) {
final ISlot[] slotIndexes = t.getSelectedSlots();
final int slotIndex = slotIndexes.length == 0 ? 0 : slotIndexes[0].getIndex();
for (int i = 0; i < 8; i++) {
final int sIndex = (slotIndex + i) % 8;
final ISlot s = t.getSlot(sIndex);
if (s.hasContent())
continue;
this.model.createClip(s, this.surface.getConfiguration().getNewClipLength());
if (slotIndex != sIndex)
s.select();
s.launch();
this.model.getTransport().setLauncherOverdub(true);
return;
}
}
this.surface.getDisplay().notify("In the current selected grid view there is no empty slot. Please scroll down.");
}
use of de.mossgrabers.framework.daw.data.ISlot in project DrivenByMoss by git-moss.
the class ControlView method onButtonRow1.
/**
* {@inheritDoc}
*/
@Override
public void onButtonRow1(final int index, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
Integer activeModeId = modeManager.getActiveModeId();
if (activeModeId == Modes.MODE_VIEW_SELECT) {
if (index == 1) {
this.surface.getViewManager().setActiveView(Views.VIEW_PLAY);
if (modeManager.getPreviousModeId() == Modes.MODE_VOLUME)
modeManager.restoreMode();
else
modeManager.setActiveMode(Modes.MODE_SESSION);
} else
modeManager.restoreMode();
this.surface.turnOffTransport();
return;
}
if (activeModeId != Modes.MODE_FUNCTIONS && activeModeId != Modes.MODE_FIXED) {
modeManager.setActiveMode(Modes.MODE_FUNCTIONS);
activeModeId = Modes.MODE_FUNCTIONS;
}
if (activeModeId == Modes.MODE_FIXED) {
this.surface.getConfiguration().setNewClipLength(index);
return;
}
switch(index) {
// Undo
case 0:
this.model.getApplication().undo();
break;
// Redo
case 1:
this.model.getApplication().redo();
break;
// Delete
case 2:
this.model.getApplication().deleteSelection();
break;
// Double
case 3:
this.model.getApplication().duplicate();
break;
// New
case 4:
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack t = tb.getSelectedTrack();
if (t != null) {
final ISlot[] slotIndexes = t.getSelectedSlots();
final int slotIndex = slotIndexes.length == 0 ? 0 : slotIndexes[0].getIndex();
for (int i = 0; i < 8; i++) {
final int sIndex = (slotIndex + i) % 8;
final ISlot s = t.getSlot(sIndex);
if (!s.hasContent()) {
this.model.createClip(s, this.surface.getConfiguration().getNewClipLength());
if (slotIndex != sIndex)
s.select();
s.launch();
this.model.getTransport().setLauncherOverdub(true);
return;
}
}
}
this.surface.getDisplay().notify("In the current selected grid view there is no empty slot. Please scroll down.");
break;
// Open the VST window
case 5:
this.model.getCursorDevice().toggleWindowOpen();
break;
// Metronome
case 6:
this.model.getTransport().toggleMetronome();
break;
// Tap Tempo on MKII
case 7:
this.model.getTransport().tapTempo();
break;
}
}
Aggregations