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

Method GetFreeSequenceIndex

Source/InstrumentManager.cpp:175–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175int CInstrumentManager::GetFreeSequenceIndex(inst_type_t InstType, sequence_t Type, const CSeqInstrument *pInst) const
176{
177 // moved from CFamiTrackerDoc
178 std::vector<bool> Used(CSequenceCollection::MAX_SEQUENCES, false);
179 for (int i = 0; i < MAX_INSTRUMENTS; ++i) if (GetInstrumentType(i) == InstType) { // // //
180 auto pInstrument = std::static_pointer_cast<CSeqInstrument>(GetInstrument(i));
181 if (pInstrument->GetSeqEnable(Type) && ((pInst && pInst->GetSequence(Type)->GetItemCount()) || pInst != pInstrument.get()))
182 Used[pInstrument->GetSeqIndex(Type)] = true;
183 }
184 for (int i = 0; i < CSequenceCollection::MAX_SEQUENCES; ++i)
185 if (!Used[i])
186 if (auto pSeq = GetSequence(InstType, Type, i); !pSeq || !pSeq->GetItemCount())
187 return i;
188 return -1;
189}
190
191int CInstrumentManager::GetSequenceCount(inst_type_t InstType, sequence_t Type) const {
192 int Count = 0;

Callers 2

OnTrackerRecordToInstMethod · 0.80
InitRecordInstrumentMethod · 0.80

Calls 5

GetSeqEnableMethod · 0.45
GetItemCountMethod · 0.45
GetSequenceMethod · 0.45
getMethod · 0.45
GetSeqIndexMethod · 0.45

Tested by

no test coverage detected