Rename SBNKInstrument(Range) to SBNKInstrument(Entry).
(SBNKInstrument -> SBNKInstrumentEntry and SBNKIntrumentRange -> SBNKInstrument)
The old names didn't really make much sense when I started porting the creation tools code to C#, so might as well fix them here too.
--- a/src/in_ncsf/SSEQPlayer/SBNK.cpp
+++ b/src/in_ncsf/SSEQPlayer/SBNK.cpp
@@ -13,12 +13,12 @@
#include "SBNK.h"
#include "common.h"
-SBNKInstrumentRange::SBNKInstrumentRange(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType) : lowNote(lowerNote), highNote(upperNote),
+SBNKInstrument::SBNKInstrument(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType) : lowNote(lowerNote), highNote(upperNote),
record(recordType), swav(0), swar(0), noteNumber(0), attackRate(0), decayRate(0), sustainLevel(0), releaseRate(0), pan(0)
{
}
-void SBNKInstrumentRange::Read(PseudoFile &file)
+void SBNKInstrument::Read(PseudoFile &file)
{
this->swav = file.ReadLE<std::uint16_t>();
this->swar = file.ReadLE<std::uint16_t>();
@@ -30,11 +30,11 @@
this->pan = file.ReadLE<std::uint8_t>();
}
-SBNKInstrument::SBNKInstrument() : record(0), ranges()
+SBNKInstrumentEntry::SBNKInstrumentEntry() : record(0), instruments()
{
}
-void SBNKInstrument::Read(PseudoFile &file, std::uint32_t startOffset)
+void SBNKInstrumentEntry::Read(PseudoFile &file, std::uint32_t startOffset)
{
this->record = file.ReadLE<std::uint8_t>();
std::uint16_t offset = file.ReadLE<std::uint16_t>();
@@ -51,9 +51,9 @@
for (std::uint8_t i = 0; i < num; ++i)
{
std::uint16_t thisRecord = file.ReadLE<std::uint16_t>();
- auto range = SBNKInstrumentRange(lowNote + i, lowNote + i, thisRecord);
- range.Read(file);
- this->ranges.push_back(range);
+ auto instrument = SBNKInstrument(lowNote + i, lowNote + i, thisRecord);
+ instrument.Read(file);
+ this->instruments.push_back(instrument);
}
}
else if (this->record == 17)
@@ -66,23 +66,23 @@
std::uint16_t thisRecord = file.ReadLE<std::uint16_t>();
std::uint8_t lowNote = i ? thisRanges[i - 1] + 1 : 0;
std::uint8_t highNote = thisRanges[i];
- auto range = SBNKInstrumentRange(lowNote, highNote, thisRecord);
- range.Read(file);
- this->ranges.push_back(range);
+ auto instrument = SBNKInstrument(lowNote, highNote, thisRecord);
+ instrument.Read(file);
+ this->instruments.push_back(instrument);
++i;
}
}
else
{
- auto range = SBNKInstrumentRange(0, 127, this->record);
- range.Read(file);
- this->ranges.push_back(range);
+ auto instrument = SBNKInstrument(0, 127, this->record);
+ instrument.Read(file);
+ this->instruments.push_back(instrument);
}
}
file.pos = endOfInst;
}
-SBNK::SBNK(const std::string &fn) : filename(fn), instruments(), info()
+SBNK::SBNK(const std::string &fn) : filename(fn), entries(), info()
{
std::fill_n(&this->waveArc[0], 4, nullptr);
}
@@ -101,8 +101,8 @@
std::uint32_t reserved[8];
file.ReadLE(reserved);
std::uint32_t count = file.ReadLE<std::uint32_t>();
- this->instruments.resize(count);
+ this->entries.resize(count);
for (std::uint32_t i = 0; i < count; ++i)
- this->instruments[i].Read(file, startOfSBNK);
+ this->entries[i].Read(file, startOfSBNK);
}
--- a/src/in_ncsf/SSEQPlayer/SBNK.h
+++ b/src/in_ncsf/SSEQPlayer/SBNK.h
@@ -16,7 +16,7 @@
struct PseudoFile;
struct SWAR;
-struct SBNKInstrumentRange
+struct SBNKInstrument
{
std::uint8_t lowNote;
std::uint8_t highNote;
@@ -30,17 +30,17 @@
std::uint8_t releaseRate;
std::uint8_t pan;
- SBNKInstrumentRange(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType);
+ SBNKInstrument(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType);
void Read(PseudoFile &file);
};
-struct SBNKInstrument
+struct SBNKInstrumentEntry
{
std::uint8_t record;
- std::vector<SBNKInstrumentRange> ranges;
+ std::vector<SBNKInstrument> instruments;
- SBNKInstrument();
+ SBNKInstrumentEntry();
void Read(PseudoFile &file, std::uint32_t startOffset);
};
@@ -48,7 +48,7 @@
struct SBNK
{
std::string filename;
- std::vector<SBNKInstrument> instruments;
+ std::vector<SBNKInstrumentEntry> entries;
const SWAR *waveArc[4];
INFOEntryBANK info;
--- a/src/in_ncsf/SSEQPlayer/Track.cpp
+++ b/src/in_ncsf/SSEQPlayer/Track.cpp
@@ -109,35 +109,35 @@
{
auto sbnk = this->ply->sseq->bank;
- if (this->patch >= sbnk->instruments.size())
+ if (this->patch >= sbnk->entries.size())
return -1;
bool bIsPCM = true;
Channel *chn = nullptr;
int nCh = -1;
- auto &instrument = sbnk->instruments[this->patch];
- const SBNKInstrumentRange *noteDef = nullptr;
- int fRecord = instrument.record;
+ auto &entry = sbnk->entries[this->patch];
+ const SBNKInstrument *noteDef = nullptr;
+ int fRecord = entry.record;
if (fRecord == 16)
{
- if (!(instrument.ranges[0].lowNote <= key && key <= instrument.ranges[instrument.ranges.size() - 1].highNote))
+ if (!(entry.instruments[0].lowNote <= key && key <= entry.instruments[entry.instruments.size() - 1].highNote))
return -1;
- int rn = key - instrument.ranges[0].lowNote;
- noteDef = &instrument.ranges[rn];
+ int rn = key - entry.instruments[0].lowNote;
+ noteDef = &entry.instruments[rn];
fRecord = noteDef->record;
}
else if (fRecord == 17)
{
- std::size_t reg, ranges;
- for (reg = 0, ranges = instrument.ranges.size(); reg < ranges; ++reg)
- if (key <= instrument.ranges[reg].highNote)
+ std::size_t reg, entries;
+ for (reg = 0, entries = entry.instruments.size(); reg < entries; ++reg)
+ if (key <= entry.instruments[reg].highNote)
break;
- if (reg == ranges)
+ if (reg == entries)
return -1;
- noteDef = &instrument.ranges[reg];
+ noteDef = &entry.instruments[reg];
fRecord = noteDef->record;
}
@@ -146,7 +146,7 @@
else if (fRecord == 1)
{
if (!noteDef)
- noteDef = &instrument.ranges[0];
+ noteDef = &entry.instruments[0];
}
else if (fRecord < 4)
{
@@ -155,7 +155,7 @@
// fRecord = 3 -> PSG noise
bIsPCM = false;
if (!noteDef)
- noteDef = &instrument.ranges[0];
+ noteDef = &entry.instruments[0];
if (fRecord == 3)
{
nCh = this->ply->ChannelAlloc(ChannelAllocateType::Noise, this->prio);