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

Method DeepCloneInstrument

Source/InstrumentManager.cpp:116–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116bool CInstrumentManager::DeepCloneInstrument(unsigned OldIndex, unsigned NewIndex) { // // //
117 if (CloneInstrument(OldIndex, NewIndex)) {
118 if (auto pInstrument = std::dynamic_pointer_cast<CSeqInstrument>(GetInstrument(NewIndex))) {
119 const inst_type_t it = pInstrument->GetType();
120 for (auto i : enum_values<sequence_t>()) {
121 int freeSeq = GetFreeSequenceIndex(it, i, pInstrument.get());
122 if (freeSeq != -1) {
123 if (pInstrument->GetSeqEnable(i))
124 *GetSequence(it, i, unsigned(freeSeq)) = *pInstrument->GetSequence(i); // // //
125 pInstrument->SetSeqIndex(i, freeSeq);
126 }
127 }
128 }
129 return true;
130 }
131
132 return false;
133}
134
135void CInstrumentManager::SwapInstruments(unsigned int IndexA, unsigned int IndexB) {
136 std::lock_guard<std::mutex> lock(m_InstrumentLock);

Callers 1

OnDeepCloneInstrumentMethod · 0.80

Calls 5

GetTypeMethod · 0.45
getMethod · 0.45
GetSeqEnableMethod · 0.45
GetSequenceMethod · 0.45
SetSeqIndexMethod · 0.45

Tested by

no test coverage detected