File: sftype.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 (226 lines) | stat: -rw-r--r-- 5,381 bytes parent folder | download | duplicates (4)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/*
    sftype.h:

    Copyright (C) 2000 Gabriel Maldonado

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

#if !defined(_SFTYPE_H)
#define _SFTYPE_H
#ifdef          __GNUC__
#  ifndef       PACKED
#    define     PACKED  __attribute__((packed))
#  endif        /* PACKED */
#elif defined MSVC
#  pragma       pack(push, before, 1)
#  define     PACKED
#else
# error "No pack defined."
#endif

#ifndef WORDS_BIGENDIAN
#  if defined(__POWERPC__) || defined(__PPC__) || defined(__ppc__)
#    define WORDS_BIGENDIAN 1
#  endif
#endif

#if defined(WORDS_BIGENDIAN) && defined(__i386__)
#  undef WORDS_BIGENDIAN
#endif

#if !defined(WIN32) || defined(__CYGWIN__)
typedef uint32_t    DWORD;
#endif
/*  typedef int32_t     BOOL; */
typedef uint8_t     BYTE;
typedef uint16_t    WORD;
typedef short       SHORT;
typedef char        CHAR;

typedef uint16_t SFTransform;

typedef struct
{
#ifdef WORDS_BIGENDIAN
  /* bigendian m/c like Mac and SGI */
        BYTE byHi;
        BYTE byLo;
#else
        BYTE byLo;
        BYTE byHi;
#endif
} PACKED rangesType;

typedef union
{
  rangesType ranges;
  SHORT shAmount;
  WORD wAmount;
} PACKED genAmountType;

/* The SFSampleLink is an enumeration type which
   describes both the type of sample (mono, stereo left, etc.)
   and the whether the sample is located in RAM or ROM memory: */

typedef enum
{
        monoSample = 1,
        rightSample = 2,
        leftSample = 4,
        linkedSample = 8,
        ROMSample =     0x8000,  /*32768 */
        RomMonoSample = 0x8001,  /*32769 */
        RomRightSample = 0x8002,  /*32770 */
        RomLeftSample = 0x8004,   /*32772 */
        RomLinkedSample = 0x8008   /*32776 */
} SFSampleLink;

 /* The INFO-list chunk in a SoundFont 2 compatible file contains
  three mandatory and a variety of optional subchunks as defined below.
  The INFO-list chunk gives basic information about the SoundFont
  compatible bank contained in the file.
 */

/* The ifil subchunk is a mandatory subchunk identifying the SoundFont
  specification version level to which the file complies.
  It is always four bytes in length, and contains data
  according to the structure:
  */

/* <iver-rec>   ->       */
typedef struct
{
        WORD wMajor;
        WORD wMinor;
} PACKED sfVersionTag;

/* <phdr-rec>   ->       */
typedef struct
{
        CHAR achPresetName[20];
        WORD wPreset;
        WORD wBank;
        WORD wPresetBagNdx;
        DWORD dwLibrary;
        DWORD dwGenre;
        DWORD dwMorphology;
} PACKED sfPresetHeader;

/* <pbag-rec>   ->       */
typedef struct
        {
        WORD wGenNdx;
        WORD wModNdx;
} PACKED sfPresetBag;

/* <pmod-rec> ->         */
typedef struct
{
        /*
        SFModulator sfModSrcOper;
        SFGenerator sfModDestOper;
        SHORT modAmount;
        SFModulator sfModAmtSrcOper;
        SFTransform sfModTransOper;
        */

  /* SFModulator sfModSrcOper; */
        WORD sfModSrcOper;
  /* SFGenerator sfModDestOper; */
        WORD sfModDestOper;
        SHORT modAmount;
  /* SFModulator sfModAmtSrcOper; */
        WORD sfModAmtSrcOper;
        SFTransform sfModTransOper;

} PACKED sfModList;

/* <pgen-rec>   ->       */
typedef struct
        {
          /*SFGenerator sfGenOper; */
        WORD sfGenOper;
        genAmountType genAmount;
} PACKED sfGenList;

/* <inst-rec>   ->       */
typedef struct
{
        CHAR achInstName[20];
        WORD wInstBagNdx;
} PACKED sfInst;

/* <ibag-rec>   ->       */
typedef struct
{
        WORD wInstGenNdx;
        WORD wInstModNdx;
} PACKED sfInstBag;

/* <imod-rec> ->         */
typedef struct
{

        /*
        SFModulator sfModSrcOper;
        SFGenerator sfModDestOper;
        SHORT modAmount;
        SFModulator sfModAmtSrcOper;
        SFTransform sfModTransOper;
        */

  /* SFModulator sfModSrcOper; */
        WORD sfModSrcOper;
  /* SFGenerator sfModDestOper; */
        WORD sfModDestOper;
        SHORT modAmount;
  /* SFModulator sfModAmtSrcOper; */
        WORD sfModAmtSrcOper;
        SFTransform sfModTransOper;
} PACKED sfInstModList;

/* <igen-rec>   ->       */
typedef struct
{
  /* SFGenerator sfGenOper; */
        WORD sfGenOper;
        genAmountType genAmount;
} PACKED sfInstGenList;

/* <shdr-rec>   ->       */
typedef struct
{
        CHAR achSampleName[20];
        DWORD dwStart;
        DWORD dwEnd;
        DWORD dwStartloop;
        DWORD dwEndloop;
        DWORD dwSampleRate;
        BYTE byOriginalKey;
        CHAR chCorrection;
        WORD wSampleLink;
  /*SFSampleLink sfSampleType; */
        WORD sfSampleType;
} PACKED sfSample;

#ifdef          MSVC
#  pragma       pack(pop, before)
#endif

#endif