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

Function ClonePatterns

Source/FrameAction.cpp:48–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46};
47
48void ClonePatterns(const CFrameSelection &Sel, CSongView &view) { // // //
49 std::unordered_map<std::pair<int, int>, int, pairhash> NewPatterns;
50
51 CSongData &song = view.GetSong();
52
53 for (auto [b, e] = CFrameIterator::FromSelection(Sel, view); b != e; ++b) {
54 for (int c = b.m_iChannel; c < e.m_iChannel; ++c) {
55 int OldPattern = b.Get(c);
56 auto Index = std::make_pair(c, OldPattern);
57 stChannelID ch = view.GetChannelOrder().TranslateChannel(c);
58 if (auto p = NewPatterns.find(Index); p == NewPatterns.end()) { // // // share common patterns
59 NewPatterns[Index] = song.GetFreePatternIndex(ch);
60 song.GetPattern(ch, NewPatterns[Index]) = song.GetPattern(ch, OldPattern);
61 }
62 b.Set(c, NewPatterns[Index]);
63 }
64 }
65}
66
67} // namespace
68

Callers 1

RedoMethod · 0.85

Calls 7

GetSongMethod · 0.80
GetMethod · 0.80
GetFreePatternIndexMethod · 0.80
GetPatternMethod · 0.80
TranslateChannelMethod · 0.45
endMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected