add option to remove unused patterns
This commit is contained in:
parent
5aa9019ec2
commit
80a92b8b43
3 changed files with 27 additions and 0 deletions
|
|
@ -278,6 +278,24 @@ void DivSubSong::clearData() {
|
|||
ordersLen=1;
|
||||
}
|
||||
|
||||
void DivSubSong::removeUnusedPatterns() {
|
||||
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
||||
bool used[DIV_MAX_PATTERNS];
|
||||
memset(used,0,DIV_MAX_PATTERNS*sizeof(bool));
|
||||
|
||||
for (int j=0; j<ordersLen; j++) {
|
||||
used[orders.ord[i][j]]=true;
|
||||
}
|
||||
|
||||
for (int j=0; j<DIV_MAX_PATTERNS; j++) {
|
||||
if (!used[j] && pat[i].data[j]!=NULL) {
|
||||
delete pat[i].data[j];
|
||||
pat[i].data[j]=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DivSubSong::optimizePatterns() {
|
||||
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
||||
logD("optimizing channel %d...",i);
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ struct DivSubSong {
|
|||
void findLength(int loopOrder, int loopRow, double fadeoutLen, int& rowsForFadeout, bool& hasFFxx, std::vector<int>& orders, std::vector<DivGroovePattern>& grooves, int& length, int chans, int jumpTreatment, int ignoreJumpAtEnd, int firstPat=0);
|
||||
|
||||
void clearData();
|
||||
void removeUnusedPatterns();
|
||||
void optimizePatterns();
|
||||
void rearrangePatterns();
|
||||
void sortOrders();
|
||||
|
|
|
|||
|
|
@ -6553,6 +6553,14 @@ bool FurnaceGUI::loop() {
|
|||
MARK_MODIFIED;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button(_("Remove unused patterns"))) {
|
||||
stop();
|
||||
e->lockEngine([this]() {
|
||||
e->curSubSong->removeUnusedPatterns();
|
||||
});
|
||||
MARK_MODIFIED;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button(_("Remove unused instruments"))) {
|
||||
stop();
|
||||
e->delUnusedIns();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue