(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.
| ... | ... |
@@ -13,12 +13,12 @@ |
| 13 | 13 |
#include "SBNK.h" |
| 14 | 14 |
#include "common.h" |
| 15 | 15 |
|
| 16 |
-SBNKInstrumentRange::SBNKInstrumentRange(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType) : lowNote(lowerNote), highNote(upperNote), |
|
| 16 |
+SBNKInstrument::SBNKInstrument(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType) : lowNote(lowerNote), highNote(upperNote), |
|
| 17 | 17 |
record(recordType), swav(0), swar(0), noteNumber(0), attackRate(0), decayRate(0), sustainLevel(0), releaseRate(0), pan(0) |
| 18 | 18 |
{
|
| 19 | 19 |
} |
| 20 | 20 |
|
| 21 |
-void SBNKInstrumentRange::Read(PseudoFile &file) |
|
| 21 |
+void SBNKInstrument::Read(PseudoFile &file) |
|
| 22 | 22 |
{
|
| 23 | 23 |
this->swav = file.ReadLE<std::uint16_t>(); |
| 24 | 24 |
this->swar = file.ReadLE<std::uint16_t>(); |
| ... | ... |
@@ -30,11 +30,11 @@ void SBNKInstrumentRange::Read(PseudoFile &file) |
| 30 | 30 |
this->pan = file.ReadLE<std::uint8_t>(); |
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 |
-SBNKInstrument::SBNKInstrument() : record(0), ranges() |
|
| 33 |
+SBNKInstrumentEntry::SBNKInstrumentEntry() : record(0), instruments() |
|
| 34 | 34 |
{
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
-void SBNKInstrument::Read(PseudoFile &file, std::uint32_t startOffset) |
|
| 37 |
+void SBNKInstrumentEntry::Read(PseudoFile &file, std::uint32_t startOffset) |
|
| 38 | 38 |
{
|
| 39 | 39 |
this->record = file.ReadLE<std::uint8_t>(); |
| 40 | 40 |
std::uint16_t offset = file.ReadLE<std::uint16_t>(); |
| ... | ... |
@@ -51,9 +51,9 @@ void SBNKInstrument::Read(PseudoFile &file, std::uint32_t startOffset) |
| 51 | 51 |
for (std::uint8_t i = 0; i < num; ++i) |
| 52 | 52 |
{
|
| 53 | 53 |
std::uint16_t thisRecord = file.ReadLE<std::uint16_t>(); |
| 54 |
- auto range = SBNKInstrumentRange(lowNote + i, lowNote + i, thisRecord); |
|
| 55 |
- range.Read(file); |
|
| 56 |
- this->ranges.push_back(range); |
|
| 54 |
+ auto instrument = SBNKInstrument(lowNote + i, lowNote + i, thisRecord); |
|
| 55 |
+ instrument.Read(file); |
|
| 56 |
+ this->instruments.push_back(instrument); |
|
| 57 | 57 |
} |
| 58 | 58 |
} |
| 59 | 59 |
else if (this->record == 17) |
| ... | ... |
@@ -66,23 +66,23 @@ void SBNKInstrument::Read(PseudoFile &file, std::uint32_t startOffset) |
| 66 | 66 |
std::uint16_t thisRecord = file.ReadLE<std::uint16_t>(); |
| 67 | 67 |
std::uint8_t lowNote = i ? thisRanges[i - 1] + 1 : 0; |
| 68 | 68 |
std::uint8_t highNote = thisRanges[i]; |
| 69 |
- auto range = SBNKInstrumentRange(lowNote, highNote, thisRecord); |
|
| 70 |
- range.Read(file); |
|
| 71 |
- this->ranges.push_back(range); |
|
| 69 |
+ auto instrument = SBNKInstrument(lowNote, highNote, thisRecord); |
|
| 70 |
+ instrument.Read(file); |
|
| 71 |
+ this->instruments.push_back(instrument); |
|
| 72 | 72 |
++i; |
| 73 | 73 |
} |
| 74 | 74 |
} |
| 75 | 75 |
else |
| 76 | 76 |
{
|
| 77 |
- auto range = SBNKInstrumentRange(0, 127, this->record); |
|
| 78 |
- range.Read(file); |
|
| 79 |
- this->ranges.push_back(range); |
|
| 77 |
+ auto instrument = SBNKInstrument(0, 127, this->record); |
|
| 78 |
+ instrument.Read(file); |
|
| 79 |
+ this->instruments.push_back(instrument); |
|
| 80 | 80 |
} |
| 81 | 81 |
} |
| 82 | 82 |
file.pos = endOfInst; |
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 |
-SBNK::SBNK(const std::string &fn) : filename(fn), instruments(), info() |
|
| 85 |
+SBNK::SBNK(const std::string &fn) : filename(fn), entries(), info() |
|
| 86 | 86 |
{
|
| 87 | 87 |
std::fill_n(&this->waveArc[0], 4, nullptr); |
| 88 | 88 |
} |
| ... | ... |
@@ -101,7 +101,7 @@ void SBNK::Read(PseudoFile &file) |
| 101 | 101 |
std::uint32_t reserved[8]; |
| 102 | 102 |
file.ReadLE(reserved); |
| 103 | 103 |
std::uint32_t count = file.ReadLE<std::uint32_t>(); |
| 104 |
- this->instruments.resize(count); |
|
| 104 |
+ this->entries.resize(count); |
|
| 105 | 105 |
for (std::uint32_t i = 0; i < count; ++i) |
| 106 |
- this->instruments[i].Read(file, startOfSBNK); |
|
| 106 |
+ this->entries[i].Read(file, startOfSBNK); |
|
| 107 | 107 |
} |
| ... | ... |
@@ -16,7 +16,7 @@ |
| 16 | 16 |
struct PseudoFile; |
| 17 | 17 |
struct SWAR; |
| 18 | 18 |
|
| 19 |
-struct SBNKInstrumentRange |
|
| 19 |
+struct SBNKInstrument |
|
| 20 | 20 |
{
|
| 21 | 21 |
std::uint8_t lowNote; |
| 22 | 22 |
std::uint8_t highNote; |
| ... | ... |
@@ -30,17 +30,17 @@ struct SBNKInstrumentRange |
| 30 | 30 |
std::uint8_t releaseRate; |
| 31 | 31 |
std::uint8_t pan; |
| 32 | 32 |
|
| 33 |
- SBNKInstrumentRange(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType); |
|
| 33 |
+ SBNKInstrument(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType); |
|
| 34 | 34 |
|
| 35 | 35 |
void Read(PseudoFile &file); |
| 36 | 36 |
}; |
| 37 | 37 |
|
| 38 |
-struct SBNKInstrument |
|
| 38 |
+struct SBNKInstrumentEntry |
|
| 39 | 39 |
{
|
| 40 | 40 |
std::uint8_t record; |
| 41 |
- std::vector<SBNKInstrumentRange> ranges; |
|
| 41 |
+ std::vector<SBNKInstrument> instruments; |
|
| 42 | 42 |
|
| 43 |
- SBNKInstrument(); |
|
| 43 |
+ SBNKInstrumentEntry(); |
|
| 44 | 44 |
|
| 45 | 45 |
void Read(PseudoFile &file, std::uint32_t startOffset); |
| 46 | 46 |
}; |
| ... | ... |
@@ -48,7 +48,7 @@ struct SBNKInstrument |
| 48 | 48 |
struct SBNK |
| 49 | 49 |
{
|
| 50 | 50 |
std::string filename; |
| 51 |
- std::vector<SBNKInstrument> instruments; |
|
| 51 |
+ std::vector<SBNKInstrumentEntry> entries; |
|
| 52 | 52 |
|
| 53 | 53 |
const SWAR *waveArc[4]; |
| 54 | 54 |
INFOEntryBANK info; |
| ... | ... |
@@ -109,35 +109,35 @@ int Track::NoteOn(int key, int vel, int len) |
| 109 | 109 |
{
|
| 110 | 110 |
auto sbnk = this->ply->sseq->bank; |
| 111 | 111 |
|
| 112 |
- if (this->patch >= sbnk->instruments.size()) |
|
| 112 |
+ if (this->patch >= sbnk->entries.size()) |
|
| 113 | 113 |
return -1; |
| 114 | 114 |
|
| 115 | 115 |
bool bIsPCM = true; |
| 116 | 116 |
Channel *chn = nullptr; |
| 117 | 117 |
int nCh = -1; |
| 118 | 118 |
|
| 119 |
- auto &instrument = sbnk->instruments[this->patch]; |
|
| 120 |
- const SBNKInstrumentRange *noteDef = nullptr; |
|
| 121 |
- int fRecord = instrument.record; |
|
| 119 |
+ auto &entry = sbnk->entries[this->patch]; |
|
| 120 |
+ const SBNKInstrument *noteDef = nullptr; |
|
| 121 |
+ int fRecord = entry.record; |
|
| 122 | 122 |
|
| 123 | 123 |
if (fRecord == 16) |
| 124 | 124 |
{
|
| 125 |
- if (!(instrument.ranges[0].lowNote <= key && key <= instrument.ranges[instrument.ranges.size() - 1].highNote)) |
|
| 125 |
+ if (!(entry.instruments[0].lowNote <= key && key <= entry.instruments[entry.instruments.size() - 1].highNote)) |
|
| 126 | 126 |
return -1; |
| 127 |
- int rn = key - instrument.ranges[0].lowNote; |
|
| 128 |
- noteDef = &instrument.ranges[rn]; |
|
| 127 |
+ int rn = key - entry.instruments[0].lowNote; |
|
| 128 |
+ noteDef = &entry.instruments[rn]; |
|
| 129 | 129 |
fRecord = noteDef->record; |
| 130 | 130 |
} |
| 131 | 131 |
else if (fRecord == 17) |
| 132 | 132 |
{
|
| 133 |
- std::size_t reg, ranges; |
|
| 134 |
- for (reg = 0, ranges = instrument.ranges.size(); reg < ranges; ++reg) |
|
| 135 |
- if (key <= instrument.ranges[reg].highNote) |
|
| 133 |
+ std::size_t reg, entries; |
|
| 134 |
+ for (reg = 0, entries = entry.instruments.size(); reg < entries; ++reg) |
|
| 135 |
+ if (key <= entry.instruments[reg].highNote) |
|
| 136 | 136 |
break; |
| 137 |
- if (reg == ranges) |
|
| 137 |
+ if (reg == entries) |
|
| 138 | 138 |
return -1; |
| 139 | 139 |
|
| 140 |
- noteDef = &instrument.ranges[reg]; |
|
| 140 |
+ noteDef = &entry.instruments[reg]; |
|
| 141 | 141 |
fRecord = noteDef->record; |
| 142 | 142 |
} |
| 143 | 143 |
|
| ... | ... |
@@ -146,7 +146,7 @@ int Track::NoteOn(int key, int vel, int len) |
| 146 | 146 |
else if (fRecord == 1) |
| 147 | 147 |
{
|
| 148 | 148 |
if (!noteDef) |
| 149 |
- noteDef = &instrument.ranges[0]; |
|
| 149 |
+ noteDef = &entry.instruments[0]; |
|
| 150 | 150 |
} |
| 151 | 151 |
else if (fRecord < 4) |
| 152 | 152 |
{
|
| ... | ... |
@@ -155,7 +155,7 @@ int Track::NoteOn(int key, int vel, int len) |
| 155 | 155 |
// fRecord = 3 -> PSG noise |
| 156 | 156 |
bIsPCM = false; |
| 157 | 157 |
if (!noteDef) |
| 158 |
- noteDef = &instrument.ranges[0]; |
|
| 158 |
+ noteDef = &entry.instruments[0]; |
|
| 159 | 159 |
if (fRecord == 3) |
| 160 | 160 |
{
|
| 161 | 161 |
nCh = this->ply->ChannelAlloc(ChannelAllocateType::Noise, this->prio); |