more work

This commit is contained in:
tildearrow 2023-12-05 16:59:16 -05:00
parent 041739c5ce
commit 673a2d0f11

View file

@ -1226,9 +1226,9 @@ void FurnaceGUI::drawSampleEdit() {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale)); ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
sameLineMaybe(); sameLineMaybe();
ImGui::Button("Crossfade"); ImGui::Button(ICON_FUR_CROSSFADE "##Crossfade");
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Crossfade loop points."); ImGui::SetTooltip("Crossfade loop points");
} }
if (openSampleCrossFadeOpt) { if (openSampleCrossFadeOpt) {
openSampleCrossFadeOpt=false; openSampleCrossFadeOpt=false;
@ -1248,13 +1248,13 @@ void FurnaceGUI::drawSampleEdit() {
if (sampleCrossFadeLoopLaw>100) sampleCrossFadeLoopLaw=100; if (sampleCrossFadeLoopLaw>100) sampleCrossFadeLoopLaw=100;
} }
if (ImGui::Button("Apply")) { if (ImGui::Button("Apply")) {
if (sampleCrossFadeLoopLength>sample->loopStart){ if (sampleCrossFadeLoopLength>sample->loopStart) {
SAMPLE_WARN(warnLoop,"Crossfade: length would go out of bounds. Aborted..."); SAMPLE_WARN(warnLoop,"Crossfade: length would go out of bounds. Aborted...");
goto done; ImGui::CloseCurrentPopup();
} }
if (sampleCrossFadeLoopLength>(sample->loopEnd-sample->loopStart)) { if (sampleCrossFadeLoopLength>(sample->loopEnd-sample->loopStart)) {
SAMPLE_WARN(warnLoop,"Crossfade: length would overflow loopStart. Try a smaller random value."); SAMPLE_WARN(warnLoop,"Crossfade: length would overflow loopStart. Try a smaller random value.");
goto done; ImGui::CloseCurrentPopup();
} }
sample->prepareUndo(true); sample->prepareUndo(true);
e->lockEngine([this,sample]{ e->lockEngine([this,sample]{
@ -1289,7 +1289,6 @@ void FurnaceGUI::drawSampleEdit() {
e->renderSamples(curSample); e->renderSamples(curSample);
}); });
MARK_MODIFIED; MARK_MODIFIED;
done:
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
ImGui::EndPopup(); ImGui::EndPopup();