Example #1
0
Local void processOneBar(struct LOC_musicParagraph *LINK)
{
  paragraph_index0 m, cm;
  voice_index voice, cvoice;
  boolean ignore_voice;
  boolean wrote_repeat = false;
  boolean alone;
  Char STR2[256];
  Char STR3[256];

  if (bar_of_line > 1) {
    sprintf(STR3, "%cBar %s", comment, toString(STR2, bar_no));
    putLine(STR3);
  }
  last_bar = (bar_of_line == nbars && final_paragraph);
  if (last_bar && !strcmp(repeat_sign, "|"))
    *repeat_sign = '\0';
  writeRepeat(repeat_sign);
  *LINK->new_meter = '\0';
  for (voice = nvoices; voice >= 1; voice--) {
    if (musicLineNo(voice) > 0) {
      gotoBar(voice, bar_of_line);
      getMeterChange(voice, LINK->new_meter);
    }
  }
  if (last_bar && *LINK->new_meter == '\0' && nleft > pickup && meternum > 0)
    meterChange(LINK->new_meter, nleft, 64, true);
  if (*LINK->new_meter != '\0')
    putLine(LINK->new_meter);
  for (voice = nvoices; voice >= 1; voice--) {
    ignore_voice = !selected[voice-1];
    cvoice = companion(voice);
    m = musicLineNo(voice);
    cm = musicLineNo(cvoice);
    alone = (voice == cvoice || m > 0 && cm == 0 ||
	     m == 0 && cm == 0 && voice < cvoice || !selected[cvoice-1]);
    if (selected[voice-1]) {
      if (m > 0)
	processLine(voice, bar_of_line);
      else if (alone)
	supplyRests(voice);
      else
	ignore_voice = true;
      if (last_bar && *repeat_sign != '\0' && !wrote_repeat) {
	writeRepeat(repeat_sign);
	wrote_repeat = true;
      }
      if (!ignore_voice) {
	if (alone || voicePos(voice) == 1)
	  putLine(" /");
	else
	  putLine(" //");
      }
    }
  }
  bar_no++;
  pickup = 0;
  putLine("");
}
Example #2
0
Local Char *pmxMeter(Char *Result)
{
  short denom, num;
  Char STR1[256], STR3[256], STR4[256], STR5[256];

  if (meternum == 0) {
    num = beatsPerLine();   /** denom := 0; **/
    meterChange(old_meter_word, num, meterdenom, true);
  } else
    num = meternum;   /** denom := pmdenom; **/
  /* CMO: unconditonally assign value of pmdenom to denom */
  denom = pmdenom;
  sprintf(Result, "%s %s %s %s",
	  toString(STR1, num), toString(STR3, PMXmeterdenom(meterdenom)),
	  toString(STR4, pmnum), toString(STR5, denom));
  return Result;
}
Example #3
0
Static void musicParagraph(void)
{
  struct LOC_musicParagraph V;
  voice_index0 j, nvoice;
  Char lyrassign[256];
  Char STR1[256];
  Char STR2[256];
  Char STR3[256], STR4[256], STR5[256];
  voice_index0 FORLIM;
  short FORLIM1;

  paragraphSetup(&nvoice);
  if (nvoice == 0) {
    nonMusic();
    return;
  }
  if (nvoice > nvoices) {
    if (nvoice == 0)
      error("No voices! Did you remember to to supply a Style?", !print);
    sprintf(STR4, "Paragraph has %s voices but Style allows only %s",
	    toString(STR1, nvoice), toString(STR2, nvoices));
    error(STR4, !print);
    return;
  }
  if (first_paragraph)
    includeStartString();
  if (pmx_preamble_done && (!final_paragraph || nvoice > 0)) {
    sprintf(STR5, "%c Paragraph %s line %s bar %s",
	    comment, toString(STR1, paragraph_no),
	    toString(STR2, orig_line_no[0]), toString(STR3, bar_no));
    putLine(STR5);
  }
  testParagraph();
  rememberDurations();
  if (beVerbose())
    describeParagraph();
  /* ---- Knowing the score, we can start setting music ---------------- */
  if (!pmx_preamble_done) {
    doPMXpreamble();
    sprintf(STR3, "%c Paragraph %s line %s bar ",
	    comment, toString(STR1, paragraph_no),
	    toString(STR2, orig_line_no[0]));
    put(STR3, putspace);
    if (pickup > 0)
      putLine("0");
    else
      putLine("1");
  }
  putPMXlines(&V);
  if (must_restyle)
    restyle();
  if (some_vocal && (nvoice > 0 || !final_paragraph)) {
    FORLIM = ninstr;
    for (j = 1; j <= FORLIM; j++) {
      assignLyrics(j, lyrassign);
      if (*lyrassign != '\0') {
	sprintf(STR2, "\\\\%s\\", lyrassign);
	putLine(STR2);
      }
    }
  }
  if (must_respace)
    respace();
  if (meternum == 0)
    putMeter(meterChange(STR2, beatsPerLine(), meterdenom, true), &V);
  if (nleft > 0)
    nbars++;
  if (nbars == 0 && *multi_bar_rest != '\0')
    processMBR(&V);
  else {
    FORLIM1 = nbars;
    for (bar_of_line = 1; bar_of_line <= FORLIM1; bar_of_line++)
      processOneBar(&V);
  }
  restoreDurations();
}