File: cscore.h

package info (click to toggle)
csound 1%3A6.18.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 63,220 kB
  • sloc: ansic: 192,643; cpp: 14,149; javascript: 9,654; objc: 9,181; python: 3,376; java: 3,337; sh: 1,840; yacc: 1,255; xml: 985; perl: 635; lisp: 411; tcl: 341; lex: 217; makefile: 128
file content (126 lines) | stat: -rw-r--r-- 4,616 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
    cscore.h:

    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., 51 Franklin St, Fifth Floor, Boston, MA
    02110-1301 USA
*/

#ifndef  CSCORE_H
#define  CSCORE_H
/**
* \file csound.h
* \section section_api_cscore Cscore
*
* Beginning with Csound 5, all of the Cscore functions described in the
* manual are now part of the Csound API, and they can be called from a program
* that calls the Csound library.
*
* All of the CScore functions are renamed in the Csound API. For
* example, createv() is now cscoreCreateEvent(), and lcopy() is now
* cscoreListCopy().  In addition, each function takes an additional
* first parameter that is a pointer to a CSOUND instance.  You can
* find the details in the header file, cscore.h, which may be
* included with your Csound distribution, or if not, can be found in
* Csound CVS `on SourceForge.
*
* Before you can use any of the Cscore API functions, you must create a CSOUND
* instance and initialize Cscore by calling csoundInitializeCscore() -- see
* csound.h for an explanation.  An example main program that does all of this
* Top/cscormai.c.  You should add a function called cscore() with your own
* score-processing code.  An example that does nothing except write the score
* back out unchanged can be found in the file Top/cscore_internal.c.
*
* To create your own standalone Cscore program, you must compile cscormai.c
* (or your own main program) and the file containing your
* cscore() function, and link them with the Csound API library.
*/

#include <stdio.h>

#ifndef MYFLT
#include "sysdep.h"
#endif
#include "csound.h"

typedef struct cshdr {
        struct cshdr *prvblk;
        struct cshdr *nxtblk;
        int16  type;
        int16  size;
} CSHDR;

/* Single score event structure */
typedef struct {
        CSHDR h;
        char  *strarg;
        char  op;
        int16 pcnt;
        MYFLT p2orig;
        MYFLT p3orig;
        MYFLT p[1];
} EVENT;

/* Event list structure */
typedef struct {
        CSHDR h;
        int   nslots;
        int   nevents;
        EVENT *e[1];
} EVLIST;

/* Functions for working with single events */
PUBLIC EVENT  *cscoreCreateEvent(CSOUND*, int);
PUBLIC EVENT  *cscoreDefineEvent(CSOUND*, char*);
PUBLIC EVENT  *cscoreCopyEvent(CSOUND*, EVENT*);
PUBLIC EVENT  *cscoreGetEvent(CSOUND*);
PUBLIC void    cscorePutEvent(CSOUND*, EVENT*);
PUBLIC void    cscorePutString(CSOUND*, char*);

/* Functions for working with event lists */
PUBLIC EVLIST *cscoreListCreate(CSOUND*, int);
PUBLIC EVLIST *cscoreListAppendEvent(CSOUND*, EVLIST*, EVENT*);
PUBLIC EVLIST *cscoreListAppendStringEvent(CSOUND*, EVLIST*, char*);
PUBLIC EVLIST *cscoreListGetSection(CSOUND*);
PUBLIC EVLIST *cscoreListGetNext(CSOUND *, MYFLT);
PUBLIC EVLIST *cscoreListGetUntil(CSOUND*, MYFLT);
PUBLIC EVLIST *cscoreListCopy(CSOUND*, EVLIST*);
PUBLIC EVLIST *cscoreListCopyEvents(CSOUND*, EVLIST*);
PUBLIC EVLIST *cscoreListExtractInstruments(CSOUND*, EVLIST*, char*);
PUBLIC EVLIST *cscoreListExtractTime(CSOUND*, EVLIST*, MYFLT, MYFLT);
PUBLIC EVLIST *cscoreListSeparateF(CSOUND*, EVLIST*);
PUBLIC EVLIST *cscoreListSeparateTWF(CSOUND*, EVLIST*);
PUBLIC EVLIST *cscoreListAppendList(CSOUND*, EVLIST*, EVLIST*);
PUBLIC EVLIST *cscoreListConcatenate(CSOUND*, EVLIST*, EVLIST*);
PUBLIC void    cscoreListPut(CSOUND*, EVLIST*);
PUBLIC int     cscoreListPlay(CSOUND*, EVLIST*);
PUBLIC void    cscoreListSort(CSOUND*, EVLIST*);
PUBLIC int     cscoreListCount(CSOUND*, EVLIST *);

/* Functions for reclaiming memory */
PUBLIC void    cscoreFreeEvent(CSOUND*, EVENT*);
PUBLIC void    cscoreListFree(CSOUND*, EVLIST*);
PUBLIC void    cscoreListFreeEvents(CSOUND*, EVLIST*);

/* Functions for working with multiple input score files */
PUBLIC FILE   *cscoreFileOpen(CSOUND*, char*);
PUBLIC void    cscoreFileClose(CSOUND*, FILE*);
PUBLIC FILE   *cscoreFileGetCurrent(CSOUND*);
PUBLIC void    cscoreFileSetCurrent(CSOUND*, FILE*);

#endif