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),
sampleSelStart(-1),
sampleSelEnd(-1),
sampleInfo(true),
sampleDragActive(false),
sampleDragMode(false),
sampleDrag16(false),

View File

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

View File

@ -132,7 +132,42 @@ void FurnaceGUI::drawSampleEdit() {
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::TableNextColumn();
ImGui::Text("Type");
@ -164,8 +199,7 @@ void FurnaceGUI::drawSampleEdit() {
if (sample->centerRate>65535) sample->centerRate=65535;
}
ImGui::TableNextColumn();
ImGui::Text("Compat Rate");
ImGui::Text("Compat");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::InputInt("##SampleRate",&sample->rate,10,200)) { MARK_MODIFIED
@ -174,30 +208,9 @@ void FurnaceGUI::drawSampleEdit() {
}
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!");
}
if (doLoop || keepLoopAlive) {
ImGui::BeginDisabled(!(doLoop || keepLoopAlive));
keepLoopAlive=false;
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("Loop Mode");
ImGui::Text("Mode");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::BeginCombo("##SampleLoopMode",loopType.c_str())) {
@ -213,8 +226,8 @@ void FurnaceGUI::drawSampleEdit() {
}
ImGui::EndCombo();
}
ImGui::TableNextColumn();
ImGui::Text("Loop Start");
ImGui::Text("Start");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
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) {
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::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
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) {
ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!");
}
ImGui::EndDisabled();
ImGui::TableNextColumn();
ImGui::Text("To-do...");
}
ImGui::EndTable();
}