prepare for implementing new ins format

This commit is contained in:
tildearrow 2022-11-17 19:07:40 -05:00
parent afcc292c0c
commit dbcd7f31a8
3 changed files with 78 additions and 0 deletions

View file

@ -27,6 +27,7 @@ size | description
the following feature codes are recognized:
- `NA`: instrument name
- `FM`: FM ins data
- `MA`: macro data
- `64`: C64 ins data
@ -76,3 +77,62 @@ size | description
1 | | S L | R R |
1 | | DVB | SSG |
1 | | DAM | W S |
```
# macro data (MA)
```
size | description
-----|------------------------------------
2 | length of macro header
??? | data...
```
each macro is represented like this:
```
size | description
-----|------------------------------------
1 | macro code
| - 0: vol
| - 1: arp
| - 2: duty
| - 3: wave
| - 4: pitch
| - 5: ex1
| - 6: ex2
| - 7: ex3
| - 8: alg
| - 9: fb
| - 10: fms
| - 11: ams
| - 12: panL
| - 13: panR
| - 14: phaseReset
| - 15: ex4
| - 16: ex5
| - 17: ex6
| - 17: ex7
| - 18: ex8
| - 255: stop reading and move on
1 | macro length
1 | macro loop
1 | macro release
1 | macro mode
1 | macro open/type/word size
| - bit 6-7: word size
| - 0: 8-bit unsigned
| - 1: 8-bit signed
| - 2: 16-bit signed
| - 3: 32-bit signed
| - bit 1-2: type
| - 0: normal
| - 1: ADSR
| - 2: LFO
| - bit 0: open
1 | macro delay
1 | macro speed
??? | macro data
| - length: macro length × word sizs
```

View file

@ -23,6 +23,18 @@
#include "../ta-log.h"
#include "../fileutils.h"
void DivInstrument::putInsData2(SafeWriter* w, bool fui) {
size_t blockStartSeek, blockEndSeek;
if (fui) {
w->write("FINS",4);
} else {
w->write("INST",4);
blockStartSeek=w->tell();
w->writeI(0);
}
}
void DivInstrument::putInsData(SafeWriter* w) {
size_t blockStartSeek, blockEndSeek;

View file

@ -571,6 +571,12 @@ struct DivInstrument {
*/
void putInsData(SafeWriter* w);
/**
* save the instrument to a SafeWriter using new format.
* @param w the SafeWriter in question.
*/
void putInsData2(SafeWriter* w, bool fui=false);
/**
* read instrument data in .fui format.
* @param reader the reader.