GUI: loop start/end hints, part 2

This commit is contained in:
tildearrow 2025-08-17 15:26:53 -05:00
parent fc889771b4
commit 9ce9a84dde
4 changed files with 94 additions and 10 deletions

View file

@ -463,6 +463,7 @@ enum FurnaceGUIColors {
GUI_COLOR_SAMPLE_CHIP_DISABLED,
GUI_COLOR_SAMPLE_CHIP_ENABLED,
GUI_COLOR_SAMPLE_CHIP_WARNING,
GUI_COLOR_SAMPLE_LOOP_HINT,
GUI_COLOR_PAT_MANAGER_NULL,
GUI_COLOR_PAT_MANAGER_USED,

View file

@ -1160,6 +1160,7 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
D(GUI_COLOR_SAMPLE_CHIP_DISABLED,"",ImVec4(0.6f,0.6f,0.6f,1.0f)),
D(GUI_COLOR_SAMPLE_CHIP_ENABLED,"",ImVec4(0.3f,1.0f,0.3f,1.0f)),
D(GUI_COLOR_SAMPLE_CHIP_WARNING,"",ImVec4(1.0f,0.75f,0.3f,1.0f)),
D(GUI_COLOR_SAMPLE_LOOP_HINT,"",ImVec4(1.0f,0.7f,0.0f,0.8f)),
D(GUI_COLOR_PAT_MANAGER_NULL,"",ImVec4(0.15f,0.15f,0.15f,1.0f)),
D(GUI_COLOR_PAT_MANAGER_USED,"",ImVec4(0.15f,1.0f,0.15f,1.0f)),

View file

@ -2042,33 +2042,75 @@ void FurnaceGUI::drawSampleEdit() {
}
dl->PopClipRect();
//bool displayLoopHintsNES=false;
bool displayLoopHintsNES=false;
bool displayLoopHintsSNES=false;
//bool displayLoopHintsAmiga=false;
bool displayLoopHintsAmiga=false;
bool displayLoopHintsGBADMA=false;
for (int i=0; i<e->song.systemLen; i++) {
/*
if (e->song.system[i]==DIV_SYSTEM_NES) {
displayLoopHintsNES=true;
}*/
}
if (e->song.system[i]==DIV_SYSTEM_SNES) {
displayLoopHintsSNES=true;
}
/*if (e->song.system[i]==DIV_SYSTEM_AMIGA) {
if (e->song.system[i]==DIV_SYSTEM_AMIGA || e->song.system[i]==DIV_SYSTEM_C219) {
displayLoopHintsAmiga=true;
}*/
}
if (e->song.system[i]==DIV_SYSTEM_GBA_DMA) {
displayLoopHintsGBADMA=true;
}
}
if (displayLoopStartHints) {
if (displayLoopHintsNES) {
if (sampleZoom<3.0) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {
if (((i+samplePos)&511)==0) {
ImVec2 p1=ImVec2(rectMin.x+((float)i/sampleZoom),rectMin.y);
ImVec2 p2=p1;
p2.y=rectMax.y;
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP_HINT]));
}
}
}
}
if (displayLoopHintsSNES) {
if (sampleZoom<0.5) {
if (sampleZoom<0.75) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {
if (((i+samplePos)&15)==0) {
ImVec2 p1=ImVec2(rectMin.x+((float)i/sampleZoom),rectMin.y);
ImVec2 p2=p1;
p2.y=rectMax.y;
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_NEEDLE]));
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP_HINT]));
}
}
}
}
if (displayLoopHintsAmiga) {
if (sampleZoom<0.35) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {
if (((i+samplePos)&1)==0) {
ImVec2 p1=ImVec2(rectMin.x+((float)i/sampleZoom),rectMin.y);
ImVec2 p2=p1;
p2.y=rectMax.y;
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP_HINT]));
}
}
}
}
if (displayLoopHintsGBADMA) {
if (sampleZoom<0.6) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {
if (((i+samplePos)&3)==0) {
ImVec2 p1=ImVec2(rectMin.x+((float)i/sampleZoom),rectMin.y);
ImVec2 p2=p1;
p2.y=rectMax.y;
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP_HINT]));
}
}
}
@ -2076,15 +2118,54 @@ void FurnaceGUI::drawSampleEdit() {
}
if (displayLoopEndHints) {
if (displayLoopHintsNES) {
if (sampleZoom<3.0) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {
if (((i+samplePos-8)&128)==0) {
ImVec2 p1=ImVec2(rectMin.x+((float)i/sampleZoom),rectMin.y);
ImVec2 p2=p1;
p2.y=rectMax.y;
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP_HINT]));
}
}
}
}
if (displayLoopHintsSNES) {
if (sampleZoom<0.5) {
if (sampleZoom<0.75) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {
if (((i+samplePos)&15)==0) {
ImVec2 p1=ImVec2(rectMin.x+((float)i/sampleZoom),rectMin.y);
ImVec2 p2=p1;
p2.y=rectMax.y;
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_NEEDLE]));
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP_HINT]));
}
}
}
}
if (displayLoopHintsAmiga) {
if (sampleZoom<0.35) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {
if (((i+samplePos)&1)==0) {
ImVec2 p1=ImVec2(rectMin.x+((float)i/sampleZoom),rectMin.y);
ImVec2 p2=p1;
p2.y=rectMax.y;
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP_HINT]));
}
}
}
}
if (displayLoopHintsGBADMA) {
if (sampleZoom<0.6) {
for (int i=0; i<(int)(sampleZoom*avail.x); i++) {
if (((i+samplePos-sample->loopStart)&15)==0) {
ImVec2 p1=ImVec2(rectMin.x+((float)i/sampleZoom),rectMin.y);
ImVec2 p2=p1;
p2.y=rectMax.y;
dl->AddLine(p1,p2,ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP_HINT]));
}
}
}

View file

@ -4287,6 +4287,7 @@ void FurnaceGUI::drawSettings() {
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_NEEDLE,_("Preview needle"));
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_NEEDLE_PLAYING,_("Playing needles"));
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_LOOP_POINT,_("Loop markers"));
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_LOOP_HINT,_("Valid loop position hints"));
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_DISABLED,_("Chip select: disabled"));
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_ENABLED,_("Chip select: enabled"));
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_WARNING,_("Chip select: enabled (failure)"));