MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / LoadSequencesN163

Method LoadSequencesN163

Source/FamiTrackerDocIO.cpp:1146–1179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1144}
1145
1146void CFamiTrackerDocIO::LoadSequencesN163(CFamiTrackerModule &modfile, int ver) {
1147 unsigned int Count = AssertRange(file_.GetBlockInt(), 0, MAX_SEQUENCES * (int)SEQ_COUNT, "N163 sequence count");
1148 AssertRange<MODULE_ERROR_OFFICIAL>(Count, 0U, static_cast<unsigned>(MAX_SEQUENCES * SEQ_COUNT - 1), "N163 sequence count"); // // //
1149
1150 CSequenceManager *pManager = modfile.GetInstrumentManager()->GetSequenceManager(INST_N163); // // //
1151
1152 for (unsigned int i = 0; i < Count; ++i) {
1153 unsigned int Index = AssertRange(file_.GetBlockInt(), 0, MAX_SEQUENCES - 1, "Sequence index");
1154 unsigned int Type = AssertRange(file_.GetBlockInt(), 0, (int)SEQ_COUNT - 1, "Sequence type");
1155 try {
1156 unsigned char SeqCount = file_.GetBlockChar();
1157 auto pSeq = pManager->GetCollection(static_cast<sequence_t>(Type))->GetSequence(Index);
1158 pSeq->Clear();
1159 pSeq->SetItemCount(SeqCount < MAX_SEQUENCE_ITEMS ? SeqCount : MAX_SEQUENCE_ITEMS);
1160
1161 pSeq->SetLoopPoint(AssertRange<MODULE_ERROR_STRICT>(
1162 file_.GetBlockInt(), -1, static_cast<int>(SeqCount) - 1, "Sequence loop point"));
1163 pSeq->SetReleasePoint(AssertRange<MODULE_ERROR_STRICT>(
1164 file_.GetBlockInt(), -1, static_cast<int>(SeqCount) - 1, "Sequence release point"));
1165 pSeq->SetSetting(static_cast<seq_setting_t>(file_.GetBlockInt())); // // //
1166
1167 // AssertRange(SeqCount, 0, MAX_SEQUENCE_ITEMS, "Sequence item count");
1168 for (int j = 0; j < SeqCount; ++j) {
1169 char Value = file_.GetBlockChar();
1170 if (j < MAX_SEQUENCE_ITEMS) // // //
1171 pSeq->SetItem(j, Value);
1172 }
1173 }
1174 catch (CModuleException &e) {
1175 e.AppendError("At N163 " + std::string {CInstrumentN163::SEQUENCE_NAME[Type]} + " sequence " + conv::from_int(Index) + ',');
1176 throw e;
1177 }
1178 }
1179}
1180
1181void CFamiTrackerDocIO::SaveSequencesN163(const CFamiTrackerModule &modfile, int ver) {
1182 /*

Callers

nothing calls this directly

Calls 14

from_intFunction · 0.85
GetBlockIntMethod · 0.80
GetBlockCharMethod · 0.80
GetCollectionMethod · 0.80
SetItemCountMethod · 0.80
SetLoopPointMethod · 0.80
SetReleasePointMethod · 0.80
SetSettingMethod · 0.80
SetItemMethod · 0.80
AppendErrorMethod · 0.80
GetSequenceManagerMethod · 0.45
GetInstrumentManagerMethod · 0.45

Tested by

no test coverage detected