more work
This commit is contained in:
parent
bf212779a7
commit
02bc89f8cb
|
@ -1226,7 +1226,7 @@ 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(ICON_FUR_CROSSFADE "##Crossfade");
|
ImGui::Button(ICON_FUR_CROSSFADE "##CrossFade");
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Crossfade loop points");
|
ImGui::SetTooltip("Crossfade loop points");
|
||||||
}
|
}
|
||||||
|
@ -1249,13 +1249,12 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
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...");
|
showError("Crossfade: length would go out of bounds. Aborted...");
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
} else if (sampleCrossFadeLoopLength>(sample->loopEnd-sample->loopStart)) {
|
||||||
if (sampleCrossFadeLoopLength>(sample->loopEnd-sample->loopStart)) {
|
showError("Crossfade: length would overflow loopStart. Try a smaller random value.");
|
||||||
SAMPLE_WARN(warnLoop,"Crossfade: length would overflow loopStart. Try a smaller random value.");
|
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
} else {
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
e->lockEngine([this,sample] {
|
e->lockEngine([this,sample] {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
@ -1265,8 +1264,8 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
unsigned int crossFadeInput=sample->loopStart-sampleCrossFadeLoopLength;
|
unsigned int crossFadeInput=sample->loopStart-sampleCrossFadeLoopLength;
|
||||||
unsigned int crossFadeOutput=sample->loopEnd-sampleCrossFadeLoopLength;
|
unsigned int crossFadeOutput=sample->loopEnd-sampleCrossFadeLoopLength;
|
||||||
for (int i=0; i<sampleCrossFadeLoopLength; i++) {
|
for (int i=0; i<sampleCrossFadeLoopLength; i++) {
|
||||||
double f1=std::pow(i*l,evar);
|
double f1=pow(i*l,evar);
|
||||||
double f2=std::pow((sampleCrossFadeLoopLength-i)*l, evar);
|
double f2=pow((sampleCrossFadeLoopLength-i)*l,evar);
|
||||||
signed char out=(signed char)(((double)sample->data8[crossFadeInput])*f1+((double)sample->data8[crossFadeOutput])*f2);
|
signed char out=(signed char)(((double)sample->data8[crossFadeInput])*f1+((double)sample->data8[crossFadeOutput])*f2);
|
||||||
sample->data8[crossFadeOutput]=out;
|
sample->data8[crossFadeOutput]=out;
|
||||||
crossFadeInput++;
|
crossFadeInput++;
|
||||||
|
@ -1291,6 +1290,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
MARK_MODIFIED;
|
MARK_MODIFIED;
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
Loading…
Reference in a new issue