GUI: add nibble mode to randomize
This commit is contained in:
parent
de604bdf01
commit
7971b7323b
|
|
@ -3226,7 +3226,7 @@ void FurnaceGUI::doScale(float top) {
|
||||||
makeUndo(GUI_UNDO_PATTERN_SCALE);
|
makeUndo(GUI_UNDO_PATTERN_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::doRandomize(int bottom, int top) {
|
void FurnaceGUI::doRandomize(int bottom, int top, bool mode) {
|
||||||
finishSelection();
|
finishSelection();
|
||||||
prepareUndo(GUI_UNDO_PATTERN_RANDOMIZE);
|
prepareUndo(GUI_UNDO_PATTERN_RANDOMIZE);
|
||||||
|
|
||||||
|
|
@ -3247,10 +3247,21 @@ void FurnaceGUI::doRandomize(int bottom, int top) {
|
||||||
absoluteTop=e->getMaxVolumeChan(iCoarse);
|
absoluteTop=e->getMaxVolumeChan(iCoarse);
|
||||||
}
|
}
|
||||||
for (int j=selStart.y; j<=selEnd.y; j++) {
|
for (int j=selStart.y; j<=selEnd.y; j++) {
|
||||||
|
int value=0;
|
||||||
|
int value2=0;
|
||||||
if (top-bottom<=0) {
|
if (top-bottom<=0) {
|
||||||
pat->data[j][iFine+1]=MIN(absoluteTop,bottom);
|
value=MIN(absoluteTop,bottom);
|
||||||
|
value2=MIN(absoluteTop,bottom);
|
||||||
} else {
|
} else {
|
||||||
pat->data[j][iFine+1]=MIN(absoluteTop,bottom+(rand()%(top-bottom)));
|
value=MIN(absoluteTop,bottom+(rand()%(top-bottom+1)));
|
||||||
|
value2=MIN(absoluteTop,bottom+(rand()%(top-bottom+1)));
|
||||||
|
}
|
||||||
|
if (mode) {
|
||||||
|
value&=15;
|
||||||
|
value2&=15;
|
||||||
|
pat->data[j][iFine+1]=value|(value2<<4);
|
||||||
|
} else {
|
||||||
|
pat->data[j][iFine+1]=value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4883,17 +4894,34 @@ void FurnaceGUI::editOptions(bool topMenu) {
|
||||||
if (ImGui::BeginMenu("randomize...")) {
|
if (ImGui::BeginMenu("randomize...")) {
|
||||||
if (ImGui::InputInt("Minimum",&randomizeMin,1,1)) {
|
if (ImGui::InputInt("Minimum",&randomizeMin,1,1)) {
|
||||||
if (randomizeMin<0) randomizeMin=0;
|
if (randomizeMin<0) randomizeMin=0;
|
||||||
if (randomizeMin>255) randomizeMin=255;
|
if (randomMode) {
|
||||||
|
if (randomizeMin>15) randomizeMin=15;
|
||||||
|
} else {
|
||||||
|
if (randomizeMin>255) randomizeMin=255;
|
||||||
|
}
|
||||||
if (randomizeMin>randomizeMax) randomizeMin=randomizeMax;
|
if (randomizeMin>randomizeMax) randomizeMin=randomizeMax;
|
||||||
}
|
}
|
||||||
if (ImGui::InputInt("Maximum",&randomizeMax,1,1)) {
|
if (ImGui::InputInt("Maximum",&randomizeMax,1,1)) {
|
||||||
if (randomizeMax<0) randomizeMax=0;
|
if (randomizeMax<0) randomizeMax=0;
|
||||||
if (randomizeMax<randomizeMin) randomizeMax=randomizeMin;
|
if (randomizeMax<randomizeMin) randomizeMax=randomizeMin;
|
||||||
if (randomizeMax>255) randomizeMax=255;
|
if (randomMode) {
|
||||||
|
if (randomizeMax>15) randomizeMax=15;
|
||||||
|
} else {
|
||||||
|
if (randomizeMax>255) randomizeMax=255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ImGui::Checkbox("Nibble mode",&randomMode)) {
|
||||||
|
if (randomMode) {
|
||||||
|
if (randomizeMin>15) randomizeMin=15;
|
||||||
|
if (randomizeMax>15) randomizeMax=15;
|
||||||
|
} else {
|
||||||
|
if (randomizeMin>255) randomizeMin=255;
|
||||||
|
if (randomizeMax>255) randomizeMax=255;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO: add an option to set effect to specific value?
|
// TODO: add an option to set effect to specific value?
|
||||||
if (ImGui::Button("Randomize")) {
|
if (ImGui::Button("Randomize")) {
|
||||||
doRandomize(randomizeMin,randomizeMax);
|
doRandomize(randomizeMin,randomizeMax,randomMode);
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
|
|
@ -6717,6 +6745,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
fadeMax(255),
|
fadeMax(255),
|
||||||
scaleMax(100.0f),
|
scaleMax(100.0f),
|
||||||
fadeMode(false),
|
fadeMode(false),
|
||||||
|
randomMode(false),
|
||||||
oldOrdersLen(0) {
|
oldOrdersLen(0) {
|
||||||
|
|
||||||
// octave 1
|
// octave 1
|
||||||
|
|
|
||||||
|
|
@ -691,7 +691,7 @@ class FurnaceGUI {
|
||||||
int dummyRows, demandX;
|
int dummyRows, demandX;
|
||||||
int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax;
|
int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax;
|
||||||
float scaleMax;
|
float scaleMax;
|
||||||
bool fadeMode;
|
bool fadeMode, randomMode;
|
||||||
|
|
||||||
int oldOrdersLen;
|
int oldOrdersLen;
|
||||||
DivOrders oldOrders;
|
DivOrders oldOrders;
|
||||||
|
|
@ -766,7 +766,7 @@ class FurnaceGUI {
|
||||||
void doFade(int p0, int p1, bool mode);
|
void doFade(int p0, int p1, bool mode);
|
||||||
void doInvertValues();
|
void doInvertValues();
|
||||||
void doScale(float top);
|
void doScale(float top);
|
||||||
void doRandomize(int bottom, int top);
|
void doRandomize(int bottom, int top, bool mode);
|
||||||
void doFlip();
|
void doFlip();
|
||||||
void doCollapse(int divider);
|
void doCollapse(int divider);
|
||||||
void doExpand(int multiplier);
|
void doExpand(int multiplier);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue