From 7ed1777bdcedc65ecad5f8fb2bb890193b8b3030 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 3 Jan 2022 03:35:13 -0500 Subject: [PATCH] fix 128 instrument song failing to read --- src/engine/engine.cpp | 4 ++-- src/engine/engine.h | 17 +++++++++++++++++ src/engine/song.h | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index cae2166b7..dbff5d1b5 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -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(); diff --git a/src/engine/engine.h b/src/engine/engine.h index 7de818d57..29a880afd 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -9,6 +9,11 @@ #include #include +// 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 diff --git a/src/engine/song.h b/src/engine/song.h index d7cf1eec0..0f2fbea45 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -74,6 +74,7 @@ struct DivSong { unsigned char version; // system + // TODO: multi-chip support DivSystem system; // song information