GUI: prepare improvements in the sample editor

This commit is contained in:
tildearrow 2022-11-26 03:58:19 -05:00
parent a6b2f501d0
commit e8f5c9f5f9
3 changed files with 64 additions and 44 deletions

View file

@ -5845,6 +5845,7 @@ FurnaceGUI::FurnaceGUI():
amplifyVol(100.0), amplifyVol(100.0),
sampleSelStart(-1), sampleSelStart(-1),
sampleSelEnd(-1), sampleSelEnd(-1),
sampleInfo(true),
sampleDragActive(false), sampleDragActive(false),
sampleDragMode(false), sampleDragMode(false),
sampleDrag16(false), sampleDrag16(false),

View file

@ -1590,6 +1590,7 @@ class FurnaceGUI {
int resampleStrat; int resampleStrat;
float amplifyVol; float amplifyVol;
int sampleSelStart, sampleSelEnd; int sampleSelStart, sampleSelEnd;
bool sampleInfo;
bool sampleDragActive, sampleDragMode, sampleDrag16, sampleZoomAuto; bool sampleDragActive, sampleDragMode, sampleDrag16, sampleZoomAuto;
void* sampleDragTarget; void* sampleDragTarget;
ImVec2 sampleDragStart; ImVec2 sampleDragStart;

View file

@ -132,7 +132,42 @@ void FurnaceGUI::drawSampleEdit() {
MARK_MODIFIED; MARK_MODIFIED;
} }
if (ImGui::BeginTable("SampleProps",4,ImGuiTableFlags_SizingStretchSame)) { ImGui::Separator();
if (ImGui::BeginTable("SampleProps",4,ImGuiTableFlags_SizingStretchSame|ImGuiTableFlags_BordersV|ImGuiTableFlags_BordersOuterH)) {
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
ImGui::TableNextColumn();
if (ImGui::Button(sampleInfo?(ICON_FA_CHEVRON_UP "##SECollapse"):(ICON_FA_CHEVRON_DOWN "##SECollapse"))) {
sampleInfo=!sampleInfo;
}
ImGui::SameLine();
ImGui::Text("Info");
ImGui::TableNextColumn();
ImGui::Text("Rate");
ImGui::TableNextColumn();
bool doLoop=(sample->isLoopable());
if (ImGui::Checkbox("Loop",&doLoop)) { MARK_MODIFIED
if (doLoop) {
sample->loop=true;
sample->loopStart=0;
sample->loopEnd=sample->samples;
} else {
sample->loop=false;
sample->loopStart=-1;
sample->loopEnd=sample->samples;
}
updateSampleTex=true;
if (e->getSampleFormatMask()&(1U<<DIV_SAMPLE_DEPTH_BRR)) {
e->renderSamplesP();
}
}
if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) {
ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!");
}
ImGui::TableNextColumn();
ImGui::Text("Chips");
if (sampleInfo) {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("Type"); ImGui::Text("Type");
@ -164,8 +199,7 @@ void FurnaceGUI::drawSampleEdit() {
if (sample->centerRate>65535) sample->centerRate=65535; if (sample->centerRate>65535) sample->centerRate=65535;
} }
ImGui::TableNextColumn(); ImGui::Text("Compat");
ImGui::Text("Compat Rate");
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::InputInt("##SampleRate",&sample->rate,10,200)) { MARK_MODIFIED if (ImGui::InputInt("##SampleRate",&sample->rate,10,200)) { MARK_MODIFIED
@ -174,30 +208,9 @@ void FurnaceGUI::drawSampleEdit() {
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
bool doLoop=(sample->isLoopable()); ImGui::BeginDisabled(!(doLoop || keepLoopAlive));
if (ImGui::Checkbox("Loop",&doLoop)) { MARK_MODIFIED
if (doLoop) {
sample->loop=true;
sample->loopStart=0;
sample->loopEnd=sample->samples;
} else {
sample->loop=false;
sample->loopStart=-1;
sample->loopEnd=sample->samples;
}
updateSampleTex=true;
if (e->getSampleFormatMask()&(1U<<DIV_SAMPLE_DEPTH_BRR)) {
e->renderSamplesP();
}
}
if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) {
ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!");
}
if (doLoop || keepLoopAlive) {
keepLoopAlive=false; keepLoopAlive=false;
ImGui::TableNextRow(); ImGui::Text("Mode");
ImGui::TableNextColumn();
ImGui::Text("Loop Mode");
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::BeginCombo("##SampleLoopMode",loopType.c_str())) { if (ImGui::BeginCombo("##SampleLoopMode",loopType.c_str())) {
@ -213,8 +226,8 @@ void FurnaceGUI::drawSampleEdit() {
} }
ImGui::EndCombo(); ImGui::EndCombo();
} }
ImGui::TableNextColumn();
ImGui::Text("Loop Start"); ImGui::Text("Start");
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::InputInt("##LoopStartPosition",&sample->loopStart,1,16)) { MARK_MODIFIED if (ImGui::InputInt("##LoopStartPosition",&sample->loopStart,1,16)) { MARK_MODIFIED
@ -235,8 +248,8 @@ void FurnaceGUI::drawSampleEdit() {
if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) { if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) {
ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!"); ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!");
} }
ImGui::TableNextColumn();
ImGui::Text("Loop End"); ImGui::Text("End");
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::InputInt("##LoopEndPosition",&sample->loopEnd,1,16)) { MARK_MODIFIED if (ImGui::InputInt("##LoopEndPosition",&sample->loopEnd,1,16)) { MARK_MODIFIED
@ -257,7 +270,12 @@ void FurnaceGUI::drawSampleEdit() {
if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) { if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) {
ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!"); ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!");
} }
ImGui::EndDisabled();
ImGui::TableNextColumn();
ImGui::Text("To-do...");
} }
ImGui::EndTable(); ImGui::EndTable();
} }