示例#1
0
文件: prepmx.c 项目: MiKTeX/miktex
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();
}
示例#2
0
void doPMXpreamble(void)
{
  static Char clefcode[9] = "0123456";
  short i, j;
  Char clefs[256];
  Char STR1[256];
  Char STR2[256];
  Char STR3[58];
  short FORLIM;
  Char STR5[256];

  if (*composer_line != '\0')
    putLine(composer_line);
  if (*title_line != '\0') {
    sprintf(STR2, "\\mtxTitleLine{%s}", title_line);
    putLine(STR2);
  }
  putLine("---");
  if (instrumentNames() && !redefined[(long)indent])
    strcpy(fracindent, "0.12");
  fprintf(outfile, "%d", nstaves);
  fprintf(outfile, " %d", -ninstr);
  stave[ninstr] = nstaves + 1;
  for (j = ninstr; j >= 1; j--)
    fprintf(outfile, " %d", stave[j] - stave[j-1]);
  fprintf(outfile, " %s %8.5f %d %d %d %d %s\n",
	  pmxMeter(STR1), xmtrnum0, n_sharps, n_pages, n_systems, musicsize,
	  fracindent);
  FORLIM = ninstr;
  for (i = 1; i <= FORLIM; i++) {
    if (!instrumentNames())
      putLine("");
    else {
      sprintf(STR3, "\\mtxInstrName{%s}", instr_name[ninstr - i]);
      putLine(STR3);
    }
  }
  *clefs = '\0';
  for (i = nclefs - 1; i >= 0; i--)
    sprintf(clefs + strlen(clefs), "%c", clefcode[clefno(clef[i])]);
  putLine(clefs);
  if (*texdir == '\0')
    strcpy(texdir, "./");
  putLine(texdir);

  pmx_preamble_done = true;
  insertTeX();
  respace();

  FORLIM = ngroups;
  for (j = 1; j <= FORLIM; j++)
    fprintf(outfile, "\\\\mtxGroup{%s}{%s}{%s}\\\n",
	    toString(STR1, j), toString(STR2, ninstr - group_start[j-1] + 1),
	    toString(STR5, ninstr - group_stop[j-1] + 1));
  FORLIM = ninstr;
  for (j = 1; j <= FORLIM; j++) {
    if (stave_size[j-1] != unspec) {
      sprintf(STR5, "\\\\mtxSetSize{%s}{%s}\\",
	      toString(STR1, ninstr - j + 1),
	      sizecode(STR2, stave_size[j-1]));
      putLine(STR5);
    }
  }
  if (*part_line != '\0') {
    putLine("Ti");
    putLine(part_line);
  }
  if (*title_line != '\0') {
    putLine("Tt");
    putLine("\\mtxTitle");
  }
  if (*composer_line != '\0') {
    putLine("Tc");
    putLine("\\mtxPoetComposer");
  }
  if (*pmx_line != '\0')
    putLine(pmx_line);
  doTenorClefs();
  if (*cline[(long)width] != '\0')
    putLine(cline[(long)width]);
  wipeCommands();
}