<commit_before>/*
    srconv.c

    Copyright (C) 1989, 2000 <NAME>, <NAME>

    This file is part of Csound.

    The Csound Library is free software; you can redistribute it
    and/or modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    Csound is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with Csound; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA
*/

/*
 *    PROGRAM:   srconv - sample rate converter
 *
 *    AUTHOR:    <NAME>
 *
 *    DATE:      August 26, 1989
 *
 *    COMMENTS:  srconv takes floats on stdin at sample rate Rin and
 *               outputs them on stdout at sample rate Rout.  optionally,
 *               the ratio (Rin / Rout)  may be linearly time-varying
 *               according to a set of (time, ratio) pairs in an auxiliary file.
 *
 *               flags:
 *
 *                    r = output sample rate (must be specified)
 *                    R = input sample rate (must be specified)
 *                    P = input sample rate / output sample rate
 *                    Q = quality factor (1 to 8: default = 2)
 *                    if a time-varying control file is given, it must be last
 *
 *    MODIFIED:  <NAME> December 2000; changes to Csound context
 */

#include "std_util.h"
#include "soundio.h"
#include <math.h>
#include <ctype.h>

#define IBUF    (4096)
#define IBUF2   (IBUF/2)
#define OBUF    (4096)

#define FIND(MSG)                                                   \
{                                                                   \
    if (*s == '\0')                                                 \
      if (!(--argc) || (((s = *argv++) != NULL) && *s == '-')) {    \
        dieu(csound, MSG); return -1;                               \
      }                                                             \
}

static  void    kaiser(int, float *, int, int, double);
static  void    usage(CSOUND *);

static int writebuffer(CSOUND *csound, MYFLT *out_buf, int *block,
                                        SNDFILE *outfd, int length)
{
    sf_write_MYFLT(outfd, out_buf, length);
    (*block)++;
    if (csound->oparms->rewrt_hdr)
      csound->rewriteheader(outfd);
    switch (csound->oparms->heartbeat) {
      case 1:
        csound->MessageS(csound, CSOUNDMSG_REALTIME, "%c\010",
                                                     "|/-\\"[*block & 3]);
        break;
      case 2:
        csound->MessageS(csound, CSOUNDMSG_REALTIME, ".");
        break;
      case 3:<commit_msg>fixed warning<commit_after>/*
    srconv.c

    Copyright (C) 1989, 2000 <NAME>, <NAME>

    This file is part of Csound.

    The Csound Library is free software; you can redistribute it
    and/or modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    Csound is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with Csound; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA
*/

/*
 *    PROGRAM:   srconv - sample rate converter
 *
 *    AUTHOR:    <NAME>
 *
 *    DATE:      August 26, 1989
 *
 *    COMMENTS:  srconv takes floats on stdin at sample rate Rin and
 *               outputs them on stdout at sample rate Rout.  optionally,
 *               the ratio (Rin / Rout)  may be linearly time-varying
 *               according to a set of (time, ratio) pairs in an auxiliary file.
 *
 *               flags:
 *
 *                    r = output sample rate (must be specified)
 *                    R = input sample rate (must be specified)
 *                    P = input sample rate / output sample rate
 *                    Q = quality factor (1 to 8: default = 2)
 *                    if a time-varying control file is given, it must be last
 *
 *    MODIFIED:  <NAME> December 2000; changes to Csound context
 */

#include "std_util.h"
#include "soundio.h"
#include <math.h>
#include <ctype.h>

#define IBUF    (4096)
#define IBUF2   (IBUF/2)
#define OBUF    (4096)

#define FIND(MSG)                                                   \
{                                                                   \
    if (*s == '\0')                                                 \
      if (!(--argc) || (((s = *argv++) != NULL) && *s == '-')) {    \
        dieu(csound, MSG); return -1;                               \
      }                                                             \
}

static  void    kaiser(int, float *, int, int, double);
static  void    usage(CSOUND *);

static int writebuffer(CSOUND *csound, MYFLT *out_buf, int *block,
                                        SNDFILE *outfd, int length)
{
    sf_write_MYFLT(outfd, out_buf, length);
    (*block)++;
    if (csound->oparms->rewrt_hdr)
      csound->rewriteheader((struct SNDFILE *)outfd);
    switch (csound->oparms->heartbeat) {
      case 1:
        csound->MessageS(csound, CSOUNDMSG_REALTIME, "%c\010",
                                                     "|/-\\"[*block & 3]);
        break;
      case 2:
        csound->MessageS(csound, CSOUNDMSG_REALTIME, ".");
        break;
      case 3:
{'fraction_non_alphanumeric': 0.09214959568733154, 'fraction_numerical': 0.018867924528301886, 'mean_word_length': 1.5903141361256545, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6560463', 'n_tokens_mistral': 1722, 'n_tokens_neox': 1584, 'n_words': 616}