Address unused stuff and CI fix

This commit is contained in:
James Alan Nguyen 2022-04-24 04:34:32 +10:00
parent 3865e3eac6
commit 6638941c9d
4 changed files with 14 additions and 7 deletions

View file

@ -31,7 +31,6 @@
#include <mutex> #include <mutex>
#include <map> #include <map>
#include <queue> #include <queue>
#include <sstream>
#define addWarning(x) \ #define addWarning(x) \
if (warnings.empty()) { \ if (warnings.empty()) { \

View file

@ -646,7 +646,11 @@ void DivEngine::loadOPLI(SafeReader& reader, std::vector<DivInstrument*>& ret, S
String header = reader.readString(11); String header = reader.readString(11);
if (header.compare("WOPL3-INST") == 0) { if (header.compare("WOPL3-INST") == 0) {
uint16_t version = reader.readS(); uint16_t version = reader.readS();
bool isPerc = (reader.readC() == 1); if (version > 3) {
logW("Unknown OPLI version.");
}
reader.readC(); // skip isPerc field
ins->type = DIV_INS_OPL; ins->type = DIV_INS_OPL;
String insName = reader.readString(32); String insName = reader.readString(32);
@ -655,7 +659,6 @@ void DivEngine::loadOPLI(SafeReader& reader, std::vector<DivInstrument*>& ret, S
reader.seek(7, SEEK_CUR); // skip MIDI params reader.seek(7, SEEK_CUR); // skip MIDI params
uint8_t instTypeFlags = reader.readC(); // [0EEEDCBA] - see WOPL/OPLI spec uint8_t instTypeFlags = reader.readC(); // [0EEEDCBA] - see WOPL/OPLI spec
bool is_2op = ((instTypeFlags & 0x3) == 0);
bool is_4op = ((instTypeFlags & 0x1) == 1); bool is_4op = ((instTypeFlags & 0x1) == 1);
bool is_2x2op = (((instTypeFlags>>1) & 0x1) == 1); bool is_2x2op = (((instTypeFlags>>1) & 0x1) == 1);
bool is_rhythm = (((instTypeFlags>>4) & 0x7) > 0); bool is_rhythm = (((instTypeFlags>>4) & 0x7) > 0);
@ -740,7 +743,7 @@ void DivEngine::loadOPNI(SafeReader& reader, std::vector<DivInstrument*>& ret, S
reader.seek(-2, SEEK_CUR); reader.seek(-2, SEEK_CUR);
} }
bool is_perc = (reader.readC() == 0x1); reader.readC(); // skip isPerc
ins->type = DIV_INS_FM; ins->type = DIV_INS_FM;
ins->fm.ops = 4; ins->fm.ops = 4;
@ -1006,7 +1009,6 @@ void DivEngine::loadFF(SafeReader& reader, std::vector<DivInstrument*>& ret, Str
void DivEngine::loadOPM(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath) { void DivEngine::loadOPM(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath) {
std::vector<DivInstrument*> insList; std::vector<DivInstrument*> insList;
std::stringstream ss;
int readCount = 0; int readCount = 0;
@ -1027,7 +1029,7 @@ void DivEngine::loadOPM(SafeReader& reader, std::vector<DivInstrument*>& ret, St
patchNameRead = lfoRead = characteristicRead = m1Read = c1Read = m2Read = c2Read = false; patchNameRead = lfoRead = characteristicRead = m1Read = c1Read = m2Read = c2Read = false;
newPatch = nullptr; newPatch = nullptr;
}; };
auto readIntStrWithinRange = [](String& input, int limitLow, int limitHigh) { auto readIntStrWithinRange = [](String&& input, int limitLow, int limitHigh) {
int x = atoi(input.c_str()); int x = atoi(input.c_str());
return (x>limitHigh) ? limitHigh : return (x>limitHigh) ? limitHigh :
(x<limitLow) ? limitLow : x; (x<limitLow) ? limitLow : x;

View file

@ -198,6 +198,11 @@ String SafeReader::readString_Token(unsigned char delim) {
} }
return ret; return ret;
} }
String SafeReader::readString_Token() {
return readString_Token(' ');
}
bool SafeReader::isEOF() { bool SafeReader::isEOF() {
return curSeek >= len; return curSeek >= len;

View file

@ -67,7 +67,8 @@ class SafeReader {
String readString(); String readString();
String readString(size_t len); String readString(size_t len);
String readString_Line(); String readString_Line();
String readString_Token(unsigned char delim=' '); String readString_Token(unsigned char delim);
String readString_Token();
bool isEOF(); bool isEOF();
SafeReader(void* b, size_t l): SafeReader(void* b, size_t l):