fix 128 instrument song failing to read

This commit is contained in:
tildearrow 2022-01-03 03:35:13 -05:00
parent cbc39909e4
commit 7ed1777bdc
3 changed files with 20 additions and 2 deletions

View File

@ -622,7 +622,7 @@ bool DivEngine::load(unsigned char* f, size_t slen) {
}
if (ds.version>0x03) {
ds.insLen=reader.readC();
ds.insLen=(unsigned char)reader.readC();
} else {
ds.insLen=16;
}
@ -905,7 +905,7 @@ bool DivEngine::load(unsigned char* f, size_t slen) {
}
}
ds.sampleLen=reader.readC();
ds.sampleLen=(unsigned char)reader.readC();
logI("reading samples (%d)...\n",ds.sampleLen);
if (ds.version<0x0b && ds.sampleLen>0) { // TODO what is this for?
reader.readC();

View File

@ -9,6 +9,11 @@
#include <map>
#include <queue>
// TODO;
// - prepare for multi-chip support
// - implement the .fur format
// - increase all 17 fields to 128 or more
#define DIV_VERSION "0.2.1"
#define DIV_ENGINE_VERSION 13
@ -79,6 +84,15 @@ struct DivNoteEvent {
on(o) {}
};
struct DivDispatchContainer {
DivDispatch* dispatch;
blip_buffer_t* bb[2];
size_t bbInLen;
int temp[2], prevSample[2];
short* bbIn[2];
short* bbOut[2];
};
class DivEngine {
DivDispatch* dispatch;
TAAudio* output;
@ -192,6 +206,9 @@ class DivEngine {
// get sys channel count
int getChannelCount(DivSystem sys);
// TODO: get channel count
int getTotalChannelCount();
// get channel type
// - 0: FM
// - 1: pulse

View File

@ -74,6 +74,7 @@ struct DivSong {
unsigned char version;
// system
// TODO: multi-chip support
DivSystem system;
// song information