26 #ifndef AUDIO_SOUNDFONT_SF2FILE_H 27 #define AUDIO_SOUNDFONT_SF2FILE_H 29 #include "common/endian.h" 30 #include "common/scummsys.h" 31 #include "common/array.h" 32 #include "common/str.h" 43 startAddrsCoarseOffset,
100 startloopAddrCoarseOffset,
105 endloopAddrsCoarseOffset,
118 typedef uint16 SFGenerator;
136 typedef uint16 SFModulator;
142 typedef uint16 SFTransform;
191 static inline void uint16Write(uint8 **buffer, uint16 value) {
192 WRITE_LE_UINT16(*buffer, value);
196 static inline void uint32Write(uint8 **buffer, uint32 value) {
197 WRITE_LE_UINT32(*buffer, value);
201 static inline void writeBytes(uint8 **buffer, byte *bytes, uint32 size) {
202 memcpy(*buffer, bytes, size);
213 uint8 *write(uint8 *buffer) {
214 uint16Write(&buffer, wMajor);
215 uint16Write(&buffer, wMinor);
221 char achPresetName[20];
224 uint16 wPresetBagNdx;
229 uint8 *write(uint8 *buffer) {
230 writeBytes(&buffer, (byte *)achPresetName, 20);
231 uint16Write(&buffer, wPreset);
232 uint16Write(&buffer, wBank);
233 uint16Write(&buffer, wPresetBagNdx);
234 uint32Write(&buffer, dwLibrary);
235 uint32Write(&buffer, dwGenre);
236 uint32Write(&buffer, dwMorphology);
245 uint8 *write(uint8 *buffer) {
246 uint16Write(&buffer, wGenNdx);
247 uint16Write(&buffer, wModNdx);
253 SFModulator sfModSrcOper;
254 SFGenerator sfModDestOper;
256 SFModulator sfModAmtSrcOper;
257 SFTransform sfModTransOper;
259 uint8 *write(uint8 *buffer) {
260 uint16Write(&buffer, sfModSrcOper);
261 uint16Write(&buffer, sfModDestOper);
262 uint16Write(&buffer, modAmount);
263 uint16Write(&buffer, sfModAmtSrcOper);
264 uint16Write(&buffer, sfModTransOper);
272 void setRangeLo(uint8 lo) { data[0] = lo; }
273 void setRangeHi(uint8 hi) { data[1] = hi; }
274 void setShAmount(int16 shAmount) { WRITE_LE_INT16(data, shAmount); }
275 void setwAmount(int16 wAmount) { WRITE_LE_UINT16(data, wAmount); }
277 uint8 *write(uint8 *buffer) {
278 writeBytes(&buffer, (byte *)data, 2);
284 SFGenerator sfGenOper;
287 uint8 *write(uint8 *buffer) {
288 uint16Write(&buffer, sfGenOper);
289 return genAmount.write(buffer);
294 SFGenerator sfGenOper;
297 uint8 *write(uint8 *buffer) {
298 uint16Write(&buffer, sfGenOper);
299 return genAmount.write(buffer);
304 char achInstName[20];
307 uint8 *write(uint8 *buffer) {
308 writeBytes(&buffer, (byte *)achInstName, 20);
309 uint16Write(&buffer, wInstBagNdx);
318 uint8 *write(uint8 *buffer) {
319 uint16Write(&buffer, wInstGenNdx);
320 uint16Write(&buffer, wInstModNdx);
330 RomMonoSample = 0x8001,
331 RomRightSample = 0x8002,
332 RomLeftSample = 0x8004,
333 RomLinkedSample = 0x8008
336 typedef uint16 SFSampleLink;
339 char achSampleName[20];
348 SFSampleLink sfSampleType;
350 uint8 *write(uint8 *buffer) {
351 writeBytes(&buffer, (byte *)achSampleName, 20);
352 uint32Write(&buffer, dwStart);
353 uint32Write(&buffer, dwEnd);
354 uint32Write(&buffer, dwStartloop);
355 uint32Write(&buffer, dwEndloop);
356 uint32Write(&buffer, dwSampleRate);
357 *buffer++ = byOriginalKey;
358 *buffer++ = chCorrection;
359 uint16Write(&buffer, wSampleLink);
360 uint16Write(&buffer, sfSampleType);
370 SetData(info.c_str(), (uint32) info.size());
394 const void *SaveToMem();
397 #endif // AUDIO_SOUNDFONT_SF2FILE_H
Definition: sf2file.h:241
Definition: synthfile.h:48
Definition: rifffile.h:109
Definition: sf2file.h:209
Definition: sf2file.h:293
Definition: sf2file.h:269
Definition: sf2file.h:252
Definition: rifffile.h:37
Definition: sf2file.h:389
Definition: sf2file.h:283
Definition: sf2file.h:367
Definition: sf2file.h:338
Definition: sf2file.h:303
Definition: sf2file.h:379
Definition: rifffile.h:101
Definition: sf2file.h:314
Definition: sf2file.h:374