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

Method PostLoad

Source/FamiTrackerDocIO.cpp:200–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void CFamiTrackerDocIO::PostLoad(CFamiTrackerModule &modfile) {
201 if (file_.GetFileVersion() <= 0x0201)
202 compat::ReorderSequences(modfile, std::move(m_vTmpSequences));
203
204 if (fds_adjust_arps_) {
205 if (modfile.HasExpansionChip(sound_chip_t::FDS)) {
206 modfile.VisitSongs([&] (CSongData &song) {
207 for (int p = 0; p < MAX_PATTERN; ++p)
208 for (int r = 0; r < MAX_PATTERN_LENGTH; ++r) {
209 stChanNote &Note = song.GetPatternData(fds_subindex_t::wave, p, r); // // //
210 if (is_note(Note.Note)) {
211 int Trsp = Note.ToMidiNote() + NOTE_RANGE * 2;
212 Trsp = Trsp >= NOTE_COUNT ? NOTE_COUNT - 1 : Trsp;
213 Note.Note = ft0cc::doc::pitch_from_midi(Trsp);
214 Note.Octave = ft0cc::doc::oct_from_midi(Trsp);
215 }
216 }
217 });
218 }
219 auto *pManager = modfile.GetInstrumentManager();
220 for (int i = 0; i < MAX_INSTRUMENTS; ++i) {
221 if (pManager->GetInstrumentType(i) == INST_FDS) {
222 auto pSeq = std::static_pointer_cast<CSeqInstrument>(pManager->GetInstrument(i))->GetSequence(sequence_t::Arpeggio);
223 if (pSeq != nullptr && pSeq->GetItemCount() > 0 && pSeq->GetSetting() == SETTING_ARP_FIXED)
224 for (unsigned int j = 0; j < pSeq->GetItemCount(); ++j) {
225 int Trsp = pSeq->GetItem(j) + NOTE_RANGE * 2;
226 pSeq->SetItem(j, Trsp >= NOTE_COUNT ? NOTE_COUNT - 1 : Trsp);
227 }
228 }
229 }
230 }
231}
232
233void CFamiTrackerDocIO::LoadParams(CFamiTrackerModule &modfile, int ver) {
234 auto &Song = *modfile.GetSong(0);

Callers

nothing calls this directly

Calls 15

is_noteFunction · 0.85
pitch_from_midiFunction · 0.85
oct_from_midiFunction · 0.85
GetFileVersionMethod · 0.80
VisitSongsMethod · 0.80
ToMidiNoteMethod · 0.80
GetInstrumentTypeMethod · 0.80
GetSettingMethod · 0.80
GetItemMethod · 0.80
SetItemMethod · 0.80
HasExpansionChipMethod · 0.45
GetInstrumentManagerMethod · 0.45

Tested by

no test coverage detected