pattern data refactor, part 8
this is the first commit that builds maybe not
This commit is contained in:
parent
2b745cac62
commit
182a9e3b9d
6 changed files with 197 additions and 256 deletions
|
|
@ -43,25 +43,6 @@ const char* queryReplaceModes[GUI_QUERY_REPLACE_MAX]={
|
|||
_N("clear")
|
||||
};
|
||||
|
||||
int queryNote(int note, int octave) {
|
||||
if (note==100) {
|
||||
return 128;
|
||||
} else if (note==101) { // note off and envelope release
|
||||
return 129;
|
||||
} else if (note==102) { // envelope release only
|
||||
return 130;
|
||||
} else if (octave==0 && note==0) {
|
||||
return -61;
|
||||
} else if (note==0 && octave!=0) {
|
||||
return -61; // bug note?
|
||||
}
|
||||
int seek=(note+(signed char)octave*12);
|
||||
if (seek<-60 || seek>=120) {
|
||||
return -61; // out of range note
|
||||
}
|
||||
return seek;
|
||||
}
|
||||
|
||||
bool checkCondition(int mode, int arg, int argMax, int val, bool noteMode=false) {
|
||||
const int emptyVal=noteMode?-61:-1;
|
||||
switch (mode) {
|
||||
|
|
@ -137,9 +118,9 @@ void FurnaceGUI::doFind() {
|
|||
for (FurnaceGUIFindQuery& l: curQuery) {
|
||||
if (matched) break;
|
||||
|
||||
if (!checkCondition(l.noteMode,l.note,l.noteMax,queryNote(p->data[j][0],p->data[j][1]),true)) continue;
|
||||
if (!checkCondition(l.insMode,l.ins,l.insMax,p->data[j][2])) continue;
|
||||
if (!checkCondition(l.volMode,l.vol,l.volMax,p->data[j][3])) continue;
|
||||
if (!checkCondition(l.noteMode,l.note,l.noteMax,p->newData[j][DIV_PAT_NOTE],true)) continue;
|
||||
if (!checkCondition(l.insMode,l.ins,l.insMax,p->newData[j][DIV_PAT_INS])) continue;
|
||||
if (!checkCondition(l.volMode,l.vol,l.volMax,p->newData[j][DIV_PAT_VOL])) continue;
|
||||
|
||||
if (l.effectCount>0) {
|
||||
bool notMatched=false;
|
||||
|
|
@ -148,8 +129,8 @@ void FurnaceGUI::doFind() {
|
|||
for (int m=0; m<l.effectCount; m++) {
|
||||
bool allGood=false;
|
||||
for (int n=0; n<e->curPat[k].effectCols; n++) {
|
||||
if (!checkCondition(l.effectMode[m],l.effect[m],l.effectMax[m],p->data[j][4+n*2])) continue;
|
||||
if (!checkCondition(l.effectValMode[m],l.effectVal[m],l.effectValMax[m],p->data[j][5+n*2])) continue;
|
||||
if (!checkCondition(l.effectMode[m],l.effect[m],l.effectMax[m],p->newData[j][DIV_PAT_FX(n)])) continue;
|
||||
if (!checkCondition(l.effectValMode[m],l.effectVal[m],l.effectValMax[m],p->newData[j][DIV_PAT_FXVAL(n)])) continue;
|
||||
allGood=true;
|
||||
effectPos[m]=n;
|
||||
break;
|
||||
|
|
@ -164,8 +145,8 @@ void FurnaceGUI::doFind() {
|
|||
// locate first effect
|
||||
int posOfFirst=-1;
|
||||
for (int m=0; m<e->curPat[k].effectCols; m++) {
|
||||
if (!checkCondition(l.effectMode[0],l.effect[0],l.effectMax[0],p->data[j][4+m*2])) continue;
|
||||
if (!checkCondition(l.effectValMode[0],l.effectVal[0],l.effectValMax[0],p->data[j][5+m*2])) continue;
|
||||
if (!checkCondition(l.effectMode[0],l.effect[0],l.effectMax[0],p->newData[j][DIV_PAT_FX(m)])) continue;
|
||||
if (!checkCondition(l.effectValMode[0],l.effectVal[0],l.effectValMax[0],p->newData[j][DIV_PAT_FXVAL(m)])) continue;
|
||||
posOfFirst=m;
|
||||
break;
|
||||
}
|
||||
|
|
@ -180,11 +161,11 @@ void FurnaceGUI::doFind() {
|
|||
}
|
||||
// search from first effect location
|
||||
for (int m=0; m<l.effectCount; m++) {
|
||||
if (!checkCondition(l.effectMode[m],l.effect[m],l.effectMax[m],p->data[j][4+(m+posOfFirst)*2])) {
|
||||
if (!checkCondition(l.effectMode[m],l.effect[m],l.effectMax[m],p->newData[j][DIV_PAT_FX(m+posOfFirst)])) {
|
||||
notMatched=true;
|
||||
break;
|
||||
}
|
||||
if (!checkCondition(l.effectValMode[m],l.effectVal[m],l.effectValMax[m],p->data[j][5+(m+posOfFirst)*2])) {
|
||||
if (!checkCondition(l.effectValMode[m],l.effectVal[m],l.effectValMax[m],p->newData[j][DIV_PAT_FXVAL(m+posOfFirst)])) {
|
||||
notMatched=true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -198,11 +179,11 @@ void FurnaceGUI::doFind() {
|
|||
notMatched=true;
|
||||
} else {
|
||||
for (int m=0; m<effectMax; m++) {
|
||||
if (!checkCondition(l.effectMode[m],l.effect[m],l.effectMax[m],p->data[j][4+m*2])) {
|
||||
if (!checkCondition(l.effectMode[m],l.effect[m],l.effectMax[m],p->newData[j][DIV_PAT_FX(m)])) {
|
||||
notMatched=true;
|
||||
break;
|
||||
}
|
||||
if (!checkCondition(l.effectValMode[m],l.effectVal[m],l.effectValMax[m],p->data[j][5+m*2])) {
|
||||
if (!checkCondition(l.effectValMode[m],l.effectVal[m],l.effectValMax[m],p->newData[j][DIV_PAT_FXVAL(m)])) {
|
||||
notMatched=true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -248,131 +229,107 @@ void FurnaceGUI::doReplace() {
|
|||
if (touched[i.x][(patIndex<<8)|i.y]) continue;
|
||||
touched[i.x][(patIndex<<8)|i.y]=true;
|
||||
|
||||
memcpy(prevVal,p->data[i.y],DIV_MAX_COLS*sizeof(short));
|
||||
memcpy(prevVal,p->newData[i.y],DIV_MAX_COLS*sizeof(short));
|
||||
|
||||
// replace note
|
||||
if (queryReplaceNoteDo) {
|
||||
switch (queryReplaceNoteMode) {
|
||||
case GUI_QUERY_REPLACE_SET:
|
||||
if (queryReplaceNote==130) { // macro release
|
||||
p->data[i.y][0]=102;
|
||||
p->data[i.y][1]=0;
|
||||
} else if (queryReplaceNote==129) { // note release
|
||||
p->data[i.y][0]=101;
|
||||
p->data[i.y][1]=0;
|
||||
} else if (queryReplaceNote==128) { // note off
|
||||
p->data[i.y][0]=100;
|
||||
p->data[i.y][1]=0;
|
||||
} else if (queryReplaceNote>=-60 && queryReplaceNote<120) { // note
|
||||
p->data[i.y][0]=(queryReplaceNote+60)%12;
|
||||
if (p->data[i.y][0]==0) p->data[i.y][0]=12;
|
||||
p->data[i.y][1]=(unsigned char)((queryReplaceNote-1)/12);
|
||||
} else { // invalid
|
||||
p->data[i.y][0]=0;
|
||||
p->data[i.y][1]=0;
|
||||
}
|
||||
p->newData[i.y][DIV_PAT_NOTE]=queryReplaceNote;
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_ADD:
|
||||
if (p->data[i.y][0]<100) {
|
||||
int note=queryNote(p->data[i.y][0],p->data[i.y][1]);
|
||||
if (note>=-60 && note<120) {
|
||||
note+=queryReplaceNote;
|
||||
if (note<-60) note=-60;
|
||||
if (note>119) note=119;
|
||||
case GUI_QUERY_REPLACE_ADD: {
|
||||
int note=p->newData[i.y][DIV_PAT_NOTE];
|
||||
if (note>=0 && note<180) {
|
||||
note+=queryReplaceNote;
|
||||
if (note<0) note=0;
|
||||
if (note>179) note=179;
|
||||
|
||||
p->data[i.y][0]=(note+60)%12;
|
||||
p->data[i.y][1]=(unsigned char)(((note+60)/12)-5);
|
||||
if (p->data[i.y][0]==0) {
|
||||
p->data[i.y][0]=12;
|
||||
p->data[i.y][1]=(unsigned char)(p->data[i.y][1]-1);
|
||||
}
|
||||
}
|
||||
p->newData[i.y][DIV_PAT_NOTE]=note;
|
||||
}
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_ADD_OVERFLOW:
|
||||
if (p->data[i.y][0]<100) {
|
||||
int note=queryNote(p->data[i.y][0],p->data[i.y][1]);
|
||||
if (note>=-60 && note<120) {
|
||||
}
|
||||
case GUI_QUERY_REPLACE_ADD_OVERFLOW: {
|
||||
int note=p->newData[i.y][DIV_PAT_NOTE];
|
||||
if (note>=0 && note<180) {
|
||||
note+=queryReplaceNote;
|
||||
if (note<-60) {
|
||||
while (note<-60) note+=180;
|
||||
} else if (note>119) {
|
||||
while (note>119) note-=180;
|
||||
if (note<0) {
|
||||
while (note<0) note+=180;
|
||||
} else if (note>179) {
|
||||
while (note>179) note-=180;
|
||||
}
|
||||
|
||||
p->data[i.y][0]=(note+60)%12;
|
||||
p->data[i.y][1]=(unsigned char)(((note+60)/12)-5);
|
||||
if (p->data[i.y][0]==0) {
|
||||
p->data[i.y][0]=12;
|
||||
p->data[i.y][1]=(unsigned char)(p->data[i.y][1]-1);
|
||||
}
|
||||
p->newData[i.y][DIV_PAT_NOTE]=note;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GUI_QUERY_REPLACE_SCALE:
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_CLEAR:
|
||||
p->data[i.y][0]=0;
|
||||
p->data[i.y][1]=0;
|
||||
p->newData[i.y][DIV_PAT_NOTE]=-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// replace ins
|
||||
if (queryReplaceInsDo) {
|
||||
switch (queryReplaceInsMode) {
|
||||
case GUI_QUERY_REPLACE_SET:
|
||||
p->data[i.y][2]=queryReplaceIns;
|
||||
p->newData[i.y][DIV_PAT_INS]=queryReplaceIns;
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_ADD:
|
||||
if (p->data[i.y][2]>=0) {
|
||||
p->data[i.y][2]+=queryReplaceIns;
|
||||
if (p->data[i.y][2]<0) p->data[i.y][2]=0;
|
||||
if (p->data[i.y][2]>255) p->data[i.y][2]=255;
|
||||
if (p->newData[i.y][DIV_PAT_INS]>=0) {
|
||||
p->newData[i.y][DIV_PAT_INS]+=queryReplaceIns;
|
||||
if (p->newData[i.y][DIV_PAT_INS]<0) p->newData[i.y][DIV_PAT_INS]=0;
|
||||
if (p->newData[i.y][DIV_PAT_INS]>255) p->newData[i.y][DIV_PAT_INS]=255;
|
||||
}
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_ADD_OVERFLOW:
|
||||
if (p->data[i.y][2]>=0) p->data[i.y][2]=(p->data[i.y][2]+queryReplaceIns)&0xff;
|
||||
if (p->newData[i.y][DIV_PAT_INS]>=0) p->newData[i.y][DIV_PAT_INS]=(p->newData[i.y][DIV_PAT_INS]+queryReplaceIns)&0xff;
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_SCALE:
|
||||
if (p->data[i.y][2]>=0) {
|
||||
p->data[i.y][2]=(p->data[i.y][2]*queryReplaceIns)/100;
|
||||
if (p->data[i.y][2]<0) p->data[i.y][2]=0;
|
||||
if (p->data[i.y][2]>255) p->data[i.y][2]=255;
|
||||
if (p->newData[i.y][DIV_PAT_INS]>=0) {
|
||||
p->newData[i.y][DIV_PAT_INS]=(p->newData[i.y][DIV_PAT_INS]*queryReplaceIns)/100;
|
||||
if (p->newData[i.y][DIV_PAT_INS]<0) p->newData[i.y][DIV_PAT_INS]=0;
|
||||
if (p->newData[i.y][DIV_PAT_INS]>255) p->newData[i.y][DIV_PAT_INS]=255;
|
||||
}
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_CLEAR:
|
||||
p->data[i.y][2]=-1;
|
||||
p->newData[i.y][DIV_PAT_INS]=-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// replace vol
|
||||
if (queryReplaceVolDo) {
|
||||
switch (queryReplaceVolMode) {
|
||||
case GUI_QUERY_REPLACE_SET:
|
||||
p->data[i.y][3]=queryReplaceVol;
|
||||
p->newData[i.y][DIV_PAT_VOL]=queryReplaceVol;
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_ADD:
|
||||
if (p->data[i.y][3]>=0) {
|
||||
p->data[i.y][3]+=queryReplaceVol;
|
||||
if (p->data[i.y][3]<0) p->data[i.y][3]=0;
|
||||
if (p->data[i.y][3]>255) p->data[i.y][3]=255;
|
||||
if (p->newData[i.y][DIV_PAT_VOL]>=0) {
|
||||
p->newData[i.y][DIV_PAT_VOL]+=queryReplaceVol;
|
||||
if (p->newData[i.y][DIV_PAT_VOL]<0) p->newData[i.y][DIV_PAT_VOL]=0;
|
||||
if (p->newData[i.y][DIV_PAT_VOL]>255) p->newData[i.y][DIV_PAT_VOL]=255;
|
||||
}
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_ADD_OVERFLOW:
|
||||
if (p->data[i.y][3]>=0) p->data[i.y][3]=(p->data[i.y][3]+queryReplaceVol)&0xff;
|
||||
if (p->newData[i.y][DIV_PAT_VOL]>=0) p->newData[i.y][DIV_PAT_VOL]=(p->newData[i.y][DIV_PAT_VOL]+queryReplaceVol)&0xff;
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_SCALE:
|
||||
if (p->data[i.y][3]>=0) {
|
||||
p->data[i.y][3]=(p->data[i.y][3]*queryReplaceVol)/100;
|
||||
if (p->data[i.y][3]<0) p->data[i.y][3]=0;
|
||||
if (p->data[i.y][3]>255) p->data[i.y][3]=255;
|
||||
if (p->newData[i.y][DIV_PAT_VOL]>=0) {
|
||||
p->newData[i.y][DIV_PAT_VOL]=(p->newData[i.y][DIV_PAT_VOL]*queryReplaceVol)/100;
|
||||
if (p->newData[i.y][DIV_PAT_VOL]<0) p->newData[i.y][DIV_PAT_VOL]=0;
|
||||
if (p->newData[i.y][DIV_PAT_VOL]>255) p->newData[i.y][DIV_PAT_VOL]=255;
|
||||
}
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_CLEAR:
|
||||
p->data[i.y][3]=-1;
|
||||
p->newData[i.y][DIV_PAT_VOL]=-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// effect replacement is a bit more complicated
|
||||
// first we consider effect replacement position
|
||||
signed char effectOrder[8];
|
||||
memset(effectOrder,-1,8);
|
||||
|
||||
|
|
@ -388,7 +345,7 @@ void FurnaceGUI::doReplace() {
|
|||
effectOrder[placementIndex++]=i.effectPos[j];
|
||||
}
|
||||
for (int j=0; j<e->song.subsong[i.subsong]->pat[i.x].effectCols && placementIndex<8 && j<8; j++) {
|
||||
if (p->data[i.y][4+j*2]!=-1 || p->data[i.y][5+j*2]!=-1) {
|
||||
if (p->newData[i.y][DIV_PAT_FX(j)]!=-1 || p->newData[i.y][DIV_PAT_FXVAL(j)]!=-1) {
|
||||
effectOrder[placementIndex++]=j;
|
||||
}
|
||||
}
|
||||
|
|
@ -400,12 +357,12 @@ void FurnaceGUI::doReplace() {
|
|||
effectOrder[placementIndex++]=i.effectPos[j];
|
||||
}
|
||||
for (int j=0; j<e->song.subsong[i.subsong]->pat[i.x].effectCols && placementIndex<8 && j<8; j++) {
|
||||
if (p->data[i.y][4+j*2]!=-1 || p->data[i.y][5+j*2]!=-1) {
|
||||
if (p->newData[i.y][DIV_PAT_FX(j)]!=-1 || p->newData[i.y][DIV_PAT_FXVAL(j)]!=-1) {
|
||||
effectOrder[placementIndex++]=j;
|
||||
}
|
||||
}
|
||||
for (int j=0; j<e->song.subsong[i.subsong]->pat[i.x].effectCols; j++) {
|
||||
if (p->data[i.y][4+j*2]==-1 && p->data[i.y][5+j*2]==-1) {
|
||||
if (p->newData[i.y][DIV_PAT_FX(j)]==-1 && p->newData[i.y][DIV_PAT_FXVAL(j)]==-1) {
|
||||
effectOrder[placementIndex++]=j;
|
||||
}
|
||||
}
|
||||
|
|
@ -414,7 +371,7 @@ void FurnaceGUI::doReplace() {
|
|||
case 3: { // insert in free spaces
|
||||
int placementIndex=0;
|
||||
for (int j=0; j<e->song.subsong[i.subsong]->pat[i.x].effectCols && j<8; j++) {
|
||||
if (p->data[i.y][4+j*2]==-1 && p->data[i.y][5+j*2]==-1) {
|
||||
if (p->newData[i.y][DIV_PAT_FX(j)]==-1 && p->newData[i.y][DIV_PAT_FXVAL(j)]==-1) {
|
||||
effectOrder[placementIndex++]=j;
|
||||
}
|
||||
}
|
||||
|
|
@ -422,61 +379,66 @@ void FurnaceGUI::doReplace() {
|
|||
}
|
||||
}
|
||||
|
||||
// then we replace effects/values
|
||||
for (int j=0; j<queryReplaceEffectCount && j<8; j++) {
|
||||
signed char pos=effectOrder[j];
|
||||
// don't replace if we cannot find a position
|
||||
if (pos==-1) continue;
|
||||
|
||||
// replace effect
|
||||
if (queryReplaceEffectDo[j]) {
|
||||
switch (queryReplaceEffectMode[j]) {
|
||||
case GUI_QUERY_REPLACE_SET:
|
||||
p->data[i.y][4+pos*2]=queryReplaceEffect[j];
|
||||
p->newData[i.y][DIV_PAT_FX(pos)]=queryReplaceEffect[j];
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_ADD:
|
||||
if (p->data[i.y][4+pos*2]>=0) {
|
||||
p->data[i.y][4+pos*2]+=queryReplaceEffect[j];
|
||||
if (p->data[i.y][4+pos*2]<0) p->data[i.y][4+pos*2]=0;
|
||||
if (p->data[i.y][4+pos*2]>255) p->data[i.y][4+pos*2]=255;
|
||||
if (p->newData[i.y][DIV_PAT_FX(pos)]>=0) {
|
||||
p->newData[i.y][DIV_PAT_FX(pos)]+=queryReplaceEffect[j];
|
||||
if (p->newData[i.y][DIV_PAT_FX(pos)]<0) p->newData[i.y][DIV_PAT_FX(pos)]=0;
|
||||
if (p->newData[i.y][DIV_PAT_FX(pos)]>255) p->newData[i.y][DIV_PAT_FX(pos)]=255;
|
||||
}
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_ADD_OVERFLOW:
|
||||
if (p->data[i.y][4+pos*2]>=0) p->data[i.y][4+pos*2]=(p->data[i.y][4+pos*2]+queryReplaceEffect[j])&0xff;
|
||||
if (p->newData[i.y][DIV_PAT_FX(pos)]>=0) p->newData[i.y][DIV_PAT_FX(pos)]=(p->newData[i.y][DIV_PAT_FX(pos)]+queryReplaceEffect[j])&0xff;
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_SCALE:
|
||||
if (p->data[i.y][4+pos*2]>=0) {
|
||||
p->data[i.y][4+pos*2]=(p->data[i.y][4+pos*2]*queryReplaceEffect[j])/100;
|
||||
if (p->data[i.y][4+pos*2]<0) p->data[i.y][4+pos*2]=0;
|
||||
if (p->data[i.y][4+pos*2]>255) p->data[i.y][4+pos*2]=255;
|
||||
if (p->newData[i.y][DIV_PAT_FX(pos)]>=0) {
|
||||
p->newData[i.y][DIV_PAT_FX(pos)]=(p->newData[i.y][DIV_PAT_FX(pos)]*queryReplaceEffect[j])/100;
|
||||
if (p->newData[i.y][DIV_PAT_FX(pos)]<0) p->newData[i.y][DIV_PAT_FX(pos)]=0;
|
||||
if (p->newData[i.y][DIV_PAT_FX(pos)]>255) p->newData[i.y][DIV_PAT_FX(pos)]=255;
|
||||
}
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_CLEAR:
|
||||
p->data[i.y][4+pos*2]=-1;
|
||||
p->newData[i.y][DIV_PAT_FX(pos)]=-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// replace effect value
|
||||
if (queryReplaceEffectValDo[j]) {
|
||||
switch (queryReplaceEffectValMode[j]) {
|
||||
case GUI_QUERY_REPLACE_SET:
|
||||
p->data[i.y][5+pos*2]=queryReplaceEffectVal[j];
|
||||
p->newData[i.y][DIV_PAT_FXVAL(pos)]=queryReplaceEffectVal[j];
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_ADD:
|
||||
if (p->data[i.y][5+pos*2]>=0) {
|
||||
p->data[i.y][5+pos*2]+=queryReplaceEffectVal[j];
|
||||
if (p->data[i.y][5+pos*2]<0) p->data[i.y][5+pos*2]=0;
|
||||
if (p->data[i.y][5+pos*2]>255) p->data[i.y][5+pos*2]=255;
|
||||
if (p->newData[i.y][DIV_PAT_FXVAL(pos)]>=0) {
|
||||
p->newData[i.y][DIV_PAT_FXVAL(pos)]+=queryReplaceEffectVal[j];
|
||||
if (p->newData[i.y][DIV_PAT_FXVAL(pos)]<0) p->newData[i.y][DIV_PAT_FXVAL(pos)]=0;
|
||||
if (p->newData[i.y][DIV_PAT_FXVAL(pos)]>255) p->newData[i.y][DIV_PAT_FXVAL(pos)]=255;
|
||||
}
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_ADD_OVERFLOW:
|
||||
if (p->data[i.y][5+pos*2]>=0) p->data[i.y][5+pos*2]=(p->data[i.y][5+pos*2]+queryReplaceEffectVal[j])&0xff;
|
||||
if (p->newData[i.y][DIV_PAT_FXVAL(pos)]>=0) p->newData[i.y][DIV_PAT_FXVAL(pos)]=(p->newData[i.y][DIV_PAT_FXVAL(pos)]+queryReplaceEffectVal[j])&0xff;
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_SCALE:
|
||||
if (p->data[i.y][5+pos*2]>=0) {
|
||||
p->data[i.y][5+pos*2]=(p->data[i.y][5+pos*2]*queryReplaceEffectVal[j])/100;
|
||||
if (p->data[i.y][5+pos*2]<0) p->data[i.y][5+pos*2]=0;
|
||||
if (p->data[i.y][5+pos*2]>255) p->data[i.y][5+pos*2]=255;
|
||||
if (p->newData[i.y][DIV_PAT_FXVAL(pos)]>=0) {
|
||||
p->newData[i.y][DIV_PAT_FXVAL(pos)]=(p->newData[i.y][DIV_PAT_FXVAL(pos)]*queryReplaceEffectVal[j])/100;
|
||||
if (p->newData[i.y][DIV_PAT_FXVAL(pos)]<0) p->newData[i.y][DIV_PAT_FXVAL(pos)]=0;
|
||||
if (p->newData[i.y][DIV_PAT_FXVAL(pos)]>255) p->newData[i.y][DIV_PAT_FXVAL(pos)]=255;
|
||||
}
|
||||
break;
|
||||
case GUI_QUERY_REPLACE_CLEAR:
|
||||
p->data[i.y][5+pos*2]=-1;
|
||||
p->newData[i.y][DIV_PAT_FXVAL(pos)]=-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -484,8 +446,8 @@ void FurnaceGUI::doReplace() {
|
|||
|
||||
// issue undo step
|
||||
for (int j=0; j<DIV_MAX_COLS; j++) {
|
||||
if (p->data[i.y][j]!=prevVal[j]) {
|
||||
us.pat.push_back(UndoPatternData(i.subsong,i.x,patIndex,i.y,j,prevVal[j],p->data[i.y][j]));
|
||||
if (p->newData[i.y][j]!=prevVal[j]) {
|
||||
us.pat.push_back(UndoPatternData(i.subsong,i.x,patIndex,i.y,j,prevVal[j],p->newData[i.y][j]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -622,7 +584,7 @@ void FurnaceGUI::drawFindReplace() {
|
|||
}
|
||||
ImGui::TableNextColumn();
|
||||
if (SECOND_VISIBLE(i.noteMode)) {
|
||||
if (i.noteMax<-60 || i.noteMax>=120) {
|
||||
if (i.noteMax<0 || i.noteMax>=256) {
|
||||
i.noteMax=0;
|
||||
}
|
||||
NoteSelector(&i.noteMax, false);
|
||||
|
|
|
|||
162
src/gui/gui.cpp
162
src/gui/gui.cpp
|
|
@ -525,53 +525,53 @@ bool FurnaceGUI::InvCheckbox(const char* label, bool* value) {
|
|||
bool FurnaceGUI::NoteSelector(int* value, bool showOffRel, int octaveMin, int octaveMax) {
|
||||
bool ret=false, calcNote=false;
|
||||
char tempID[64];
|
||||
if (*value==130) {
|
||||
if (*value==DIV_MACRO_REL) {
|
||||
snprintf(tempID,64,"%s##MREL",macroRelLabel);
|
||||
} else if (*value==129) {
|
||||
} else if (*value==DIV_NOTE_REL) {
|
||||
snprintf(tempID,64,"%s##NREL",noteRelLabel);
|
||||
} else if (*value==128) {
|
||||
} else if (*value==DIV_NOTE_OFF) {
|
||||
snprintf(tempID,64,"%s##NOFF",noteOffLabel);
|
||||
} else if (*value>=-60 && *value<120) {
|
||||
snprintf(tempID,64,"%c%c",noteNames[*value%12+72][0],(noteNames[*value%12+72][1]=='-')?' ':noteNames[*value%12+72][1]);
|
||||
} else if (*value>=0 && *value<180) {
|
||||
snprintf(tempID,64,"%c%c",noteNames[*value%12][0],(noteNames[*value%12][1]=='-')?' ':noteNames[*value%12][1]);
|
||||
} else {
|
||||
snprintf(tempID,64,"???");
|
||||
*value=0;
|
||||
}
|
||||
float width=ImGui::GetContentRegionAvail().x/2-ImGui::GetStyle().FramePadding.x;
|
||||
ImGui::SetNextItemWidth(width);
|
||||
int note=(*value+60)%12;
|
||||
int oct=0;
|
||||
if (*value<120) oct=(*value-note)/12;
|
||||
int note=(*value)%12;
|
||||
int oct=-5;
|
||||
if (*value<180) oct=(*value-note-60)/12;
|
||||
ImGui::BeginGroup();
|
||||
ImGui::PushID(value);
|
||||
if (ImGui::BeginCombo("##NoteSelectorNote",tempID)) {
|
||||
for (int j=0; j<12; j++) {
|
||||
snprintf(tempID,64,"%c%c",noteNames[j+72][0],(noteNames[j+72][1]=='-')?' ':noteNames[j+72][1]);
|
||||
if (ImGui::Selectable(tempID,note==j && *value<128)) {
|
||||
snprintf(tempID,64,"%c%c",noteNames[j][0],(noteNames[j][1]=='-')?' ':noteNames[j][1]);
|
||||
if (ImGui::Selectable(tempID,note==j && *value<180)) {
|
||||
note=j;
|
||||
calcNote=true;
|
||||
}
|
||||
if (note==j && *value<120) ImGui::SetItemDefaultFocus();
|
||||
if (note==j && *value<180) ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
if (showOffRel) {
|
||||
if (ImGui::Selectable(noteOffLabel,*value==128)) {
|
||||
*value=128;
|
||||
if (ImGui::Selectable(noteOffLabel,*value==DIV_NOTE_OFF)) {
|
||||
*value=DIV_NOTE_OFF;
|
||||
ret=true;
|
||||
}
|
||||
if (ImGui::Selectable(noteRelLabel,*value==129)) {
|
||||
*value=129;
|
||||
if (ImGui::Selectable(noteRelLabel,*value==DIV_NOTE_REL)) {
|
||||
*value=DIV_NOTE_REL;
|
||||
ret=true;
|
||||
}
|
||||
if (ImGui::Selectable(macroRelLabel,*value==130)) {
|
||||
*value=130;
|
||||
if (ImGui::Selectable(macroRelLabel,*value==DIV_MACRO_REL)) {
|
||||
*value=DIV_MACRO_REL;
|
||||
ret=true;
|
||||
}
|
||||
if (*value>=128 && *value<=130) ImGui::SetItemDefaultFocus();
|
||||
if (*value>=DIV_NOTE_OFF && *value<=DIV_MACRO_REL) ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (*value<120) {
|
||||
if (*value<180) {
|
||||
ImGui::SetNextItemWidth(width/2);
|
||||
if (ImGui::InputScalar("##NoteSelectorOctave",ImGuiDataType_S32,&oct)) {
|
||||
if (oct<octaveMin) oct=octaveMin;
|
||||
|
|
@ -580,7 +580,7 @@ bool FurnaceGUI::NoteSelector(int* value, bool showOffRel, int octaveMin, int oc
|
|||
}
|
||||
}
|
||||
if (calcNote) {
|
||||
*value=oct*12+note;
|
||||
*value=(oct+5)*12+note;
|
||||
ret=true;
|
||||
}
|
||||
ImGui::PopID();
|
||||
|
|
@ -1347,48 +1347,39 @@ void FurnaceGUI::noteInput(int num, int key, int vol) {
|
|||
prepareUndo(GUI_UNDO_PATTERN_EDIT);
|
||||
|
||||
if (key==GUI_NOTE_OFF) { // note off
|
||||
pat->data[y][0]=100;
|
||||
pat->data[y][1]=0;
|
||||
pat->newData[y][DIV_PAT_NOTE]=DIV_NOTE_OFF;
|
||||
removeIns=true;
|
||||
} else if (key==GUI_NOTE_OFF_RELEASE) { // note off + env release
|
||||
pat->data[y][0]=101;
|
||||
pat->data[y][1]=0;
|
||||
pat->newData[y][DIV_PAT_NOTE]=DIV_NOTE_REL;
|
||||
removeIns=true;
|
||||
} else if (key==GUI_NOTE_RELEASE) { // env release only
|
||||
pat->data[y][0]=102;
|
||||
pat->data[y][1]=0;
|
||||
pat->newData[y][DIV_PAT_NOTE]=DIV_MACRO_REL;
|
||||
removeIns=true;
|
||||
} else {
|
||||
pat->data[y][0]=num%12;
|
||||
pat->data[y][1]=num/12;
|
||||
if (pat->data[y][0]==0) {
|
||||
pat->data[y][0]=12;
|
||||
pat->data[y][1]--;
|
||||
}
|
||||
pat->data[y][1]=(unsigned char)pat->data[y][1];
|
||||
pat->newData[y][DIV_PAT_NOTE]=num+60;
|
||||
if (latchIns==-2) {
|
||||
if (curIns>=(int)e->song.ins.size()) curIns=-1;
|
||||
if (curIns>=0) {
|
||||
pat->data[y][2]=curIns;
|
||||
pat->newData[y][DIV_PAT_INS]=curIns;
|
||||
}
|
||||
} else if (latchIns!=-1 && !e->song.ins.empty()) {
|
||||
pat->data[y][2]=MIN(((int)e->song.ins.size())-1,latchIns);
|
||||
pat->newData[y][DIV_PAT_INS]=MIN(((int)e->song.ins.size())-1,latchIns);
|
||||
}
|
||||
int maxVol=e->getMaxVolumeChan(ch);
|
||||
if (latchVol!=-1) {
|
||||
pat->data[y][3]=MIN(maxVol,latchVol);
|
||||
pat->newData[y][DIV_PAT_VOL]=MIN(maxVol,latchVol);
|
||||
} else if (vol!=-1) {
|
||||
pat->data[y][3]=e->mapVelocity(ch,pow((float)vol/127.0f,midiMap.volExp));
|
||||
pat->newData[y][DIV_PAT_VOL]=e->mapVelocity(ch,pow((float)vol/127.0f,midiMap.volExp));
|
||||
}
|
||||
if (latchEffect!=-1) pat->data[y][4]=latchEffect;
|
||||
if (latchEffectVal!=-1) pat->data[y][5]=latchEffectVal;
|
||||
if (latchEffect!=-1) pat->newData[y][DIV_PAT_FX(0)]=latchEffect;
|
||||
if (latchEffectVal!=-1) pat->newData[y][DIV_PAT_FXVAL(0)]=latchEffectVal;
|
||||
}
|
||||
if (removeIns) {
|
||||
if (settings.removeInsOff) {
|
||||
pat->data[y][2]=-1;
|
||||
pat->newData[y][DIV_PAT_INS]=-1;
|
||||
}
|
||||
if (settings.removeVolOff) {
|
||||
pat->data[y][3]=-1;
|
||||
pat->newData[y][DIV_PAT_VOL]=-1;
|
||||
}
|
||||
}
|
||||
editAdvance();
|
||||
|
|
@ -1407,26 +1398,27 @@ void FurnaceGUI::valueInput(int num, bool direct, int target) {
|
|||
|
||||
DivPattern* pat=e->curPat[ch].getPattern(e->curOrders->ord[ch][ord],true);
|
||||
prepareUndo(GUI_UNDO_PATTERN_EDIT);
|
||||
if (target==-1) target=cursor.xFine+1;
|
||||
if (target==-1) target=cursor.xFine;
|
||||
if (direct) {
|
||||
pat->data[y][target]=num&0xff;
|
||||
pat->newData[y][target]=num&0xff;
|
||||
} else {
|
||||
if (pat->data[y][target]==-1) pat->data[y][target]=0;
|
||||
if (pat->newData[y][target]==-1) pat->newData[y][target]=0;
|
||||
if (!settings.pushNibble && !curNibble) {
|
||||
pat->data[y][target]=num;
|
||||
pat->newData[y][target]=num;
|
||||
} else {
|
||||
pat->data[y][target]=((pat->data[y][target]<<4)|num)&0xff;
|
||||
pat->newData[y][target]=((pat->newData[y][target]<<4)|num)&0xff;
|
||||
}
|
||||
}
|
||||
if (cursor.xFine==1) { // instrument
|
||||
if (pat->data[y][target]>=(int)e->song.ins.size()) {
|
||||
pat->data[y][target]&=0x0f;
|
||||
if (pat->data[y][target]>=(int)e->song.ins.size()) {
|
||||
pat->data[y][target]=(int)e->song.ins.size()-1;
|
||||
// TODO: shouldn't this be target?
|
||||
if (cursor.xFine==DIV_PAT_INS) { // instrument
|
||||
if (pat->newData[y][target]>=(int)e->song.ins.size()) {
|
||||
pat->newData[y][target]&=0x0f;
|
||||
if (pat->newData[y][target]>=(int)e->song.ins.size()) {
|
||||
pat->newData[y][target]=(int)e->song.ins.size()-1;
|
||||
}
|
||||
}
|
||||
if (settings.absorbInsInput) {
|
||||
curIns=pat->data[y][target];
|
||||
curIns=pat->newData[y][target];
|
||||
wavePreviewInit=true;
|
||||
updateFMPreview=true;
|
||||
}
|
||||
|
|
@ -1442,18 +1434,18 @@ void FurnaceGUI::valueInput(int num, bool direct, int target) {
|
|||
}
|
||||
}
|
||||
makeUndo(GUI_UNDO_PATTERN_EDIT);
|
||||
} else if (cursor.xFine==2) {
|
||||
} else if (cursor.xFine==DIV_PAT_VOL) {
|
||||
if (curNibble) {
|
||||
if (pat->data[y][target]>e->getMaxVolumeChan(ch)) pat->data[y][target]=e->getMaxVolumeChan(ch);
|
||||
if (pat->newData[y][target]>e->getMaxVolumeChan(ch)) pat->newData[y][target]=e->getMaxVolumeChan(ch);
|
||||
} else {
|
||||
pat->data[y][target]&=15;
|
||||
pat->newData[y][target]&=15;
|
||||
}
|
||||
if (direct) {
|
||||
curNibble=false;
|
||||
} else {
|
||||
if (e->getMaxVolumeChan(ch)<16) {
|
||||
curNibble=false;
|
||||
if (pat->data[y][target]>e->getMaxVolumeChan(ch)) pat->data[y][target]=e->getMaxVolumeChan(ch);
|
||||
if (pat->newData[y][target]>e->getMaxVolumeChan(ch)) pat->newData[y][target]=e->getMaxVolumeChan(ch);
|
||||
editAdvance();
|
||||
} else {
|
||||
curNibble=!curNibble;
|
||||
|
|
@ -2341,7 +2333,7 @@ int FurnaceGUI::save(String path, int dmfVersion) {
|
|||
if (dmfVersion<24) dmfVersion=24;
|
||||
w=e->saveDMF(dmfVersion);
|
||||
} else {
|
||||
w=e->saveFur(false,settings.newPatternFormat);
|
||||
w=e->saveFur(false);
|
||||
}
|
||||
if (w==NULL) {
|
||||
lastError=e->getLastError();
|
||||
|
|
@ -3148,10 +3140,10 @@ void FurnaceGUI::editOptions(bool topMenu) {
|
|||
ImGui::SameLine();
|
||||
if (ImGui::Button(_("Set"))) {
|
||||
DivPattern* pat=e->curPat[cursor.xCoarse].getPattern(e->curOrders->ord[cursor.xCoarse][curOrder],true);
|
||||
latchIns=pat->data[cursor.y][2];
|
||||
latchVol=pat->data[cursor.y][3];
|
||||
latchEffect=pat->data[cursor.y][4];
|
||||
latchEffectVal=pat->data[cursor.y][5];
|
||||
latchIns=pat->newData[cursor.y][DIV_PAT_INS];
|
||||
latchVol=pat->newData[cursor.y][DIV_PAT_VOL];
|
||||
latchEffect=pat->newData[cursor.y][DIV_PAT_FX(0)];
|
||||
latchEffectVal=pat->newData[cursor.y][DIV_PAT_FXVAL(0)];
|
||||
latchTarget=0;
|
||||
latchNibble=false;
|
||||
}
|
||||
|
|
@ -4866,46 +4858,50 @@ bool FurnaceGUI::loop() {
|
|||
DivPattern* p=e->curPat[cursor.xCoarse].getPattern(e->curOrders->ord[cursor.xCoarse][curOrder],false);
|
||||
if (cursor.xFine>=0) switch (cursor.xFine) {
|
||||
case 0: // note
|
||||
if (p->data[cursor.y][0]>0) {
|
||||
if (p->data[cursor.y][0]==100) {
|
||||
if (p->newData[cursor.y][DIV_PAT_NOTE]>=0) {
|
||||
if (p->newData[cursor.y][DIV_PAT_NOTE]==DIV_NOTE_OFF) {
|
||||
info=fmt::sprintf(_("Note off (cut)"));
|
||||
} else if (p->data[cursor.y][0]==101) {
|
||||
} else if (p->newData[cursor.y][DIV_PAT_NOTE]==DIV_NOTE_REL) {
|
||||
info=fmt::sprintf(_("Note off (release)"));
|
||||
} else if (p->data[cursor.y][0]==102) {
|
||||
} else if (p->newData[cursor.y][DIV_PAT_NOTE]==DIV_MACRO_REL) {
|
||||
info=fmt::sprintf(_("Macro release only"));
|
||||
} else {
|
||||
info=fmt::sprintf(_("Note on: %s"),noteName(p->data[cursor.y][0],p->data[cursor.y][1]));
|
||||
info=fmt::sprintf(_("Note on: %s"),noteName(p->newData[cursor.y][DIV_PAT_NOTE]));
|
||||
}
|
||||
hasInfo=true;
|
||||
}
|
||||
break;
|
||||
case 1: // instrument
|
||||
if (p->data[cursor.y][2]>-1) {
|
||||
if (p->data[cursor.y][2]>=(int)e->song.ins.size()) {
|
||||
info=fmt::sprintf(_("Ins %d: <invalid>"),p->data[cursor.y][2]);
|
||||
if (p->newData[cursor.y][DIV_PAT_INS]>-1) {
|
||||
if (p->newData[cursor.y][DIV_PAT_INS]>=(int)e->song.ins.size()) {
|
||||
info=fmt::sprintf(_("Ins %d: <invalid>"),p->newData[cursor.y][DIV_PAT_INS]);
|
||||
} else {
|
||||
DivInstrument* ins=e->getIns(p->data[cursor.y][2]);
|
||||
info=fmt::sprintf(_("Ins %d: %s"),p->data[cursor.y][2],ins->name);
|
||||
DivInstrument* ins=e->getIns(p->newData[cursor.y][DIV_PAT_INS]);
|
||||
info=fmt::sprintf(_("Ins %d: %s"),p->newData[cursor.y][DIV_PAT_INS],ins->name);
|
||||
}
|
||||
hasInfo=true;
|
||||
}
|
||||
break;
|
||||
case 2: // volume
|
||||
if (p->data[cursor.y][3]>-1) {
|
||||
if (p->newData[cursor.y][DIV_PAT_VOL]>-1) {
|
||||
int maxVol=e->getMaxVolumeChan(cursor.xCoarse);
|
||||
if (maxVol<1 || p->data[cursor.y][3]>maxVol) {
|
||||
info=fmt::sprintf(_("Set volume: %d (%.2X, INVALID!)"),p->data[cursor.y][3],p->data[cursor.y][3]);
|
||||
if (maxVol<1 || p->newData[cursor.y][DIV_PAT_VOL]>maxVol) {
|
||||
info=fmt::sprintf(_("Set volume: %d (%.2X, INVALID!)"),p->newData[cursor.y][DIV_PAT_VOL],p->newData[cursor.y][DIV_PAT_VOL]);
|
||||
} else {
|
||||
float realVol=e->getGain(cursor.xCoarse,p->data[cursor.y][3]);
|
||||
info=fmt::sprintf(_("Set volume: %d (%.2X, %d%%)"),p->data[cursor.y][3],p->data[cursor.y][3],(int)(realVol*100.0f));
|
||||
float realVol=e->getGain(cursor.xCoarse,p->newData[cursor.y][DIV_PAT_VOL]);
|
||||
info=fmt::sprintf(_("Set volume: %d (%.2X, %d%%)"),p->newData[cursor.y][DIV_PAT_VOL],p->newData[cursor.y][DIV_PAT_VOL],(int)(realVol*100.0f));
|
||||
}
|
||||
hasInfo=true;
|
||||
}
|
||||
break;
|
||||
default: // effect
|
||||
int actualCursor=((cursor.xFine+1)&(~1));
|
||||
if (p->data[cursor.y][actualCursor]>-1) {
|
||||
info=e->getEffectDesc(p->data[cursor.y][actualCursor],cursor.xCoarse,true);
|
||||
if (cursor.xFine<DIV_MAX_COLS) {
|
||||
if (p->newData[cursor.y][cursor.xFine]>-1) {
|
||||
info=e->getEffectDesc(p->newData[cursor.y][cursor.xFine],cursor.xCoarse,true);
|
||||
hasInfo=true;
|
||||
}
|
||||
} else {
|
||||
info=_("Error!");
|
||||
hasInfo=true;
|
||||
}
|
||||
break;
|
||||
|
|
@ -6487,11 +6483,7 @@ bool FurnaceGUI::loop() {
|
|||
e->lockEngine([this]() {
|
||||
for (int i=0; i<e->getTotalChannelCount(); i++) {
|
||||
DivPattern* pat=e->curPat[i].getPattern(e->curOrders->ord[i][curOrder],true);
|
||||
memset(pat->data,-1,DIV_MAX_ROWS*DIV_MAX_COLS*sizeof(short));
|
||||
for (int j=0; j<DIV_MAX_ROWS; j++) {
|
||||
pat->data[j][0]=0;
|
||||
pat->data[j][1]=0;
|
||||
}
|
||||
memset(pat->newData,-1,DIV_MAX_ROWS*DIV_MAX_COLS*sizeof(short));
|
||||
}
|
||||
});
|
||||
MARK_MODIFIED;
|
||||
|
|
@ -7258,7 +7250,7 @@ bool FurnaceGUI::loop() {
|
|||
}
|
||||
}
|
||||
logD("saving backup...");
|
||||
SafeWriter* w=e->saveFur(true,true);
|
||||
SafeWriter* w=e->saveFur(true);
|
||||
logV("writing file...");
|
||||
|
||||
if (w!=NULL) {
|
||||
|
|
|
|||
|
|
@ -2001,7 +2001,6 @@ class FurnaceGUI {
|
|||
int iCannotWait;
|
||||
int orderButtonPos;
|
||||
int compress;
|
||||
int newPatternFormat;
|
||||
int renderClearPos;
|
||||
int insertBehavior;
|
||||
int pullDeleteRow;
|
||||
|
|
@ -2255,7 +2254,6 @@ class FurnaceGUI {
|
|||
iCannotWait(0),
|
||||
orderButtonPos(2),
|
||||
compress(1),
|
||||
newPatternFormat(1),
|
||||
renderClearPos(0),
|
||||
insertBehavior(1),
|
||||
pullDeleteRow(1),
|
||||
|
|
|
|||
|
|
@ -6447,7 +6447,7 @@ void FurnaceGUI::drawInsSID3(DivInstrument* ins) {
|
|||
"If this is disabled,filter cutoff will increase if you increase the pitch."));
|
||||
}
|
||||
|
||||
snprintf(buffer2,100,_("%s"),noteNameNormal(filt->bindCutoffToNoteCenter%12,(short)(filt->bindCutoffToNoteCenter / 12)-5));
|
||||
snprintf(buffer2,100,_("%s"),noteNameNormal(filt->bindCutoffToNoteCenter));
|
||||
snprintf(buffer,100,_("Cutoff change center note##bindcutcenternote%d"),i+1);
|
||||
P(CWSliderScalar(buffer,ImGuiDataType_U8,&filt->bindCutoffToNoteCenter,&_ZERO,&_ONE_HUNDRED_SEVENTY_NINE,buffer2)); rightClickable
|
||||
if (ImGui::IsItemHovered()) {
|
||||
|
|
@ -6480,7 +6480,7 @@ void FurnaceGUI::drawInsSID3(DivInstrument* ins) {
|
|||
"If this is disabled,filter resonance will increase if you increase the pitch."));
|
||||
}
|
||||
|
||||
snprintf(buffer2,100,_("%s"),noteNameNormal(filt->bindResonanceToNoteCenter%12,(short)(filt->bindResonanceToNoteCenter / 12)-5));
|
||||
snprintf(buffer2,100,_("%s"),noteNameNormal(filt->bindResonanceToNoteCenter));
|
||||
snprintf(buffer,100,_("Resonance change center note##bindrescenternote%d"),i+1);
|
||||
P(CWSliderScalar(buffer,ImGuiDataType_U8,&filt->bindResonanceToNoteCenter,&_ZERO,&_ONE_HUNDRED_SEVENTY_NINE,buffer2)); rightClickable
|
||||
if (ImGui::IsItemHovered()) {
|
||||
|
|
|
|||
|
|
@ -201,8 +201,8 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
bool cursorVol=(cursor.order==ord && cursor.y==i && cursor.xCoarse==j && cursor.xFine==2 && curWindowLast==GUI_WINDOW_PATTERN);
|
||||
|
||||
// note
|
||||
snprintf(id,63,"%.31s###PN_%d_%d",noteName(pat->data[i][0],pat->data[i][1]),i,j);
|
||||
if (pat->data[i][0]==0 && pat->data[i][1]==0) {
|
||||
snprintf(id,63,"%.31s###PN_%d_%d",noteName(pat->newData[i][DIV_PAT_NOTE]),i,j);
|
||||
if (pat->newData[i][DIV_PAT_NOTE]==-1) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
|
||||
} else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,activeColor);
|
||||
|
|
@ -234,21 +234,21 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
// the following is only visible when the channel is not collapsed
|
||||
if (e->curSubSong->chanCollapse[j]<3) {
|
||||
// instrument
|
||||
if (pat->data[i][2]==-1) {
|
||||
if (pat->newData[i][DIV_PAT_INS]==-1) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
|
||||
snprintf(id,63,"%.31s###PI_%d_%d",emptyLabel2,i,j);
|
||||
} else {
|
||||
if (pat->data[i][2]<0 || pat->data[i][2]>=e->song.insLen) {
|
||||
if (pat->newData[i][DIV_PAT_INS]<0 || pat->newData[i][DIV_PAT_INS]>=e->song.insLen) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INS_ERROR]);
|
||||
} else {
|
||||
DivInstrumentType t=e->song.ins[pat->data[i][2]]->type;
|
||||
DivInstrumentType t=e->song.ins[pat->newData[i][DIV_PAT_INS]]->type;
|
||||
if (t!=DIV_INS_AMIGA && t!=e->getPreferInsType(j)) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INS_WARN]);
|
||||
} else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INS]);
|
||||
}
|
||||
}
|
||||
snprintf(id,63,"%.2X###PI_%d_%d",pat->data[i][2],i,j);
|
||||
snprintf(id,63,"%.2X###PI_%d_%d",pat->newData[i][DIV_PAT_INS],i,j);
|
||||
}
|
||||
ImGui::SameLine(0.0f,0.0f);
|
||||
if (cursorIns) {
|
||||
|
|
@ -278,14 +278,14 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
|
||||
if (e->curSubSong->chanCollapse[j]<2) {
|
||||
// volume
|
||||
if (pat->data[i][3]==-1) {
|
||||
if (pat->newData[i][DIV_PAT_VOL]==-1) {
|
||||
snprintf(id,63,"%.31s###PV_%d_%d",emptyLabel2,i,j);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
|
||||
} else {
|
||||
int volColor=(pat->data[i][3]*127)/chanVolMax;
|
||||
int volColor=(pat->newData[i][DIV_PAT_VOL]*127)/chanVolMax;
|
||||
if (volColor>127) volColor=127;
|
||||
if (volColor<0) volColor=0;
|
||||
snprintf(id,63,"%.2X###PV_%d_%d",pat->data[i][3],i,j);
|
||||
snprintf(id,63,"%.2X###PV_%d_%d",pat->newData[i][DIV_PAT_VOL],i,j);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,volColors[volColor]);
|
||||
}
|
||||
ImGui::SameLine(0.0f,0.0f);
|
||||
|
|
@ -317,26 +317,27 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
if (e->curSubSong->chanCollapse[j]<1) {
|
||||
// effects
|
||||
for (int k=0; k<e->curPat[j].effectCols; k++) {
|
||||
int index=4+(k<<1);
|
||||
bool selectedEffect=selectedRow && (j32+index-1>=sel1XSum && j32+index-1<=sel2XSum);
|
||||
bool selectedEffectVal=selectedRow && (j32+index>=sel1XSum && j32+index<=sel2XSum);
|
||||
bool cursorEffect=(cursor.order==ord && cursor.y==i && cursor.xCoarse==j && cursor.xFine==index-1 && curWindowLast==GUI_WINDOW_PATTERN);
|
||||
bool cursorEffectVal=(cursor.order==ord && cursor.y==i && cursor.xCoarse==j && cursor.xFine==index && curWindowLast==GUI_WINDOW_PATTERN);
|
||||
int index=DIV_PAT_FX(k);
|
||||
int indexVal=DIV_PAT_FXVAL(k);
|
||||
bool selectedEffect=selectedRow && (j32+index>=sel1XSum && j32+index<=sel2XSum);
|
||||
bool selectedEffectVal=selectedRow && (j32+indexVal>=sel1XSum && j32+indexVal<=sel2XSum);
|
||||
bool cursorEffect=(cursor.order==ord && cursor.y==i && cursor.xCoarse==j && cursor.xFine==index && curWindowLast==GUI_WINDOW_PATTERN);
|
||||
bool cursorEffectVal=(cursor.order==ord && cursor.y==i && cursor.xCoarse==j && cursor.xFine==indexVal && curWindowLast==GUI_WINDOW_PATTERN);
|
||||
|
||||
// effect
|
||||
if (pat->data[i][index]==-1) {
|
||||
if (pat->newData[i][index]==-1) {
|
||||
snprintf(id,63,"%.31s###PE%d_%d_%d",emptyLabel2,k,i,j);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
|
||||
} else {
|
||||
if (pat->data[i][index]>0xff) {
|
||||
if (pat->newData[i][index]>0xff) {
|
||||
snprintf(id,63,"??###PE%d_%d_%d",k,i,j);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_EFFECT_INVALID]);
|
||||
} else if (pat->data[i][index]>=0x10 || settings.oneDigitEffects==0) {
|
||||
const unsigned char data=pat->data[i][index];
|
||||
} else if (pat->newData[i][index]>=0x10 || settings.oneDigitEffects==0) {
|
||||
const unsigned char data=pat->newData[i][index];
|
||||
snprintf(id,63,"%.2X###PE%d_%d_%d",data,k,i,j);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[fxColors[data]]);
|
||||
} else {
|
||||
const unsigned char data=pat->data[i][index];
|
||||
const unsigned char data=pat->newData[i][index];
|
||||
snprintf(id,63," %.1X###PE%d_%d_%d",data,k,i,j);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[fxColors[data]]);
|
||||
}
|
||||
|
|
@ -354,10 +355,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
if (selectedEffect) ImGui::PopStyleColor();
|
||||
}
|
||||
if (ImGui::IsItemClicked()) {
|
||||
startSelection(j,index-1,i,ord);
|
||||
startSelection(j,index,i,ord);
|
||||
}
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
||||
updateSelection(j,index-1,i,ord);
|
||||
updateSelection(j,index,i,ord);
|
||||
}
|
||||
if (ImGui::IsItemActive() && CHECK_LONG_HOLD) {
|
||||
ImGui::InhibitInertialScroll();
|
||||
|
|
@ -366,10 +367,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
}
|
||||
|
||||
// effect value
|
||||
if (pat->data[i][index+1]==-1) {
|
||||
if (pat->newData[i][indexVal]==-1) {
|
||||
snprintf(id,63,"%.31s###PF%d_%d_%d",emptyLabel2,k,i,j);
|
||||
} else {
|
||||
snprintf(id,63,"%.2X###PF%d_%d_%d",pat->data[i][index+1],k,i,j);
|
||||
snprintf(id,63,"%.2X###PF%d_%d_%d",pat->newData[i][indexVal],k,i,j);
|
||||
}
|
||||
ImGui::SameLine(0.0f,0.0f);
|
||||
if (cursorEffectVal) {
|
||||
|
|
@ -384,10 +385,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
if (selectedEffectVal) ImGui::PopStyleColor();
|
||||
}
|
||||
if (ImGui::IsItemClicked()) {
|
||||
startSelection(j,index,i,ord);
|
||||
startSelection(j,indexVal,i,ord);
|
||||
}
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) {
|
||||
updateSelection(j,index,i,ord);
|
||||
updateSelection(j,indexVal,i,ord);
|
||||
}
|
||||
if (ImGui::IsItemActive() && CHECK_LONG_HOLD) {
|
||||
ImGui::InhibitInertialScroll();
|
||||
|
|
|
|||
|
|
@ -853,15 +853,6 @@ void FurnaceGUI::drawSettings() {
|
|||
settingsChanged=true;
|
||||
}
|
||||
|
||||
bool newPatternFormatB=settings.newPatternFormat;
|
||||
if (ImGui::Checkbox(_("Use new pattern format when saving"),&newPatternFormatB)) {
|
||||
settings.newPatternFormat=newPatternFormatB;
|
||||
settingsChanged=true;
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip(_("use a packed format which saves space when saving songs.\ndisable if you need compatibility with older Furnace and/or tools\nwhich do not support this format."));
|
||||
}
|
||||
|
||||
bool noDMFCompatB=settings.noDMFCompat;
|
||||
if (ImGui::Checkbox(_("Don't apply compatibility flags when loading .dmf"),&noDMFCompatB)) {
|
||||
settings.noDMFCompat=noDMFCompatB;
|
||||
|
|
@ -4880,7 +4871,6 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
settings.noMaximizeWorkaround=conf.getInt("noMaximizeWorkaround",0);
|
||||
|
||||
settings.compress=conf.getInt("compress",1);
|
||||
settings.newPatternFormat=conf.getInt("newPatternFormat",1);
|
||||
settings.newSongBehavior=conf.getInt("newSongBehavior",0);
|
||||
settings.playOnLoad=conf.getInt("playOnLoad",0);
|
||||
settings.centerPopup=conf.getInt("centerPopup",1);
|
||||
|
|
@ -5348,7 +5338,6 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
clampSetting(settings.iCannotWait,0,1);
|
||||
clampSetting(settings.orderButtonPos,0,2);
|
||||
clampSetting(settings.compress,0,1);
|
||||
clampSetting(settings.newPatternFormat,0,1);
|
||||
clampSetting(settings.renderClearPos,0,1);
|
||||
clampSetting(settings.insertBehavior,0,1);
|
||||
clampSetting(settings.pullDeleteRow,0,1);
|
||||
|
|
@ -5479,7 +5468,6 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
|
|||
conf.set("noMaximizeWorkaround",settings.noMaximizeWorkaround);
|
||||
|
||||
conf.set("compress",settings.compress);
|
||||
conf.set("newPatternFormat",settings.newPatternFormat);
|
||||
conf.set("newSongBehavior",settings.newSongBehavior);
|
||||
conf.set("playOnLoad",settings.playOnLoad);
|
||||
conf.set("centerPopup",settings.centerPopup);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue