From a7b139cd00ad5bd857a0f5b93d219d9ed97490d0 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 20 Nov 2022 03:24:23 -0500 Subject: [PATCH] new ins format, part 5 --- papers/newIns.md | 15 +++++++++++++++ src/engine/instrument.cpp | 40 +++++++++++++++++++++++++++++++-------- src/engine/instrument.h | 3 +++ 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/papers/newIns.md b/papers/newIns.md index 8ae5f6d82..6f420de0b 100644 --- a/papers/newIns.md +++ b/papers/newIns.md @@ -6,6 +6,8 @@ the aim of this new format is to greatly reduce the size of a resulting instrume # header +.fui files use the following header: + ``` size | description -----|------------------------------------ @@ -15,6 +17,18 @@ size | description ??? | features... ``` +instruments in a .fur file use the following header instead: + +``` +size | description +-----|------------------------------------ + 4 | "INS2" block ID + 4 | size of this block + 2 | format version + 2 | instrument type + ??? | features... +``` + a feature uses the following format: ``` @@ -51,6 +65,7 @@ the following feature codes are recognized: - `EN`: end of features - if you find this feature code, stop reading the instrument. - it will usually appear only when there sample/wave lists. + - instruments in a .fur shall end with this feature code. # instrument name (NA) diff --git a/src/engine/instrument.cpp b/src/engine/instrument.cpp index a11a9dabc..e509612d1 100644 --- a/src/engine/instrument.cpp +++ b/src/engine/instrument.cpp @@ -1720,17 +1720,16 @@ void DivInstrument::putInsData(SafeWriter* w) { w->seek(0,SEEK_END); } +DivDataErrors DivInstrument::readInsDataNew(SafeReader& reader, short version, bool fui) { + logE("new ins reading not implemented yet!"); + return DIV_DATA_INVALID_DATA; +} + #define READ_MACRO_VALS(x,y) \ for (int macroValPos=0; macroValPosinit(); diff --git a/src/engine/instrument.h b/src/engine/instrument.h index 030a59043..bbea1f4dc 100644 --- a/src/engine/instrument.h +++ b/src/engine/instrument.h @@ -661,6 +661,9 @@ struct DivInstrument { void writeFeatureSU(SafeWriter* w); void writeFeatureES(SafeWriter* w); void writeFeatureX1(SafeWriter* w); + + DivDataErrors readInsDataOld(SafeReader& reader, short version); + DivDataErrors readInsDataNew(SafeReader& reader, short version, bool fui); /** * save the instrument to a SafeWriter.