(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 |
} |
* Use enum class instead of enum (except for the enums for the resource IDs, not really necessary there).
* For NCSF specifically, included a function to convert an enum class to its underlying integral type (as this is needed for use with the std::bitset class).
* Cleanup headers so all the ones needed in a file are explicitly included even if they may possibly be included in another header.
* Used forward declarations in a few spots.
* Explicitly namespaced all (u)int*_t uses (this might seem like overkill, but it helps me see when the standard types are being used with a simple search for std::).
* Made sure it all builds with MinGW-w64 as well (both gcc and clang).
* Removed some std::move from DialogBuilder.cpp based on clang's warnings for that.
* Replaced use of std::copy_n on strings in DialogBuilder.cpp with my CopyToString functions that use wcscpy.
* Replaced CHAR_MIN/CHAR_MAX in eqstr.h and ltstr.h with std::numeric_limits<char>::min/max().
| ... | ... |
@@ -6,48 +6,51 @@ |
| 6 | 6 |
* http://www.feshrine.net/hacking/doc/nds-sdat.html |
| 7 | 7 |
*/ |
| 8 | 8 |
|
| 9 |
+#include <algorithm> |
|
| 9 | 10 |
#include <stdexcept> |
| 10 |
-#include "SBNK.h" |
|
| 11 |
+#include <cstdint> |
|
| 11 | 12 |
#include "NDSStdHeader.h" |
| 13 |
+#include "SBNK.h" |
|
| 14 |
+#include "common.h" |
|
| 12 | 15 |
|
| 13 |
-SBNKInstrumentRange::SBNKInstrumentRange(uint8_t lowerNote, uint8_t upperNote, int recordType) : lowNote(lowerNote), highNote(upperNote), |
|
| 16 |
+SBNKInstrumentRange::SBNKInstrumentRange(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType) : lowNote(lowerNote), highNote(upperNote), |
|
| 14 | 17 |
record(recordType), swav(0), swar(0), noteNumber(0), attackRate(0), decayRate(0), sustainLevel(0), releaseRate(0), pan(0) |
| 15 | 18 |
{
|
| 16 | 19 |
} |
| 17 | 20 |
|
| 18 | 21 |
void SBNKInstrumentRange::Read(PseudoFile &file) |
| 19 | 22 |
{
|
| 20 |
- this->swav = file.ReadLE<uint16_t>(); |
|
| 21 |
- this->swar = file.ReadLE<uint16_t>(); |
|
| 22 |
- this->noteNumber = file.ReadLE<uint8_t>(); |
|
| 23 |
- this->attackRate = file.ReadLE<uint8_t>(); |
|
| 24 |
- this->decayRate = file.ReadLE<uint8_t>(); |
|
| 25 |
- this->sustainLevel = file.ReadLE<uint8_t>(); |
|
| 26 |
- this->releaseRate = file.ReadLE<uint8_t>(); |
|
| 27 |
- this->pan = file.ReadLE<uint8_t>(); |
|
| 23 |
+ this->swav = file.ReadLE<std::uint16_t>(); |
|
| 24 |
+ this->swar = file.ReadLE<std::uint16_t>(); |
|
| 25 |
+ this->noteNumber = file.ReadLE<std::uint8_t>(); |
|
| 26 |
+ this->attackRate = file.ReadLE<std::uint8_t>(); |
|
| 27 |
+ this->decayRate = file.ReadLE<std::uint8_t>(); |
|
| 28 |
+ this->sustainLevel = file.ReadLE<std::uint8_t>(); |
|
| 29 |
+ this->releaseRate = file.ReadLE<std::uint8_t>(); |
|
| 30 |
+ this->pan = file.ReadLE<std::uint8_t>(); |
|
| 28 | 31 |
} |
| 29 | 32 |
|
| 30 | 33 |
SBNKInstrument::SBNKInstrument() : record(0), ranges() |
| 31 | 34 |
{
|
| 32 | 35 |
} |
| 33 | 36 |
|
| 34 |
-void SBNKInstrument::Read(PseudoFile &file, uint32_t startOffset) |
|
| 37 |
+void SBNKInstrument::Read(PseudoFile &file, std::uint32_t startOffset) |
|
| 35 | 38 |
{
|
| 36 |
- this->record = file.ReadLE<uint8_t>(); |
|
| 37 |
- uint16_t offset = file.ReadLE<uint16_t>(); |
|
| 38 |
- file.ReadLE<uint8_t>(); |
|
| 39 |
- uint32_t endOfInst = file.pos; |
|
| 39 |
+ this->record = file.ReadLE<std::uint8_t>(); |
|
| 40 |
+ std::uint16_t offset = file.ReadLE<std::uint16_t>(); |
|
| 41 |
+ file.ReadLE<std::uint8_t>(); |
|
| 42 |
+ std::uint32_t endOfInst = file.pos; |
|
| 40 | 43 |
file.pos = startOffset + offset; |
| 41 | 44 |
if (this->record) |
| 42 | 45 |
{
|
| 43 | 46 |
if (this->record == 16) |
| 44 | 47 |
{
|
| 45 |
- uint8_t lowNote = file.ReadLE<uint8_t>(); |
|
| 46 |
- uint8_t highNote = file.ReadLE<uint8_t>(); |
|
| 47 |
- uint8_t num = highNote - lowNote + 1; |
|
| 48 |
- for (uint8_t i = 0; i < num; ++i) |
|
| 48 |
+ std::uint8_t lowNote = file.ReadLE<std::uint8_t>(); |
|
| 49 |
+ std::uint8_t highNote = file.ReadLE<std::uint8_t>(); |
|
| 50 |
+ std::uint8_t num = highNote - lowNote + 1; |
|
| 51 |
+ for (std::uint8_t i = 0; i < num; ++i) |
|
| 49 | 52 |
{
|
| 50 |
- uint16_t thisRecord = file.ReadLE<uint16_t>(); |
|
| 53 |
+ std::uint16_t thisRecord = file.ReadLE<std::uint16_t>(); |
|
| 51 | 54 |
auto range = SBNKInstrumentRange(lowNote + i, lowNote + i, thisRecord); |
| 52 | 55 |
range.Read(file); |
| 53 | 56 |
this->ranges.push_back(range); |
| ... | ... |
@@ -55,14 +58,14 @@ void SBNKInstrument::Read(PseudoFile &file, uint32_t startOffset) |
| 55 | 58 |
} |
| 56 | 59 |
else if (this->record == 17) |
| 57 | 60 |
{
|
| 58 |
- uint8_t thisRanges[8]; |
|
| 61 |
+ std::uint8_t thisRanges[8]; |
|
| 59 | 62 |
file.ReadLE(thisRanges); |
| 60 |
- uint8_t i = 0; |
|
| 63 |
+ std::uint8_t i = 0; |
|
| 61 | 64 |
while (i < 8 && thisRanges[i]) |
| 62 | 65 |
{
|
| 63 |
- uint16_t thisRecord = file.ReadLE<uint16_t>(); |
|
| 64 |
- uint8_t lowNote = i ? thisRanges[i - 1] + 1 : 0; |
|
| 65 |
- uint8_t highNote = thisRanges[i]; |
|
| 66 |
+ std::uint16_t thisRecord = file.ReadLE<std::uint16_t>(); |
|
| 67 |
+ std::uint8_t lowNote = i ? thisRanges[i - 1] + 1 : 0; |
|
| 68 |
+ std::uint8_t highNote = thisRanges[i]; |
|
| 66 | 69 |
auto range = SBNKInstrumentRange(lowNote, highNote, thisRecord); |
| 67 | 70 |
range.Read(file); |
| 68 | 71 |
this->ranges.push_back(range); |
| ... | ... |
@@ -86,19 +89,19 @@ SBNK::SBNK(const std::string &fn) : filename(fn), instruments(), info() |
| 86 | 89 |
|
| 87 | 90 |
void SBNK::Read(PseudoFile &file) |
| 88 | 91 |
{
|
| 89 |
- uint32_t startOfSBNK = file.pos; |
|
| 92 |
+ std::uint32_t startOfSBNK = file.pos; |
|
| 90 | 93 |
NDSStdHeader header; |
| 91 | 94 |
header.Read(file); |
| 92 | 95 |
header.Verify("SBNK", 0x0100FEFF);
|
| 93 |
- int8_t type[4]; |
|
| 96 |
+ std::int8_t type[4]; |
|
| 94 | 97 |
file.ReadLE(type); |
| 95 | 98 |
if (!VerifyHeader(type, "DATA")) |
| 96 | 99 |
throw std::runtime_error("SBNK DATA structure invalid");
|
| 97 |
- file.ReadLE<uint32_t>(); // size |
|
| 98 |
- uint32_t reserved[8]; |
|
| 100 |
+ file.ReadLE<std::uint32_t>(); // size |
|
| 101 |
+ std::uint32_t reserved[8]; |
|
| 99 | 102 |
file.ReadLE(reserved); |
| 100 |
- uint32_t count = file.ReadLE<uint32_t>(); |
|
| 103 |
+ std::uint32_t count = file.ReadLE<std::uint32_t>(); |
|
| 101 | 104 |
this->instruments.resize(count); |
| 102 |
- for (uint32_t i = 0; i < count; ++i) |
|
| 105 |
+ for (std::uint32_t i = 0; i < count; ++i) |
|
| 103 | 106 |
this->instruments[i].Read(file, startOfSBNK); |
| 104 | 107 |
} |
| ... | ... |
@@ -81,7 +81,7 @@ void SBNKInstrument::Read(PseudoFile &file, uint32_t startOffset) |
| 81 | 81 |
|
| 82 | 82 |
SBNK::SBNK(const std::string &fn) : filename(fn), instruments(), info() |
| 83 | 83 |
{
|
| 84 |
- memset(this->waveArc, 0, sizeof(this->waveArc)); |
|
| 84 |
+ std::fill_n(&this->waveArc[0], 4, nullptr); |
|
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 | 87 |
void SBNK::Read(PseudoFile &file) |
(They were probably holdovers from copying the code from the NCSF creation tools.)
| ... | ... |
@@ -84,24 +84,6 @@ SBNK::SBNK(const std::string &fn) : filename(fn), instruments(), info() |
| 84 | 84 |
memset(this->waveArc, 0, sizeof(this->waveArc)); |
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 |
-SBNK::SBNK(const SBNK &sbnk) : filename(sbnk.filename), instruments(sbnk.instruments), info(sbnk.info) |
|
| 88 |
-{
|
|
| 89 |
- memcpy(this->waveArc, sbnk.waveArc, sizeof(this->waveArc)); |
|
| 90 |
-} |
|
| 91 |
- |
|
| 92 |
-SBNK &SBNK::operator=(const SBNK &sbnk) |
|
| 93 |
-{
|
|
| 94 |
- if (this != &sbnk) |
|
| 95 |
- {
|
|
| 96 |
- this->filename = sbnk.filename; |
|
| 97 |
- this->instruments = sbnk.instruments; |
|
| 98 |
- |
|
| 99 |
- memcpy(this->waveArc, sbnk.waveArc, sizeof(this->waveArc)); |
|
| 100 |
- this->info = sbnk.info; |
|
| 101 |
- } |
|
| 102 |
- return *this; |
|
| 103 |
-} |
|
| 104 |
- |
|
| 105 | 87 |
void SBNK::Read(PseudoFile &file) |
| 106 | 88 |
{
|
| 107 | 89 |
uint32_t startOfSBNK = file.pos; |
(I never remember to update these and besides, GitHub history can show when they were last modified.)
| ... | ... |
@@ -1,7 +1,6 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - SDAT SBNK (Sound Bank) structures |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-03-25 |
|
| 5 | 4 |
* |
| 6 | 5 |
* Nintendo DS Nitro Composer (SDAT) Specification document found at |
| 7 | 6 |
* http://www.feshrine.net/hacking/doc/nds-sdat.html |
(It probably never triggered any errors in the past because of it being implicitly included by some other header file.)
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,122 @@ |
| 1 |
+/* |
|
| 2 |
+ * SSEQ Player - SDAT SBNK (Sound Bank) structures |
|
| 3 |
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
|
| 4 |
+ * Last modification on 2013-03-25 |
|
| 5 |
+ * |
|
| 6 |
+ * Nintendo DS Nitro Composer (SDAT) Specification document found at |
|
| 7 |
+ * http://www.feshrine.net/hacking/doc/nds-sdat.html |
|
| 8 |
+ */ |
|
| 9 |
+ |
|
| 10 |
+#include "SBNK.h" |
|
| 11 |
+#include "NDSStdHeader.h" |
|
| 12 |
+ |
|
| 13 |
+SBNKInstrumentRange::SBNKInstrumentRange(uint8_t lowerNote, uint8_t upperNote, int recordType) : lowNote(lowerNote), highNote(upperNote), |
|
| 14 |
+ record(recordType), swav(0), swar(0), noteNumber(0), attackRate(0), decayRate(0), sustainLevel(0), releaseRate(0), pan(0) |
|
| 15 |
+{
|
|
| 16 |
+} |
|
| 17 |
+ |
|
| 18 |
+void SBNKInstrumentRange::Read(PseudoFile &file) |
|
| 19 |
+{
|
|
| 20 |
+ this->swav = file.ReadLE<uint16_t>(); |
|
| 21 |
+ this->swar = file.ReadLE<uint16_t>(); |
|
| 22 |
+ this->noteNumber = file.ReadLE<uint8_t>(); |
|
| 23 |
+ this->attackRate = file.ReadLE<uint8_t>(); |
|
| 24 |
+ this->decayRate = file.ReadLE<uint8_t>(); |
|
| 25 |
+ this->sustainLevel = file.ReadLE<uint8_t>(); |
|
| 26 |
+ this->releaseRate = file.ReadLE<uint8_t>(); |
|
| 27 |
+ this->pan = file.ReadLE<uint8_t>(); |
|
| 28 |
+} |
|
| 29 |
+ |
|
| 30 |
+SBNKInstrument::SBNKInstrument() : record(0), ranges() |
|
| 31 |
+{
|
|
| 32 |
+} |
|
| 33 |
+ |
|
| 34 |
+void SBNKInstrument::Read(PseudoFile &file, uint32_t startOffset) |
|
| 35 |
+{
|
|
| 36 |
+ this->record = file.ReadLE<uint8_t>(); |
|
| 37 |
+ uint16_t offset = file.ReadLE<uint16_t>(); |
|
| 38 |
+ file.ReadLE<uint8_t>(); |
|
| 39 |
+ uint32_t endOfInst = file.pos; |
|
| 40 |
+ file.pos = startOffset + offset; |
|
| 41 |
+ if (this->record) |
|
| 42 |
+ {
|
|
| 43 |
+ if (this->record == 16) |
|
| 44 |
+ {
|
|
| 45 |
+ uint8_t lowNote = file.ReadLE<uint8_t>(); |
|
| 46 |
+ uint8_t highNote = file.ReadLE<uint8_t>(); |
|
| 47 |
+ uint8_t num = highNote - lowNote + 1; |
|
| 48 |
+ for (uint8_t i = 0; i < num; ++i) |
|
| 49 |
+ {
|
|
| 50 |
+ uint16_t thisRecord = file.ReadLE<uint16_t>(); |
|
| 51 |
+ auto range = SBNKInstrumentRange(lowNote + i, lowNote + i, thisRecord); |
|
| 52 |
+ range.Read(file); |
|
| 53 |
+ this->ranges.push_back(range); |
|
| 54 |
+ } |
|
| 55 |
+ } |
|
| 56 |
+ else if (this->record == 17) |
|
| 57 |
+ {
|
|
| 58 |
+ uint8_t thisRanges[8]; |
|
| 59 |
+ file.ReadLE(thisRanges); |
|
| 60 |
+ uint8_t i = 0; |
|
| 61 |
+ while (i < 8 && thisRanges[i]) |
|
| 62 |
+ {
|
|
| 63 |
+ uint16_t thisRecord = file.ReadLE<uint16_t>(); |
|
| 64 |
+ uint8_t lowNote = i ? thisRanges[i - 1] + 1 : 0; |
|
| 65 |
+ uint8_t highNote = thisRanges[i]; |
|
| 66 |
+ auto range = SBNKInstrumentRange(lowNote, highNote, thisRecord); |
|
| 67 |
+ range.Read(file); |
|
| 68 |
+ this->ranges.push_back(range); |
|
| 69 |
+ ++i; |
|
| 70 |
+ } |
|
| 71 |
+ } |
|
| 72 |
+ else |
|
| 73 |
+ {
|
|
| 74 |
+ auto range = SBNKInstrumentRange(0, 127, this->record); |
|
| 75 |
+ range.Read(file); |
|
| 76 |
+ this->ranges.push_back(range); |
|
| 77 |
+ } |
|
| 78 |
+ } |
|
| 79 |
+ file.pos = endOfInst; |
|
| 80 |
+} |
|
| 81 |
+ |
|
| 82 |
+SBNK::SBNK(const std::string &fn) : filename(fn), instruments(), info() |
|
| 83 |
+{
|
|
| 84 |
+ memset(this->waveArc, 0, sizeof(this->waveArc)); |
|
| 85 |
+} |
|
| 86 |
+ |
|
| 87 |
+SBNK::SBNK(const SBNK &sbnk) : filename(sbnk.filename), instruments(sbnk.instruments), info(sbnk.info) |
|
| 88 |
+{
|
|
| 89 |
+ memcpy(this->waveArc, sbnk.waveArc, sizeof(this->waveArc)); |
|
| 90 |
+} |
|
| 91 |
+ |
|
| 92 |
+SBNK &SBNK::operator=(const SBNK &sbnk) |
|
| 93 |
+{
|
|
| 94 |
+ if (this != &sbnk) |
|
| 95 |
+ {
|
|
| 96 |
+ this->filename = sbnk.filename; |
|
| 97 |
+ this->instruments = sbnk.instruments; |
|
| 98 |
+ |
|
| 99 |
+ memcpy(this->waveArc, sbnk.waveArc, sizeof(this->waveArc)); |
|
| 100 |
+ this->info = sbnk.info; |
|
| 101 |
+ } |
|
| 102 |
+ return *this; |
|
| 103 |
+} |
|
| 104 |
+ |
|
| 105 |
+void SBNK::Read(PseudoFile &file) |
|
| 106 |
+{
|
|
| 107 |
+ uint32_t startOfSBNK = file.pos; |
|
| 108 |
+ NDSStdHeader header; |
|
| 109 |
+ header.Read(file); |
|
| 110 |
+ header.Verify("SBNK", 0x0100FEFF);
|
|
| 111 |
+ int8_t type[4]; |
|
| 112 |
+ file.ReadLE(type); |
|
| 113 |
+ if (!VerifyHeader(type, "DATA")) |
|
| 114 |
+ throw std::runtime_error("SBNK DATA structure invalid");
|
|
| 115 |
+ file.ReadLE<uint32_t>(); // size |
|
| 116 |
+ uint32_t reserved[8]; |
|
| 117 |
+ file.ReadLE(reserved); |
|
| 118 |
+ uint32_t count = file.ReadLE<uint32_t>(); |
|
| 119 |
+ this->instruments.resize(count); |
|
| 120 |
+ for (uint32_t i = 0; i < count; ++i) |
|
| 121 |
+ this->instruments[i].Read(file, startOfSBNK); |
|
| 122 |
+} |