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) { if (ds.version>0x03) {
ds.insLen=reader.readC(); ds.insLen=(unsigned char)reader.readC();
} else { } else {
ds.insLen=16; 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); logI("reading samples (%d)...\n",ds.sampleLen);
if (ds.version<0x0b && ds.sampleLen>0) { // TODO what is this for? if (ds.version<0x0b && ds.sampleLen>0) { // TODO what is this for?
reader.readC(); reader.readC();

View file

@ -9,6 +9,11 @@
#include <map> #include <map>
#include <queue> #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_VERSION "0.2.1"
#define DIV_ENGINE_VERSION 13 #define DIV_ENGINE_VERSION 13
@ -79,6 +84,15 @@ struct DivNoteEvent {
on(o) {} 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 { class DivEngine {
DivDispatch* dispatch; DivDispatch* dispatch;
TAAudio* output; TAAudio* output;
@ -192,6 +206,9 @@ class DivEngine {
// get sys channel count // get sys channel count
int getChannelCount(DivSystem sys); int getChannelCount(DivSystem sys);
// TODO: get channel count
int getTotalChannelCount();
// get channel type // get channel type
// - 0: FM // - 0: FM
// - 1: pulse // - 1: pulse

View file

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