1 /* 2 sf.h: 3 4 Copyright (C) 2000 Gabriel Maldonado, John ffitch 5 6 This file is part of Csound. 7 8 The Csound Library is free software; you can redistribute it 9 and/or modify it under the terms of the GNU Lesser General Public 10 License as published by the Free Software Foundation; either 11 version 2.1 of the License, or (at your option) any later version. 12 13 Csound is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU Lesser General Public License for more details. 17 18 You should have received a copy of the GNU Lesser General Public 19 License along with Csound; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 21 02110-1301 USA 22 */ 23 24 #if !defined(_SF_H) 25 #include "sftype.h" 26 #ifdef __GNUC__ 27 # ifndef PACKED 28 # define PACKED __attribute__((packed)) 29 # endif /* PACKED */ 30 #else 31 # define PACKED 32 #endif 33 #ifdef MSVC 34 # pragma pack(push, before, 1) 35 #endif 36 37 struct _splitType { 38 int32_t num; 39 sfSample *sample; 40 BYTE sampleModes; 41 BYTE minNoteRange; 42 BYTE maxNoteRange; 43 BYTE minVelRange; 44 BYTE maxVelRange; 45 int64_t startOffset; 46 int64_t endOffset; 47 int64_t startLoopOffset; 48 int64_t endLoopOffset; 49 char overridingRootKey; 50 char coarseTune; 51 char fineTune; 52 SHORT scaleTuning; 53 SHORT initialAttenuation; 54 SHORT pan; 55 MYFLT attack; 56 MYFLT decay; 57 MYFLT sustain; 58 MYFLT release; 59 } PACKED; 60 typedef struct _splitType splitType; 61 62 struct _instrType { 63 int32_t num; 64 char *name; 65 BYTE splits_num; 66 splitType *split; 67 } PACKED; 68 typedef struct _instrType instrType; 69 70 struct _layerType { 71 int32_t num; 72 char *name; 73 BYTE splits_num; 74 splitType *split; 75 BYTE minNoteRange; 76 BYTE maxNoteRange; 77 BYTE minVelRange; 78 BYTE maxVelRange; 79 char coarseTune; 80 char fineTune; 81 SHORT scaleTuning; 82 SHORT initialAttenuation; 83 SHORT pan; 84 } PACKED; 85 typedef struct _layerType layerType; 86 87 struct _presetType { 88 char *name; 89 int32_t num; 90 WORD prog; 91 WORD bank; 92 int32_t layers_num; 93 layerType *layer; 94 } PACKED; 95 typedef struct _presetType presetType; 96 97 struct _CHUNK { 98 BYTE ckID[4]; /* A chunk ID identifies the type of data within the chunk. */ 99 DWORD ckSize; /* The size of the chunk data in bytes, excluding any pad byte. */ 100 BYTE *ckDATA; /* The actual data plus a pad byte if req�d to word align. */ 101 } PACKED; 102 typedef struct _CHUNK CHUNK; 103 104 struct _CHUNKS { 105 CHUNK main_chunk; 106 CHUNK *phdrChunk, *pbagChunk, *pmodChunk, *pgenChunk, *instChunk, 107 *ibagChunk, *imodChunk, *igenChunk, *shdrChunk, *smplChunk; 108 sfPresetHeader *phdr; 109 sfInst *inst; 110 sfSample *shdr; 111 sfPresetBag *pbag; 112 sfModList *pmod; 113 sfGenList *pgen; 114 sfInstBag *ibag; 115 sfInstModList *imod; 116 sfInstGenList *igen; 117 } PACKED; 118 typedef struct _CHUNKS CHUNKS; 119 120 struct _SFBANK { 121 char name[256]; 122 int32_t presets_num; 123 presetType *preset; 124 int32_t instrs_num; 125 instrType *instr; 126 SHORT *sampleData; 127 CHUNKS chunk; 128 } PACKED; 129 typedef struct _SFBANK SFBANK; 130 131 #ifdef MSVC 132 # pragma pack(pop, before) 133 #endif 134 #define _SF_H 135 #endif 136