Csound Csound-dev Csound-tekno Search About

[Csnd-dev] Messages at the end of performance

Date2024-04-19 12:47
FromEduardo Moguillansky
Subject[Csnd-dev] Messages at the end of performance
Hi,

at the moment it seems impossible to disable these messages at the end of performance / when a Csound object is stopped:

end of score.              overall amps:      0.0
           overall samples out of range:        0
0 errors in performance

This seems to come from Engine/musmon.c:

    /* print stats only if musmon was actually run */
    /* NOT SURE HOW   ************************** */
    // if(csound->oparms->msglevel)
    {
      csound->ErrorMsg(csound, Str("end of score.\t\t   overall amps:"));
      corfile_rm(csound, &csound->expanded_sco);
      for (n = 0; n < csound->nchnls; n++) {
        if (csound->smaxamp[n] > csound->omaxamp[n])
          csound->omaxamp[n] = csound->smaxamp[n];
        if (csound->maxamp[n] > csound->omaxamp[n])
          csound->omaxamp[n] = csound->maxamp[n];
        STA(orngcnt)[n] += (STA(srngcnt)[n] + csound->rngcnt[n]);
      }
      for (maxp = csound->omaxamp, n = csound->nchnls; n--; )
        print_maxamp(csound, *maxp++);
      if (csound->oparms->outformat != AE_FLOAT) {
        csound->ErrorMsg(csound, Str("\n\t   overall samples out of range:"));
        for (rngp = STA(orngcnt), n = csound->nchnls; n--; )
          csound->ErrorMsg(csound, "%9d", *rngp++);
      }
      csound->ErrorMsg(csound, Str("\n%d errors in performance\n"),
                      csound->perferrcnt);
      print_benchmark_info(csound, Str("end of performance"));
      if (csound->print_version) print_csound_version(csound);
    }

It would be great if this would follow the message level, as suggested in the commented out if check. Does anyone remember / know why this is commented out?
When using csound as a library embedded in other software it should be possible to remove any unwanted messages, particularly if there are no errors.

Cheers,
Eduardo

Date2024-04-19 14:37
FromSteven Yi
SubjectRe: [Csnd-dev] Messages at the end of performance
I too think it would be nice if these messages were not shown if
Csound did not run. I looked at the code and if you uncommented it it
will respect msgLevel, but that in itself doesn't satisfy whether
Csound has run or not (which is what the comment mentions). I think
it'd be fine to uncomment that msgLevel check, and checking if Csound
ran or not could be addressed separately.

On Fri, Apr 19, 2024 at 7:47 AM Eduardo Moguillansky
 wrote:
>
> Hi,
>
> at the moment it seems impossible to disable these messages at the end of performance / when a Csound object is stopped:
>
> end of score.              overall amps:      0.0
>            overall samples out of range:        0
> 0 errors in performance
>
> This seems to come from Engine/musmon.c:
>
>     /* print stats only if musmon was actually run */
>     /* NOT SURE HOW   ************************** */
>     // if(csound->oparms->msglevel)
>     {
>       csound->ErrorMsg(csound, Str("end of score.\t\t   overall amps:"));
>       corfile_rm(csound, &csound->expanded_sco);
>       for (n = 0; n < csound->nchnls; n++) {
>         if (csound->smaxamp[n] > csound->omaxamp[n])
>           csound->omaxamp[n] = csound->smaxamp[n];
>         if (csound->maxamp[n] > csound->omaxamp[n])
>           csound->omaxamp[n] = csound->maxamp[n];
>         STA(orngcnt)[n] += (STA(srngcnt)[n] + csound->rngcnt[n]);
>       }
>       for (maxp = csound->omaxamp, n = csound->nchnls; n--; )
>         print_maxamp(csound, *maxp++);
>       if (csound->oparms->outformat != AE_FLOAT) {
>         csound->ErrorMsg(csound, Str("\n\t   overall samples out of range:"));
>         for (rngp = STA(orngcnt), n = csound->nchnls; n--; )
>           csound->ErrorMsg(csound, "%9d", *rngp++);
>       }
>       csound->ErrorMsg(csound, Str("\n%d errors in performance\n"),
>                       csound->perferrcnt);
>       print_benchmark_info(csound, Str("end of performance"));
>       if (csound->print_version) print_csound_version(csound);
>     }
>
> It would be great if this would follow the message level, as suggested in the commented out if check. Does anyone remember / know why this is commented out?
> When using csound as a library embedded in other software it should be possible to remove any unwanted messages, particularly if there are no errors.
>
> Cheers,
> Eduardo