fix chanShowChanOsc-related bugs

when swapping or stomping channels/systems
This commit is contained in:
tildearrow 2024-02-24 18:12:02 -05:00
parent f9ba6809e9
commit 5b170f75ec

View file

@ -636,6 +636,7 @@ void DivEngine::swapChannels(int src, int dest) {
String prevChanName=curSubSong->chanName[src];
String prevChanShortName=curSubSong->chanShortName[src];
bool prevChanShow=curSubSong->chanShow[src];
bool prevChanShowChanOsc=curSubSong->chanShowChanOsc[src];
unsigned char prevChanCollapse=curSubSong->chanCollapse[src];
curSubSong->chanName[src]=curSubSong->chanName[dest];
@ -645,6 +646,7 @@ void DivEngine::swapChannels(int src, int dest) {
curSubSong->chanName[dest]=prevChanName;
curSubSong->chanShortName[dest]=prevChanShortName;
curSubSong->chanShow[dest]=prevChanShow;
curSubSong->chanShowChanOsc[dest]=prevChanShowChanOsc;
curSubSong->chanCollapse[dest]=prevChanCollapse;
}
@ -658,6 +660,7 @@ void DivEngine::stompChannel(int ch) {
curSubSong->chanName[ch]="";
curSubSong->chanShortName[ch]="";
curSubSong->chanShow[ch]=true;
curSubSong->chanShowChanOsc[ch]=true;
curSubSong->chanCollapse[ch]=false;
}
@ -804,6 +807,7 @@ int DivEngine::duplicateSubSong(int index) {
theCopy->orders=theOrig->orders;
memcpy(theCopy->chanShow,theOrig->chanShow,DIV_MAX_CHANS*sizeof(bool));
memcpy(theCopy->chanShowChanOsc,theOrig->chanShowChanOsc,DIV_MAX_CHANS*sizeof(bool));
memcpy(theCopy->chanCollapse,theOrig->chanCollapse,DIV_MAX_CHANS);
for (int i=0; i<DIV_MAX_CHANS; i++) {
@ -1323,6 +1327,7 @@ void DivEngine::swapSystemUnsafe(int src, int dest, bool preserveOrder) {
String prevChanName[DIV_MAX_CHANS];
String prevChanShortName[DIV_MAX_CHANS];
bool prevChanShow[DIV_MAX_CHANS];
bool prevChanShowChanOsc[DIV_MAX_CHANS];
unsigned char prevChanCollapse[DIV_MAX_CHANS];
for (int j=0; j<tchans; j++) {
@ -1334,6 +1339,7 @@ void DivEngine::swapSystemUnsafe(int src, int dest, bool preserveOrder) {
prevChanName[j]=song.subsong[i]->chanName[j];
prevChanShortName[j]=song.subsong[i]->chanShortName[j];
prevChanShow[j]=song.subsong[i]->chanShow[j];
prevChanShowChanOsc[j]=song.subsong[i]->chanShowChanOsc[j];
prevChanCollapse[j]=song.subsong[i]->chanCollapse[j];
}
@ -1347,6 +1353,7 @@ void DivEngine::swapSystemUnsafe(int src, int dest, bool preserveOrder) {
song.subsong[i]->chanName[j]=prevChanName[swappedChannels[j]];
song.subsong[i]->chanShortName[j]=prevChanShortName[swappedChannels[j]];
song.subsong[i]->chanShow[j]=prevChanShow[swappedChannels[j]];
song.subsong[i]->chanShowChanOsc[j]=prevChanShowChanOsc[swappedChannels[j]];
song.subsong[i]->chanCollapse[j]=prevChanCollapse[swappedChannels[j]];
}
}