| 173 | } |
| 174 | |
| 175 | int 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 | |
| 191 | int CInstrumentManager::GetSequenceCount(inst_type_t InstType, sequence_t Type) const { |
| 192 | int Count = 0; |
no test coverage detected