public void messageReceived(ParameterSelectMessage message) { int slotId = message.getSlot(); if (!isValidSlot(slotId)) return; int vaId = message.getSection(); int moduleId = message.getModule(); int paramId = message.getParameter(); // addParameter("pid", "data:pid"); // addParameter("sc", "data:sc"); NmSlot slot = synth.getSlot(slotId); NMPatch patch = slot.getPatch(); String parameterClass = "parameter"; VoiceArea va = null; if (vaId == Format.VALUE_SECTION_VOICE_AREA_POLY) va = patch.getPolyVoiceArea(); else if (vaId == Format.VALUE_SECTION_VOICE_AREA_COMMON) va = patch.getCommonVoiceArea(); else if (vaId == Format.VALUE_SECTION_MORPH) { parameterClass = "morph"; va = patch.getPolyVoiceArea(); } if (va == null) return; PModule module = va.getModule(moduleId); PParameter p; try { p = Helper.getParameter(module, parameterClass, paramId); } catch (InvalidDescriptorException e) { return; } p.requestFocus(); }
public void messageReceived(MorphRangeChangeMessage message) { int slotId = message.getSlot(); if (!isValidSlot(slotId)) return; int vaId = message.getSection(); int moduleId = message.getModule(); int paramId = message.getParameter(); int span = message.getSpan(); int direction = message.getDirection(); // +==0/-==1 NmSlot slot = synth.getSlot(slotId); NMPatch patch = slot.getPatch(); VoiceArea va = null; if (vaId == Format.VALUE_SECTION_VOICE_AREA_POLY) va = patch.getPolyVoiceArea(); else if (vaId == Format.VALUE_SECTION_VOICE_AREA_COMMON) va = patch.getCommonVoiceArea(); if (va == null) return; PModule module = va.getModule(moduleId); PParameter p; try { p = Helper.getParameter(module, "morph", paramId); } catch (InvalidDescriptorException e) { return; } p.setValue(direction == 1 ? -span : +span); }
public void messageReceived(NewPatchInSlotMessage message) { // user changed the patch in one of the slots // trigger-source: synth int slotId = message.getSlot(); if (!isValidSlot(slotId)) return; int patchId = message.getPid(); NmSlot slot = synth.getSlot(slotId); NMPatch patch = slot.getPatch(); if (patch != null) patch.setSlot(null); slot.setPatch(null); // slot.setPatchId(patchId); // getPatch(slotId, patchId); try { slot.requestPatch(); } catch (SynthException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
/** * This message is ignored. The GetPatchWorker causes this kind of messages and handles them * itself. */ public void messageReceived(PatchMessage message) { // get patch name String patchName = message.getPatchNameIfPresent(); if (patchName != null) { // patch name is part of message synth.getSlot(message.getSlot()).setPatchNameValue(patchName); } if (message.containsSection(Format.S_HEADER)) { int slotId = message.getSlot(); NmSlot slot = synth.getSlot(slotId); NMPatch patch = slot.getPatch(); if (patch == null) return; PatchBuilder builder = new PatchBuilder(patch, new ParserErrorHandler(), synth.getModuleDescriptions()); BitstreamPatchParser bpp = new BitstreamPatchParser(); bpp.setRecognizedSections(Format.S_HEADER); try { bpp.transcode(message.getPatchStream(), builder); } catch (ParseException e) { e.printStackTrace(); } } }
public void messageReceived(MeterMessage message) { int slotId = message.getSlot(); if (!isValidSlot(slotId)) return; NmSlot slot = synth.getSlot(slotId); NMPatch patch = slot.getPatch(); if (patch == null) return; patch.getLightProcessor().processMeterMessage(message); }
public void messageReceived(SetPatchTitleMessage message) { int slotId = message.getSlot(); // int pid = message.get("pid"); // check if slot is available <=> synth is connected // -> this is not implied by the received message if (!isValidSlot(slotId)) return; NmSlot slot = synth.getSlot(slotId); NMPatch patch = slot.getPatch(); String title = message.getTitle(); if (patch != null) patch.setName(title); slot.setPatchNameValue(title); }
public void messageReceived(KnobAssignmentMessage message) { int slotId = message.getSlot(); if (!isValidSlot(slotId)) return; int prevKnob = message.get("prevknob"); int vaId = message.get("section"); int moduleId = message.get("module"); int paramId = message.get("parameter"); int knob = message.get("knob"); NmSlot slot = synth.getSlot(slotId); NMPatch patch = slot.getPatch(); if (prevKnob >= 0) { Knob k = patch.getKnobs().getByID(prevKnob); if (k != null) k.setParameter(null); } if (knob >= 0) { VoiceArea va = null; if (vaId == Format.VALUE_SECTION_VOICE_AREA_POLY) va = patch.getPolyVoiceArea(); else if (vaId == Format.VALUE_SECTION_VOICE_AREA_COMMON) va = patch.getCommonVoiceArea(); if (va == null) return; PModule module = va.getModule(moduleId); PParameter p; try { p = Helper.getParameter(module, "parameter", paramId); } catch (InvalidDescriptorException e) { return; } Knob k = patch.getKnobs().getByID(knob); if (k != null) k.setParameter(p); } }