samples may have loop points

This commit is contained in:
tildearrow 2022-01-15 17:54:21 -05:00
parent 755042a8fe
commit 785f7e4d40
4 changed files with 16 additions and 6 deletions

View File

@ -210,7 +210,9 @@ size | description
2 | volume
2 | pitch
1 | depth
7 | reserved
3 | reserved
4 | loop point (>=19)
| - -1 means no loop
2?? | sample data (always 16-bit)
# pattern

View File

@ -1312,7 +1312,13 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
sample->depth=reader.readC();
// reserved
for (int j=0; j<7; j++) reader.readC();
for (int j=0; j<3; j++) reader.readC();
if (ds.version>=18) {
sample->loopStart=reader.readI();
} else {
reader.readI();
}
sample->data=new short[sample->length];
reader.read(sample->data,2*sample->length);
@ -1777,9 +1783,10 @@ SafeWriter* DivEngine::saveFur() {
w->writeS(sample->vol);
w->writeS(sample->pitch);
w->writeC(sample->depth);
for (int j=0; j<7; j++) { // reserved
for (int j=0; j<3; j++) { // reserved
w->writeC(0);
}
w->writeI(sample->loopStart);
w->write(sample->data,sample->length*2);
}

View File

@ -9,8 +9,8 @@
#include <map>
#include <queue>
#define DIV_VERSION "0.4pre2"
#define DIV_ENGINE_VERSION 18
#define DIV_VERSION "0.4pre3"
#define DIV_ENGINE_VERSION 19
enum DivStatusView {
DIV_STATUS_NOTHING=0,

View File

@ -2,7 +2,7 @@
struct DivSample {
String name;
int length, rate;
int length, rate, loopStart;
signed char vol, pitch;
unsigned char depth;
short* data;
@ -15,6 +15,7 @@ struct DivSample {
name(""),
length(0),
rate(32000),
loopStart(-1),
vol(0),
pitch(0),
depth(16),