Beispiel #1
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);
  }
Beispiel #2
0
  public void messageReceived(ParameterMessage message) {
    int slotId = message.getSlot();

    if (!isValidSlot(slotId)) return;

    int vaId = message.getSection();
    int moduleId = message.getModule();
    int paramId = message.getParameter();
    int value = message.getValue();

    // addParameter("pid", "data:pid");
    // addParameter("sc", "data:sc");

    NmSlot slot = synth.getSlot(slotId);
    NMPatch patch = slot.getPatch();

    PModuleContainer va = null;
    String parameterClass = "parameter";

    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.getMorphSection();
    } else {
      // should not happen
      return;
    }

    PModule module = va.getModule(moduleId);

    PParameter p;
    try {
      p = Helper.getParameter(module, parameterClass, paramId);
    } catch (InvalidDescriptorException e) {
      return;
    }
    p.setValue(value);
    return;
  }