use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.
the class SLMkIIIControllerSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
final IMidiOutput output = midiAccess.createOutput();
final IMidiInput keyboardInput = midiAccess.createInput(1, "Keyboard", "8?????", "9?????", "B?????", "D?????", "E?????");
final IHost hostProxy = this.model.getHost();
final IMidiInput input = midiAccess.createInput("Pads", "8?????", "9?????");
final SLMkIIILightGuide lightGuide = new SLMkIIILightGuide(this.model, this.colorManager, output);
final SLMkIIIControlSurface surface = new SLMkIIIControlSurface(hostProxy, this.colorManager, this.configuration, output, input, lightGuide);
this.surfaces.add(surface);
surface.addPianoKeyboard(61, keyboardInput, true);
keyboardInput.setMidiCallback((status, data1, data2) -> {
final int code = status & 0xF0;
if (code == 0x80 || code == 0x90)
lightGuide.updateKeyboardNote(data1, data2);
});
}
use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.
the class OSCControllerSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
final IMidiInput input = midiAccess.createInput("OSC");
final OSCControlSurface surface = new OSCControlSurface(this.host, this.configuration, this.colorManager, input);
surface.addTextDisplay(new DummyDisplay(this.host));
this.surfaces.add(surface);
this.keyManager = new KeyManager(this.model, this.model.getScales(), surface.getPadGrid());
// Send OSC messages
final String sendHost = this.configuration.getSendHost();
final int sendPort = this.configuration.getSendPort();
this.host.println(String.format("Connecting to OSC server %s:%d", sendHost, Integer.valueOf(sendPort)));
final IOpenSoundControlClient oscClient = this.host.connectToOSCServer(sendHost, sendPort);
this.writer = new OSCWriter(this.host, this.model, oscClient, this.configuration);
// Receive OSC messages
final OSCParser parser = new OSCParser(this.host, surface, this.model, this.configuration, this.writer, input, this.keyManager);
final List<IModule> modules = new ArrayList<>();
modules.add(new TransportModule(this.host, this.model, surface, this.writer));
modules.add(new GlobalModule(this.host, this.model, this.writer));
modules.add(new LayoutModule(this.host, this.model, this.writer));
modules.add(new MarkerModule(this.host, this.model, this.writer));
modules.add(new ProjectModule(this.host, this.model, this.writer));
modules.add(new TrackModule(this.host, this.model, this.writer, this.configuration));
modules.add(new SceneModule(this.host, this.model, this.writer));
modules.add(new DeviceModule(this.host, this.model, this.writer, this.configuration));
modules.add(new BrowserModule(this.host, this.model, this.writer));
modules.add(new MidiModule(this.host, this.model, surface, this.writer, this.keyManager));
modules.add(new UserModule(this.host, this.model, this.writer));
modules.add(new ActionModule(this.host, this.model, this.writer, this.configuration));
modules.add(new ClipModule(this.host, this.model, this.writer));
modules.forEach(module -> {
this.writer.registerModule(module);
parser.registerModule(module);
});
this.oscServer = this.host.createOSCServer(parser);
}
use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.
the class PlayView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int key, final int velocity) {
if (this.playControls) {
final int pos = key - this.scales.getStartNote();
if (pos < 8) {
final boolean isDown = velocity > 0;
final IMidiInput midiInput = this.surface.getMidiInput();
switch(pos) {
// Sustain
case 0:
this.isSustain = isDown;
midiInput.sendRawMidiEvent(0xB0, 64, this.isSustain ? 127 : 0);
return;
// Pitch
case 1:
this.isPitchDown = isDown;
midiInput.sendRawMidiEvent(0xE0, 0, this.isPitchDown ? Math.abs(velocity / 2 - 63) : 64);
return;
case 2:
this.isPitchUp = isDown;
midiInput.sendRawMidiEvent(0xE0, 0, this.isPitchUp ? 64 + velocity / 2 : 64);
return;
// Modulation
default:
if (isDown) {
this.isModulation = pos - 3;
midiInput.sendRawMidiEvent(0xB0, 1, MODULATION_INTENSITIES[this.isModulation]);
}
return;
}
}
}
super.onGridNote(key, velocity);
}
use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.
the class MidiMonitorSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
final IMidiInput input = midiAccess.createInput("Midi Monitor");
this.surfaces.add(new MidiMonitorControlSurface(this.host, this.configuration, input));
}
use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.
the class AbstractChordView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int key, final int velocity) {
if (!this.model.canSelectedTrackHoldNotes())
return;
super.onGridNote(key, velocity);
final int index = key - 36;
final int row = index / this.surface.getPadGrid().getCols();
final int note = this.keyManager.map(key);
final int[] chord = this.scales.getChord(note, CHORD_INTERVALS[row]);
// Send additional chord notes to the DAW
final IMidiInput input = this.surface.getMidiInput();
final C config = this.surface.getConfiguration();
final int channel = config.getMidiEditChannel();
int vel = 0;
if (velocity > 0)
vel = config.isAccentActive() ? config.getFixedAccentValue() : velocity;
for (final int element : chord) input.sendRawMidiEvent(0x90 + channel, element, vel);
}
Aggregations