static void track_body(bs1770gain_print_t *p, aggregate_t *aggregate,
    const options_t *options)
{
  int flags=aggregate->flags;
  FILE *f=p->f;
  double norm=options->preamp+options->norm;
  int width=bs1770gain_print_width(flags);
  double q,db;
#if defined (C_WIN32) // [
  HANDLE hConsoleOutput;
  CONSOLE_SCREEN_BUFFER_INFO consoleScreenBufferInfo;

  if (p->t&&p->vmt->session.file(p)) {
    fflush(p->f);
    hConsoleOutput=GetStdHandle(_fileno(p->f));

    // get the cursor position.
    GetConsoleScreenBufferInfo(
      hConsoleOutput,
          // _In_  HANDLE                      hConsoleOutput,
      &consoleScreenBufferInfo
          // _Out_ PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo
    );

    // erase progress information, i.e. print blanks right to the cursor.
#if defined (W_WIN32) // [
    fwprintf(p->f,L"        ");
#else // ] [
    fprintf(p->f,"        ");
#endif // ]
    fflush(p->f);

    // advance line relative to the original cursor position.
    consoleScreenBufferInfo.dwCursorPosition.Y+=1;

    SetConsoleCursorPosition(
      hConsoleOutput,
          // _In_ HANDLE hConsoleOutput,
      consoleScreenBufferInfo.dwCursorPosition
          // _In_ COORD  dwCursorPosition
    );
  }
#elif defined (W_WIN32) // ] [
  fwprintf(p->f,p->t&&p->vmt->session.file(p)?L"        \n":L"\n");
#else // ] [
  fprintf(p->f,p->t&&p->vmt->session.file(p)?"        \n":"\n");
#endif // ]

  ////////
  if (0!=(flags&AGGREGATE_MOMENTARY_MEAN)) {
    db=lib1770_stats_get_mean(aggregate->momentary,
        options->momentary.mean_gate);
    //fprintf(f,"       integrated:  %.1f LUFS / %.1f LU\n",db,norm-db);
    bs1770gain_print_label("integrated",width,f);
#if defined (W_WIN32) // [
#if defined (WDBFMT) // [
    fwprintf(f,WDBFMT L" LUFS / " WDBFMT L" LU\n",db,norm-db);
#else // ] [
    fwprintf(f,L"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // ]
#else // ] [
#if defined (DBFMT) // [
    fprintf(f,DBFMT " LUFS / " DBFMT " LU\n",db,norm-db);
#else // ] [
    fprintf(f,"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // ]
#endif // ]
  }

  if (0!=(flags&AGGREGATE_MOMENTARY_MAXIMUM)) {
    db=lib1770_stats_get_max(aggregate->momentary);
    //fprintf(f,"        momentary:  %.1f LUFS / %.1f LU\n",db,norm-db);
    bs1770gain_print_label("momentary maximum",width,f);
#if defined (W_WIN32) // [
#if defined (WDBFMT) // [
    fwprintf(f,WDBFMT L" LUFS / " WDBFMT L" LU\n",db,norm-db);
#else // ] [
    fwprintf(f,L"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // ]
#else // ] [
#if defined (DBFMT) // [
    fprintf(f,DBFMT " LUFS / " DBFMT " LU\n",db,norm-db);
#else // ] [
    fprintf(f,"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // ]
#endif // ]
  }

  if (0!=(flags&AGGREGATE_MOMENTARY_RANGE)) {
    db=lib1770_stats_get_range(aggregate->momentary,
        options->momentary.range_gate,
        options->momentary.range_lower_bound,
        options->momentary.range_upper_bound);
    //fprintf(f,"            range:  %.1f LUFS\n",db);
    bs1770gain_print_label("momentary range",width,f);
#if defined (W_WIN32) // [
#if defined (WDBFMT) // [
    fwprintf(f,WDBFMT L" LUFS\n",db);
#else // ] [
    fwprintf(f,L"%.1f LUFS\n",db);
#endif // ]
#else // ] [
#if defined (DBFMT) // [
    fprintf(f,DBFMT " LUFS\n",db);
#else // ] [
    fprintf(f,"%.1f LUFS\n",db);
#endif // ]
#endif // ]
  }

  ////////
  if (0!=(flags&AGGREGATE_SHORTTERM_MEAN)) {
    db=lib1770_stats_get_mean(aggregate->shortterm,
        options->shortterm.mean_gate);
    //fprintf(f,"       integrated:  %.1f LUFS / %.1f LU\n",db,norm-db);
    bs1770gain_print_label("shortterm mean",width,f);
#if defined (W_WIN32) // [
#if defined (WDBFMT) // [
    fwprintf(f,WDBFMT L" LUFS / " WDBFMT L" LU\n",db,norm-db);
#else // ] [
    fwprintf(f,L"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // ]
#else // ] [
#if defined (DBFMT) // [
    fprintf(f,DBFMT " LUFS / " DBFMT " LU\n",db,norm-db);
#else // ] [
    fprintf(f,"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // ]
#endif // ]
  }

  if (0!=(flags&AGGREGATE_SHORTTERM_MAXIMUM)) {
    db=lib1770_stats_get_max(aggregate->shortterm);
    //fprintf(f,"       shortterm:  %.1f LUFS / %.1f LU\n",db,norm-db);
    bs1770gain_print_label("shortterm maximum",width,f);
#if defined (W_WIN32) // [
#if defined (WDBFMT) // [
    fwprintf(f,WDBFMT L" LUFS / " WDBFMT L" LU\n",db,norm-db);
#else // ] [
    fwprintf(f,L"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // ]
#else // ] [
#if defined (DBFMT) // [
    fprintf(f,DBFMT " LUFS / " DBFMT " LU\n",db,norm-db);
#else // ] [
    fprintf(f,"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // ]
#endif // ]
  }

  if (0!=(flags&AGGREGATE_SHORTTERM_RANGE)) {
    db=lib1770_stats_get_range(aggregate->shortterm,
        options->shortterm.range_gate,
        options->shortterm.range_lower_bound,
        options->shortterm.range_upper_bound);
    //fprintf(f,"            range:  %.1f LUFS\n",db);
    bs1770gain_print_label("range",width,f);
#if defined (W_WIN32) // [
#if defined (WDBFMT) // [
    fwprintf(f,WDBFMT L" LUFS\n",db);
#else // ] [
    fwprintf(f,L"%.1f LUFS\n",db);
#endif // ]
#else // ] [
#if defined (DBFMT) // [
    fprintf(f,DBFMT " LUFS\n",db);
#else // ] [
    fprintf(f,"%.1f LUFS\n",db);
#endif // ]
#endif // ]
  }

  ////////
  if (0!=(flags&AGGREGATE_SAMPLEPEAK)) {
    q=aggregate->samplepeak;
    db=LIB1770_Q2DB(q);
    //fprintf(f,"      sample peak:  %.1f SPFS / %f\n",db,q);
    bs1770gain_print_label("sample peak",width,f);
#if defined (W_WIN32) // [
#if defined (WDBFMT) // [
    fwprintf(f,WDBFMT L" SPFS / %f\n",db,q);
#else // ] [
    fwprintf(f,L"%.1f SPFS / %f\n",db,q);
#endif // ]
#else // ] [
#if defined (DBFMT) // [
    fprintf(f,DBFMT " SPFS / %f\n",db,q);
#else // ] [
    fprintf(f,"%.1f SPFS / %f\n",db,q);
#endif // ]
#endif // ]
  }

  if (0!=(flags&AGGREGATE_TRUEPEAK)) {
    q=aggregate->truepeak;
    db=LIB1770_Q2DB(q);
    //fprintf(f,"        true peak:  %.1f TPFS / %f\n",db,q);
    bs1770gain_print_label("true peak",width,f);
#if defined (W_WIN32) // [
#if defined (WDBFMT) // [
    fwprintf(f,WDBFMT L" TPFS / %f\n",db,q);
#else // ] [
    fwprintf(f,L"%.1f TPFS / %f\n",db,q);
#endif // ]
#else // ] [
#if defined (DBFMT) // [
    fprintf(f,DBFMT " TPFS / %f\n",db,q);
#else // ] [
    fprintf(f,"%.1f TPFS / %f\n",db,q);
#endif // ]
#endif // ]
  }
}
static void track_body(bs1770gain_print_t *p, aggregate_t *aggregate,
    const options_t *options)
{
  int flags=aggregate->flags;
  FILE *f=p->f;
  double norm=options->preamp+options->norm;
  double q,db;

  ////////
  if (0!=(flags&AGGREGATE_MOMENTARY_MEAN)) {
    db=lib1770_stats_get_mean(aggregate->momentary,
        options->momentary.mean_gate);
#if defined (DBFMT) // {
    fprintf(f,"      <integrated lufs=\"" DBFMT "\" lu=\"" DBFMT "\" />\n",
        db,norm-db);
#else // } {
    fprintf(f,"      <integrated lufs=\"%.1f\" lu=\"%.1f\" />\n",db,norm-db);
#endif // }
  }

  if (0!=(flags&AGGREGATE_MOMENTARY_MAXIMUM)) {
    db=lib1770_stats_get_max(aggregate->momentary);
#if defined (DBFMT) // {
    fprintf(f,"      <momentary lufs=\"" DBFMT "\" lu=\"" DBFMT "\" />\n",
        db,norm-db);
#else // } {
    fprintf(f,"      <momentary lufs=\"%.1f\" lu=\"%.1f\" />\n",db,norm-db);
#endif // }
  }

  if (0!=(flags&AGGREGATE_MOMENTARY_RANGE)) {
    db=lib1770_stats_get_range(aggregate->momentary,
        options->momentary.range_gate,
        options->momentary.range_lower_bound,
        options->momentary.range_upper_bound);
#if defined (DBFMT) // {
    fprintf(f,"      <momentary-range lufs=\"" DBFMT "\" />\n",db);
#else // } {
    fprintf(f,"      <momentary-range lufs=\"%.1f\" />\n",db);
#endif // }
  }

  ////////
  if (0!=(flags&AGGREGATE_SHORTTERM_MEAN)) {
    db=lib1770_stats_get_mean(aggregate->shortterm,
        options->shortterm.mean_gate);
#if defined (DBFMT) // {
    fprintf(f,"      <shortterm-mean lufs=\"" DBFMT "\" lu=\"" DBFMT "\" />\n",
        db,norm-db);
#else // } {
    fprintf(f,"      <shortterm-mean lufs=\"%.1f\" lu=\"%.1f\" />\n",
        db,norm-db);
#endif // }
  }

  if (0!=(flags&AGGREGATE_SHORTTERM_MAXIMUM)) {
    db=lib1770_stats_get_max(aggregate->shortterm);
#if defined (DBFMT) // {
    fprintf(f,"      <shortterm-maximum lufs=\"" DBFMT "\""
        " lu=\"" DBFMT "\" />\n",db,norm-db);
#else // } {
    fprintf(f,"      <shortterm-maximum lufs=\"%.1f\" lu=\"%.1f\" />\n",
        db,norm-db);
#endif // }
  }

  if (0!=(flags&AGGREGATE_SHORTTERM_RANGE)) {
    db=lib1770_stats_get_range(aggregate->shortterm,
        options->shortterm.range_gate,
        options->shortterm.range_lower_bound,
        options->shortterm.range_upper_bound);
#if defined (DBFMT) // {
    fprintf(f,"      <range lufs=\"" DBFMT "\" />\n",db);
#else // } {
    fprintf(f,"      <range lufs=\"%.1f\" />\n",db);
#endif // }
  }

  ////////
  if (0!=(flags&AGGREGATE_SAMPLEPEAK)) {
    q=aggregate->samplepeak;
    db=LIB1770_Q2DB(q);
#if defined (DBFMT) // {
    fprintf(f,"      <sample-peak spfs=\"" DBFMT "\" factor=\"%f\" />\n",db,q);
#else // } {
    fprintf(f,"      <sample-peak spfs=\"%.1f\" factor=\"%f\" />\n",db,q);
#endif // }
  }

  if (0!=(flags&AGGREGATE_TRUEPEAK)) {
    q=aggregate->truepeak;
    db=LIB1770_Q2DB(q);
#if defined (DBFMT) // {
    fprintf(f,"      <true-peak tpfs=\"" DBFMT "\" factor=\"%f\" />\n",db,q);
#else // } {
    fprintf(f,"      <true-peak tpfs=\"%.1f\" factor=\"%f\" />\n",db,q);
#endif // }
  }

  fflush(p->f);
}
static void track_body(bs1770gain_print_t *p, aggregate_t *aggregate,
    const options_t *options)
{
  int flags=aggregate->flags;
  FILE *f=p->f;
  double norm=options->preamp+options->norm;
  int width=bs1770gain_print_width(flags);
  double q,db;

  fprintf(p->f,p->t&&p->vmt->session.file(p)?"        \n":"\n");

  ////////
  if (0!=(flags&AGGREGATE_MOMENTARY_MEAN)) {
    db=lib1770_stats_get_mean(aggregate->momentary,
        options->momentary.mean_gate);
    //fprintf(f,"       integrated:  %.1f LUFS / %.1f LU\n",db,norm-db);
    bs1770gain_print_label("integrated",width,f);
#if defined (DBFMT) // {
    fprintf(f,DBFMT " LUFS / " DBFMT " LU\n",db,norm-db);
#else // } {
    fprintf(f,"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // }
  }

  if (0!=(flags&AGGREGATE_MOMENTARY_MAXIMUM)) {
    db=lib1770_stats_get_max(aggregate->momentary);
    //fprintf(f,"        momentary:  %.1f LUFS / %.1f LU\n",db,norm-db);
    bs1770gain_print_label("momentary maximum",width,f);
#if defined (DBFMT) // {
    fprintf(f,DBFMT " LUFS / " DBFMT " LU\n",db,norm-db);
#else // } {
    fprintf(f,"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // }
  }

  if (0!=(flags&AGGREGATE_MOMENTARY_RANGE)) {
    db=lib1770_stats_get_range(aggregate->momentary,
        options->momentary.range_gate,
        options->momentary.range_lower_bound,
        options->momentary.range_upper_bound);
    //fprintf(f,"            range:  %.1f LUFS\n",db);
    bs1770gain_print_label("momentary range",width,f);
#if defined (DBFMT) // {
    fprintf(f,DBFMT " LUFS\n",db);
#else // } {
    fprintf(f,"%.1f LUFS\n",db);
#endif // }
  }

  ////////
  if (0!=(flags&AGGREGATE_SHORTTERM_MEAN)) {
    db=lib1770_stats_get_mean(aggregate->shortterm,
        options->shortterm.mean_gate);
    //fprintf(f,"       integrated:  %.1f LUFS / %.1f LU\n",db,norm-db);
    bs1770gain_print_label("shortterm mean",width,f);
#if defined (DBFMT) // {
    fprintf(f,DBFMT " LUFS / " DBFMT " LU\n",db,norm-db);
#else // } {
    fprintf(f,"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // }
  }

  if (0!=(flags&AGGREGATE_SHORTTERM_MAXIMUM)) {
    db=lib1770_stats_get_max(aggregate->shortterm);
    //fprintf(f,"       shortterm:  %.1f LUFS / %.1f LU\n",db,norm-db);
    bs1770gain_print_label("shortterm maximum",width,f);
#if defined (DBFMT) // {
    fprintf(f,DBFMT " LUFS / " DBFMT " LU\n",db,norm-db);
#else // } {
    fprintf(f,"%.1f LUFS / %.1f LU\n",db,norm-db);
#endif // }
  }

  if (0!=(flags&AGGREGATE_SHORTTERM_RANGE)) {
    db=lib1770_stats_get_range(aggregate->shortterm,
        options->shortterm.range_gate,
        options->shortterm.range_lower_bound,
        options->shortterm.range_upper_bound);
    //fprintf(f,"            range:  %.1f LUFS\n",db);
    bs1770gain_print_label("range",width,f);
#if defined (DBFMT) // {
    fprintf(f,DBFMT " LUFS\n",db);
#else // } {
    fprintf(f,"%.1f LUFS\n",db);
#endif // }
  }

  ////////
  if (0!=(flags&AGGREGATE_SAMPLEPEAK)) {
    q=aggregate->samplepeak;
    db=LIB1770_Q2DB(q);
    //fprintf(f,"      sample peak:  %.1f SPFS / %f\n",db,q);
    bs1770gain_print_label("sample peak",width,f);
#if defined (DBFMT) // {
    fprintf(f,DBFMT " SPFS / %f\n",db,q);
#else // } {
    fprintf(f,"%.1f SPFS / %f\n",db,q);
#endif // }
  }

  if (0!=(flags&AGGREGATE_TRUEPEAK)) {
    q=aggregate->truepeak;
    db=LIB1770_Q2DB(q);
    //fprintf(f,"        true peak:  %.1f TPFS / %f\n",db,q);
    bs1770gain_print_label("true peak",width,f);
#if defined (DBFMT) // {
    fprintf(f,DBFMT " TPFS / %f\n",db,q);
#else // } {
    fprintf(f,"%.1f TPFS / %f\n",db,q);
#endif // }
  }
}