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