Logo Search packages:      
Sourcecode: csound version File versions

cscoremain.c

/*
    cscoremain.c:

    Copyright (C) 1991 Barry Vercoe, John ffitch

    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
*/

#include "csound.h"                                   /*   CSCOREMAIN.C   */
#include <stdarg.h>

extern void cscore(CSOUND*);

/* Cscore stub to run a user program standalone */

/* To create a standalone cscore program, compile this file with your own 
   file (e.g. mycscore.c) containing a cscore() control function.  Use 
   this command (or your system's equivalent):

gcc mycscore.c cscoremain.c -o cscore -lcsound -L/usr/local/lib -I/usr/local/include/csound

   The resulting executable can be run with:

./cscore scorein > scoreout

 */

int main(int argc, char **argv)
{
    CSOUND  *cs;
    FILE    *insco;
    int     result;

    /* Standalone Cscore is now a client of the Csound API */
    result = csoundInitialize(NULL, NULL, 0);
    if (result < 0) {
      fprintf(stderr, "Could not initialize the Csound library.\n");
      return -1;
    }
    cs = csoundCreate(NULL);
    if (cs == NULL) {
      fprintf(stderr, "Could not instantiate Csound.\n");
      return -1;
    }

    /* open the command line scorein file */
    if (argc < 2) {
      fprintf(stderr, "Insufficient arguments: must provide an input filename.\n");
      return -1;
    }
    if (!(insco = fopen(argv[1], "r"))) {
      fprintf(stderr, "Cannot open the input score %s\n", *argv);
      return -1;
    }

    csoundInitializeCscore(cs, insco, stdout);
    cscore(cs);                         /* and call the user cscore program   */
    return 0;
}

Generated by  Doxygen 1.6.0   Back to index