Ejemplo n.º 1
0
void configDoubleOutOfRange (ConfigContext * cfg,
			     double lowest,
			     double highest) {
  char buf[256];
  assert (cfg != NULL);
  sprintf (buf, "real value out of range (%lf -- %lf)", lowest, highest);
  showConfigfileContext (cfg, buf);
}
Ejemplo n.º 2
0
/*
 * This call configures this module.
 */
int midiConfig (void *mcfg, ConfigContext * cfg) {
  int v;
  int ack = 0;
  struct b_midicfg * m = (struct b_midicfg *) mcfg;
  if ((ack = getConfigParameter_ir ("midi.upper.channel",
				    cfg,
				    &v,
				    1, 16)) == 1) {
    m->rcvChA = v - 1;
  }
  else if ((ack = getConfigParameter_ir ("midi.lower.channel",
					 cfg,
					 &v,
					 1, 16)) == 1) {
    m->rcvChB = v - 1;
  }
  else if ((ack = getConfigParameter_ir ("midi.pedals.channel",
					 cfg,
					 &v,
					 1, 16)) == 1) {
    m->rcvChC = v - 1;
  }
  else if ((ack = getConfigParameter_ir ("midi.transpose",
					 cfg,
					 &v,
					 -127, 127)) == 1) {
    m->transpose = v;
  }
  else if ((ack = getConfigParameter_ir ("midi.upper.transpose",
					 cfg,
					 &v,
					 -127, 127)) == 1) {
    m->nshA = v;
  }
  else if ((ack = getConfigParameter_ir ("midi.lower.transpose",
					 cfg,
					 &v,
					 -127, 127)) == 1) {
    m->nshB = v;
  }
  else if ((ack = getConfigParameter_ir ("midi.pedals.transpose",
					 cfg,
					 &v,
					 -127, 127)) == 1) {
    m->nshC = v;
  }
  else if ((ack = getConfigParameter_ir ("midi.pedals.transpose.split",
					 cfg,
					 &v,
					 -127, 127)) == 1) {
    m->nshA_PL = v;
  }
  else if ((ack = getConfigParameter_ir ("midi.lower.transpose.split",
					 cfg,
					 &v,
					 -127, 127)) == 1) {
    m->nshA_UL = v;
  }
  else if ((ack = getConfigParameter_ir ("midi.upper.transpose.split",
					 cfg,
					 &v,
					 -127, 127)) == 1) {
    m->nshA_U = v;
  }
  else if (strncasecmp (cfg->name, "midi.controller.reset", 21) == 0) {
    ack++;
    if (atoi(cfg->name+21)) {
      clearControllerMapping(m);
    }
  }
  /*
   * The syntax for this config option is:
   * midi.controller.{upper,lower,pedals}.<cc>=<fname>
   * where <cc> is a MIDI controller number, and
   * <fname> is the symbolic name of a controllable function.
   */
  else if (strncasecmp (cfg->name, "midi.controller.", 16) == 0) {
    unsigned char * ctrlUse = m->ctrlUseA;

    int ccIdx = 0; // offset in cfg->name
    int ccChn = 0;
    if (strncasecmp ((cfg->name) + 16, "upper", 5) == 0) {
      ctrlUse = m->ctrlUseA;
      ccIdx = 22;
      ccChn = m->rcvChA;
    }
    else if (strncasecmp ((cfg->name) + 16, "lower", 5) == 0) {
      ctrlUse = m->ctrlUseB;
      ccIdx = 22;
      ccChn = m->rcvChB;
    }
    else if (strncasecmp ((cfg->name) + 16, "pedals", 6) == 0) {
      ctrlUse = m->ctrlUseC;
      ccIdx = 23;
      ccChn = m->rcvChC;
    }
    else {
      showConfigfileContext (cfg, "directive 'upper', 'lower' or 'pedals' expected");
    }

    /* If the code above managed to parse a channel name... */
    if (0 < ccIdx) {
      int ccn;
      /* ... and we manage to parse a controller number... */
      if (sscanf ((cfg->name) + ccIdx, "%d", &ccn) == 1) {
	/* ...and the controller number is in the allowed range... */
	if ((0 <= ccn) && (ccn < 128)) {
	  int i = getCCFunctionId (cfg->value);
	  if (!strcmp(cfg->value,"unmap")) {
	    remove_CC_map(m, ccChn, ccn);
	  } else if (-1 < i) {
	    remove_CC_map(m, ccChn, ccn);
	    /* Store the controller number indexed by abstract function id */
	    ctrlUse[i] = ccn;
	    parseCCFlags(&(m->ctrlflg[ccChn][ccn]), cfg->value);
	    reverse_cc_map(m, i, ccChn, ccn);
	    ack++;
	  } else {
	    /* No match found for symbolic function name. */
	    showConfigfileContext (cfg,
				   "name of controllable function not found");
	  }
	}
	else {
	  showConfigfileContext (cfg, "controller number out of range");
	}
      }
    }
  }

  return ack;
}
Ejemplo n.º 3
0
void configIntOutOfRange (ConfigContext * cfg, int lowest, int highest) {
  char buf[256];
  assert (cfg != NULL);
  sprintf (buf, "integer value out of range (%d -- %d)", lowest, highest);
  showConfigfileContext (cfg, buf);
}
Ejemplo n.º 4
0
void configDoubleUnparsable (ConfigContext * cfg) {
  assert (cfg != NULL);
  showConfigfileContext (cfg, "value is not a real");
}
Ejemplo n.º 5
0
void configIntUnparsable (ConfigContext * cfg) {
  assert (cfg != NULL);
  showConfigfileContext (cfg, "value is not an integer");
}