Esempio n. 1
0
  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();
  }
Esempio n. 2
0
  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);
  }
Esempio n. 3
0
  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);
    }
  }