Skip to content
Snippets Groups Projects
Select Git revision
  • e1f8e855b22b8b6982936e01b4b6f73ae5dd7121
  • master default protected
  • iopsys
  • develop
  • gh-pages
  • 0.4.x
  • v0.5.0-rc23
  • v0.5.0-rc22
  • v0.5.0-rc21
  • v0.5.0-rc20
  • v0.5.0-rc19
  • v0.5.0-rc18
  • v0.5.0-rc17
  • 0.5.0-rc16
  • v0.5.0-rc15
  • v0.4.7
  • v0.5.0-rc12
  • v0.5.0-rc11
  • v0.4.3
  • v0.5.0-rc10
  • v0.5.0-rc9
  • v0.5.0-rc8
  • v0.5.0-rc7
  • v0.5.0-rc6
  • v0.5.0-rc5
  • v0.5.0-rc4
26 results

run.js

Blame
  • frame.c 28.87 KiB
    /****************************************************************************
     *
     * Programs for processing sound files in raw- or WAV-format.
     * -- Useful functions for parsing command line options and
     *    issuing errors, warnings, and chit chat.
     *
     * Name:    frame.c
     * Version: see static char *standardversion, below.
     * Author:  Mark Roberts <mark@manumark.de>
     *	    Michael Labuschke <michael@labuschke.de> sys_errlist fixes 
     *		
     ****************************************************************************/
    /****************************************************************************
     *  These are useful functions that all DSP programs might find handy
     ****************************************************************************/
    
    #include <stdio.h>
    #include <math.h>
    #include <stdlib.h> /* for exit and malloc */
    #include <string.h>
    #include <time.h>
    #include <stdarg.h>
    #include <errno.h>
    #include <assert.h>
    #include "frame.h"
    
    time_t stopwatch;       /* will hold time at start of calculation */
    int samplefrequency;
    unsigned short samplewidth;
    unsigned short channels;
    int wavout;            /* TRUE iff out file should be a .WAV file */
    int iswav;             /* TRUE iff in file was found to be a .WAV file */
    FILE *in, *out;
    char *infilename, *outfilename;
    int verboselevel;
    char *version = "";
    char *usage = "";
    static int test_usage;
    
    static char *standardversion = "frame version 1.3, June 13th 2001";
    static char *standardusage =
    "\nOptions common to all mark-dsp programs:\n"
    
    "-h \t\t create a WAV-header on output files.\n"
    "-c#\t\t set number of channels to # (1 or 2). Default: like input.\n"
    "-w#\t\t set number of bits per sample (width) to # (only 16)\n"
    "-f#\t\t set sample frequency to #. Default: like input.\n"
    "-V \t\t verbose: talk a lot.\n"
    "-Q \t\t quiet: talk as little as possible.\n\n"
    "In most cases, a filename of '-' means stdin or stdout.\n\n"
    "Bug-reports: mark@manumark.de\n"
    ;
    
    /* -----------------------------------------------------------------------
       Writes the number of samples to result that are yet to be read from anyin.
       Return values are TRUE on success, FALSE on failure.
       -----------------------------------------------------------------------*/
    int getremainingfilelength( FILE *anyin, long *result)
    {
        long i;
    
        i = ftell (anyin);
        if (i == -1) return FALSE;
        if (fseek (anyin, 0, SEEK_END) == -1) return FALSE;
        *result = ftell (anyin);
        if (*result == -1) return FALSE;
        (*result) -= i;
        (*result) /= samplewidth;
        if (fseek (anyin, i, SEEK_SET) == -1) return FALSE;
        return TRUE;