Merge branch 'BlastBrothers-compact-sample-editor'
This commit is contained in:
commit
a5339bd37d
|
@ -775,6 +775,7 @@ class FurnaceGUI {
|
||||||
int roundedMenus;
|
int roundedMenus;
|
||||||
int loadJapanese;
|
int loadJapanese;
|
||||||
int fmLayout;
|
int fmLayout;
|
||||||
|
int sampleLayout;
|
||||||
int susPosition;
|
int susPosition;
|
||||||
int effectCursorDir;
|
int effectCursorDir;
|
||||||
int cursorPastePos;
|
int cursorPastePos;
|
||||||
|
@ -838,6 +839,7 @@ class FurnaceGUI {
|
||||||
roundedMenus(0),
|
roundedMenus(0),
|
||||||
loadJapanese(0),
|
loadJapanese(0),
|
||||||
fmLayout(0),
|
fmLayout(0),
|
||||||
|
sampleLayout(0),
|
||||||
susPosition(0),
|
susPosition(0),
|
||||||
effectCursorDir(1),
|
effectCursorDir(1),
|
||||||
cursorPastePos(1),
|
cursorPastePos(1),
|
||||||
|
|
|
@ -50,6 +50,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
sampleType=sampleDepths[sample->depth];
|
sampleType=sampleDepths[sample->depth];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!settings.sampleLayout) {
|
||||||
ImGui::Text("Name");
|
ImGui::Text("Name");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||||
|
@ -555,15 +556,532 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
updateSampleTex=true;
|
updateSampleTex=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ImGui::Text("Name");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||||
|
if (ImGui::InputText("##SampleName",&sample->name)) {
|
||||||
|
MARK_MODIFIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::BeginTable("SampleProps",2,ImGuiTableFlags_SizingStretchSame)) {
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::Text("Type");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||||
|
if (ImGui::BeginCombo("##SampleType",sampleType.c_str())) {
|
||||||
|
for (int i=0; i<17; i++) {
|
||||||
|
if (sampleDepths[i]==NULL) continue;
|
||||||
|
if (ImGui::Selectable(sampleDepths[i])) {
|
||||||
|
sample->prepareUndo(true);
|
||||||
|
sample->depth=i;
|
||||||
|
e->renderSamplesP();
|
||||||
|
updateSampleTex=true;
|
||||||
|
MARK_MODIFIED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::Text("Rate (Hz)");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||||
|
if (ImGui::InputInt("##SampleRate",&sample->rate,10,200)) { MARK_MODIFIED
|
||||||
|
if (sample->rate<100) sample->rate=100;
|
||||||
|
if (sample->rate>96000) sample->rate=96000;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::Text("C-4 (Hz)");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||||
|
if (ImGui::InputInt("##SampleCenter",&sample->centerRate,10,200)) { MARK_MODIFIED
|
||||||
|
if (sample->centerRate<100) sample->centerRate=100;
|
||||||
|
if (sample->centerRate>65535) sample->centerRate=65535;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
bool doLoop=(sample->loopStart>=0);
|
||||||
|
if (ImGui::Checkbox("Loop",&doLoop)) { MARK_MODIFIED
|
||||||
|
if (doLoop) {
|
||||||
|
sample->loopStart=0;
|
||||||
|
} else {
|
||||||
|
sample->loopStart=-1;
|
||||||
|
}
|
||||||
|
updateSampleTex=true;
|
||||||
|
}
|
||||||
|
if (doLoop) {
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||||
|
if (ImGui::InputInt("##LoopPosition",&sample->loopStart,1,10)) { MARK_MODIFIED
|
||||||
|
if (sample->loopStart<0 || sample->loopStart>=(int)sample->samples) {
|
||||||
|
sample->loopStart=0;
|
||||||
|
}
|
||||||
|
updateSampleTex=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (ImGui::Button("Apply")) {
|
||||||
|
e->renderSamplesP();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
*/
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
ImGui::BeginDisabled(sample->depth!=8 && sample->depth!=16);
|
||||||
|
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(!sampleDragMode));
|
||||||
|
if (ImGui::Button(ICON_FA_I_CURSOR "##SSelect")) {
|
||||||
|
sampleDragMode=false;
|
||||||
|
}
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Edit mode: Select");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(sampleDragMode));
|
||||||
|
if (ImGui::Button(ICON_FA_PENCIL "##SDraw")) {
|
||||||
|
sampleDragMode=true;
|
||||||
|
}
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Edit mode: Draw");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Dummy(ImVec2(7.0*dpiScale,dpiScale));
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Button(ICON_FA_ARROWS_H "##SResize");
|
||||||
|
if (ImGui::IsItemClicked()) {
|
||||||
|
resizeSize=sample->samples;
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Resize");
|
||||||
|
}
|
||||||
|
if (openSampleResizeOpt) {
|
||||||
|
openSampleResizeOpt=false;
|
||||||
|
ImGui::OpenPopup("SResizeOpt");
|
||||||
|
}
|
||||||
|
if (ImGui::BeginPopupContextItem("SResizeOpt",ImGuiPopupFlags_MouseButtonLeft)) {
|
||||||
|
if (ImGui::InputInt("Samples",&resizeSize,1,64)) {
|
||||||
|
if (resizeSize<0) resizeSize=0;
|
||||||
|
if (resizeSize>16777215) resizeSize=16777215;
|
||||||
|
}
|
||||||
|
if (ImGui::Button("Resize")) {
|
||||||
|
sample->prepareUndo(true);
|
||||||
|
e->lockEngine([this,sample]() {
|
||||||
|
if (!sample->resize(resizeSize)) {
|
||||||
|
showError("couldn't resize! make sure your sample is 8 or 16-bit.");
|
||||||
|
}
|
||||||
|
e->renderSamples();
|
||||||
|
});
|
||||||
|
updateSampleTex=true;
|
||||||
|
sampleSelStart=-1;
|
||||||
|
sampleSelEnd=-1;
|
||||||
|
MARK_MODIFIED;
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
} else {
|
||||||
|
resizeSize=sample->samples;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Button(ICON_FA_EXPAND "##SResample");
|
||||||
|
if (ImGui::IsItemClicked()) {
|
||||||
|
resampleTarget=sample->rate;
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Resample");
|
||||||
|
}
|
||||||
|
if (openSampleResampleOpt) {
|
||||||
|
openSampleResampleOpt=false;
|
||||||
|
ImGui::OpenPopup("SResampleOpt");
|
||||||
|
}
|
||||||
|
if (ImGui::BeginPopupContextItem("SResampleOpt",ImGuiPopupFlags_MouseButtonLeft)) {
|
||||||
|
ImGui::Text("Rate");
|
||||||
|
if (ImGui::InputDouble("##SRRate",&resampleTarget,1.0,50.0,"%g")) {
|
||||||
|
if (resampleTarget<0) resampleTarget=0;
|
||||||
|
if (resampleTarget>96000) resampleTarget=96000;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("0.5x")) {
|
||||||
|
resampleTarget*=0.5;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("==")) {
|
||||||
|
resampleTarget=sample->rate;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("2.0x")) {
|
||||||
|
resampleTarget*=2.0;
|
||||||
|
}
|
||||||
|
double factor=resampleTarget/(double)sample->rate;
|
||||||
|
if (ImGui::InputDouble("Factor",&factor,0.125,0.5,"%g")) {
|
||||||
|
resampleTarget=(double)sample->rate*factor;
|
||||||
|
if (resampleTarget<0) resampleTarget=0;
|
||||||
|
if (resampleTarget>96000) resampleTarget=96000;
|
||||||
|
}
|
||||||
|
ImGui::Combo("Filter",&resampleStrat,resampleStrats,6);
|
||||||
|
if (ImGui::Button("Resample")) {
|
||||||
|
sample->prepareUndo(true);
|
||||||
|
e->lockEngine([this,sample]() {
|
||||||
|
if (!sample->resample(resampleTarget,resampleStrat)) {
|
||||||
|
showError("couldn't resample! make sure your sample is 8 or 16-bit.");
|
||||||
|
}
|
||||||
|
e->renderSamples();
|
||||||
|
});
|
||||||
|
updateSampleTex=true;
|
||||||
|
sampleSelStart=-1;
|
||||||
|
sampleSelEnd=-1;
|
||||||
|
MARK_MODIFIED;
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
} else {
|
||||||
|
resampleTarget=sample->rate;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Dummy(ImVec2(0.5*dpiScale,dpiScale));
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Button(ICON_FA_INDUSTRY "##SFilter");
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Apply filter");
|
||||||
|
}
|
||||||
|
if (openSampleFilterOpt) {
|
||||||
|
openSampleFilterOpt=false;
|
||||||
|
ImGui::OpenPopup("SFilterOpt");
|
||||||
|
}
|
||||||
|
if (ImGui::BeginPopupContextItem("SFilterOpt",ImGuiPopupFlags_MouseButtonLeft)) {
|
||||||
|
float lowP=sampleFilterL*100.0f;
|
||||||
|
float bandP=sampleFilterB*100.0f;
|
||||||
|
float highP=sampleFilterH*100.0f;
|
||||||
|
float resP=sampleFilterRes*100.0f;
|
||||||
|
ImGui::Text("Cutoff:");
|
||||||
|
if (ImGui::SliderFloat("From",&sampleFilterCutStart,0.0f,sample->rate*0.5,"%.0fHz")) {
|
||||||
|
if (sampleFilterCutStart<0.0) sampleFilterCutStart=0.0;
|
||||||
|
if (sampleFilterCutStart>sample->rate*0.5) sampleFilterCutStart=sample->rate*0.5;
|
||||||
|
}
|
||||||
|
if (ImGui::SliderFloat("To",&sampleFilterCutEnd,0.0f,sample->rate*0.5,"%.0fHz")) {
|
||||||
|
if (sampleFilterCutEnd<0.0) sampleFilterCutEnd=0.0;
|
||||||
|
if (sampleFilterCutEnd>sample->rate*0.5) sampleFilterCutEnd=sample->rate*0.5;
|
||||||
|
}
|
||||||
|
ImGui::Separator();
|
||||||
|
if (ImGui::SliderFloat("Resonance",&resP,0.0f,99.0f,"%.1f%%")) {
|
||||||
|
sampleFilterRes=resP/100.0f;
|
||||||
|
if (sampleFilterRes<0.0f) sampleFilterRes=0.0f;
|
||||||
|
if (sampleFilterRes>0.99f) sampleFilterRes=0.99f;
|
||||||
|
}
|
||||||
|
ImGui::Text("Power");
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::RadioButton("1x",sampleFilterPower==1)) {
|
||||||
|
sampleFilterPower=1;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::RadioButton("2x",sampleFilterPower==2)) {
|
||||||
|
sampleFilterPower=2;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::RadioButton("3x",sampleFilterPower==3)) {
|
||||||
|
sampleFilterPower=3;
|
||||||
|
}
|
||||||
|
ImGui::Separator();
|
||||||
|
if (ImGui::SliderFloat("Low-pass",&lowP,0.0f,100.0f,"%.1f%%")) {
|
||||||
|
sampleFilterL=lowP/100.0f;
|
||||||
|
if (sampleFilterL<0.0f) sampleFilterL=0.0f;
|
||||||
|
if (sampleFilterL>1.0f) sampleFilterL=1.0f;
|
||||||
|
}
|
||||||
|
if (ImGui::SliderFloat("Band-pass",&bandP,0.0f,100.0f,"%.1f%%")) {
|
||||||
|
sampleFilterB=bandP/100.0f;
|
||||||
|
if (sampleFilterB<0.0f) sampleFilterB=0.0f;
|
||||||
|
if (sampleFilterB>1.0f) sampleFilterB=1.0f;
|
||||||
|
}
|
||||||
|
if (ImGui::SliderFloat("High-pass",&highP,0.0f,100.0f,"%.1f%%")) {
|
||||||
|
sampleFilterH=highP/100.0f;
|
||||||
|
if (sampleFilterH<0.0f) sampleFilterH=0.0f;
|
||||||
|
if (sampleFilterH>1.0f) sampleFilterH=1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Apply")) {
|
||||||
|
sample->prepareUndo(true);
|
||||||
|
e->lockEngine([this,sample]() {
|
||||||
|
SAMPLE_OP_BEGIN;
|
||||||
|
float res=1.0-pow(sampleFilterRes,0.5f);
|
||||||
|
float low=0;
|
||||||
|
float band=0;
|
||||||
|
float high=0;
|
||||||
|
|
||||||
|
double power=(sampleFilterCutStart>sampleFilterCutEnd)?0.5:2.0;
|
||||||
|
|
||||||
|
if (sample->depth==16) {
|
||||||
|
for (unsigned int i=start; i<end; i++) {
|
||||||
|
double freq=sampleFilterCutStart+(sampleFilterCutEnd-sampleFilterCutStart)*pow(double(i-start)/double(end-start),power);
|
||||||
|
double cut=sin((freq/double(sample->rate))*M_PI);
|
||||||
|
|
||||||
|
for (int j=0; j<sampleFilterPower; j++) {
|
||||||
|
low=low+cut*band;
|
||||||
|
high=float(sample->data16[i])-low-(res*band);
|
||||||
|
band=cut*high+band;
|
||||||
|
}
|
||||||
|
|
||||||
|
float val=low*sampleFilterL+band*sampleFilterB+high*sampleFilterH;
|
||||||
|
if (val<-32768) val=-32768;
|
||||||
|
if (val>32767) val=32767;
|
||||||
|
sample->data16[i]=val;
|
||||||
|
}
|
||||||
|
} else if (sample->depth==8) {
|
||||||
|
for (unsigned int i=start; i<end; i++) {
|
||||||
|
double freq=sampleFilterCutStart+(sampleFilterCutEnd-sampleFilterCutStart)*pow(double(i-start)/double(end-start),power);
|
||||||
|
double cut=sin((freq/double(sample->rate))*M_PI);
|
||||||
|
|
||||||
|
for (int j=0; j<sampleFilterPower; j++) {
|
||||||
|
low=low+cut*band;
|
||||||
|
high=float(sample->data8[i])-low-(res*band);
|
||||||
|
band=cut*high+band;
|
||||||
|
}
|
||||||
|
|
||||||
|
float val=low*sampleFilterL+band*sampleFilterB+high*sampleFilterH;
|
||||||
|
if (val<-128) val=-128;
|
||||||
|
if (val>127) val=127;
|
||||||
|
sample->data8[i]=val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSampleTex=true;
|
||||||
|
|
||||||
|
e->renderSamples();
|
||||||
|
});
|
||||||
|
MARK_MODIFIED;
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Dummy(ImVec2(0.5*dpiScale,dpiScale));
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
|
||||||
|
ImGui::Button(ICON_FA_VOLUME_UP "##SAmplify");
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Amplify");
|
||||||
|
}
|
||||||
|
if (openSampleAmplifyOpt) {
|
||||||
|
openSampleAmplifyOpt=false;
|
||||||
|
ImGui::OpenPopup("SAmplifyOpt");
|
||||||
|
}
|
||||||
|
if (ImGui::BeginPopupContextItem("SAmplifyOpt",ImGuiPopupFlags_MouseButtonLeft)) {
|
||||||
|
ImGui::Text("Volume");
|
||||||
|
if (ImGui::InputFloat("##SRVolume",&lifyVol,10.0,50.0,"%g%%")) {
|
||||||
|
if (amplifyVol<0) amplifyVol=0;
|
||||||
|
if (amplifyVol>10000) amplifyVol=10000;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("(%.1fdB)",20.0*log10(amplifyVol/100.0f));
|
||||||
|
if (ImGui::Button("Apply")) {
|
||||||
|
sample->prepareUndo(true);
|
||||||
|
e->lockEngine([this,sample]() {
|
||||||
|
SAMPLE_OP_BEGIN;
|
||||||
|
float vol=amplifyVol/100.0f;
|
||||||
|
|
||||||
|
if (sample->depth==16) {
|
||||||
|
for (unsigned int i=start; i<end; i++) {
|
||||||
|
float val=sample->data16[i]*vol;
|
||||||
|
if (val<-32768) val=-32768;
|
||||||
|
if (val>32767) val=32767;
|
||||||
|
sample->data16[i]=val;
|
||||||
|
}
|
||||||
|
} else if (sample->depth==8) {
|
||||||
|
for (unsigned int i=start; i<end; i++) {
|
||||||
|
float val=sample->data8[i]*vol;
|
||||||
|
if (val<-128) val=-128;
|
||||||
|
if (val>127) val=127;
|
||||||
|
sample->data8[i]=val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSampleTex=true;
|
||||||
|
|
||||||
|
e->renderSamples();
|
||||||
|
});
|
||||||
|
MARK_MODIFIED;
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_ARROWS_V "##SNormalize")) {
|
||||||
|
doAction(GUI_ACTION_SAMPLE_NORMALIZE);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Normalize");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_ARROW_UP "##SFadeIn")) {
|
||||||
|
doAction(GUI_ACTION_SAMPLE_FADE_IN);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Fade in");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_ARROW_DOWN "##SFadeOut")) {
|
||||||
|
doAction(GUI_ACTION_SAMPLE_FADE_OUT);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Fade out");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button(ICON_FA_UNDO "##SUndo")) {
|
||||||
|
doUndoSample();
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Undo");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_REPEAT "##SRedo")) {
|
||||||
|
doRedoSample();
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Redo");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Dummy(ImVec2(7.0*dpiScale,dpiScale));
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_BACKWARD "##SReverse")) {
|
||||||
|
doAction(GUI_ACTION_SAMPLE_REVERSE);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Reverse");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_SORT_AMOUNT_ASC "##SInvert")) {
|
||||||
|
doAction(GUI_ACTION_SAMPLE_INVERT);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Invert");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Dummy(ImVec2(0.5*dpiScale,dpiScale));
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_LEVEL_DOWN "##SSign")) {
|
||||||
|
doAction(GUI_ACTION_SAMPLE_SIGN);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Signed/unsigned exchange");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Dummy(ImVec2(0.5*dpiScale,dpiScale));
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Button(ICON_FA_ADJUST "##SInsertSilence");
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Insert silence");
|
||||||
|
}
|
||||||
|
if (openSampleSilenceOpt) {
|
||||||
|
openSampleSilenceOpt=false;
|
||||||
|
ImGui::OpenPopup("SSilenceOpt");
|
||||||
|
}
|
||||||
|
if (ImGui::BeginPopupContextItem("SSilenceOpt",ImGuiPopupFlags_MouseButtonLeft)) {
|
||||||
|
if (ImGui::InputInt("Samples",&silenceSize,1,64)) {
|
||||||
|
if (silenceSize<0) silenceSize=0;
|
||||||
|
if (silenceSize>16777215) silenceSize=16777215;
|
||||||
|
}
|
||||||
|
if (ImGui::Button("Resize")) {
|
||||||
|
int pos=(sampleSelStart==-1 || sampleSelStart==sampleSelEnd)?sample->samples:sampleSelStart;
|
||||||
|
sample->prepareUndo(true);
|
||||||
|
e->lockEngine([this,sample,pos]() {
|
||||||
|
if (!sample->insert(pos,silenceSize)) {
|
||||||
|
showError("couldn't insert! make sure your sample is 8 or 16-bit.");
|
||||||
|
}
|
||||||
|
e->renderSamples();
|
||||||
|
});
|
||||||
|
updateSampleTex=true;
|
||||||
|
sampleSelStart=pos;
|
||||||
|
sampleSelEnd=pos+silenceSize;
|
||||||
|
MARK_MODIFIED;
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_ERASER "##SSilence")) {
|
||||||
|
doAction(GUI_ACTION_SAMPLE_SILENCE);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Apply silence");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_TIMES "##SDelete")) {
|
||||||
|
doAction(GUI_ACTION_SAMPLE_DELETE);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Delete");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_CROP "##STrim")) {
|
||||||
|
doAction(GUI_ACTION_SAMPLE_TRIM);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Trim");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button(ICON_FA_PLAY "##PreviewSample")) {
|
||||||
|
e->previewSample(curSample);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Preview sample");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button(ICON_FA_STOP "##StopSample")) {
|
||||||
|
e->stopSamplePreview();
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Stop sample preview");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
double zoomPercent=100.0/sampleZoom;
|
||||||
|
ImGui::Text("Zoom");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(150.0f*dpiScale);
|
||||||
|
if (ImGui::InputDouble("##SZoom",&zoomPercent,5.0,20.0,"%g%%")) {
|
||||||
|
if (zoomPercent>10000.0) zoomPercent=10000.0;
|
||||||
|
if (zoomPercent<1.0) zoomPercent=1.0;
|
||||||
|
sampleZoom=100.0/zoomPercent;
|
||||||
|
if (sampleZoom<0.01) sampleZoom=0.01;
|
||||||
|
sampleZoomAuto=false;
|
||||||
|
updateSampleTex=true;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (sampleZoomAuto) {
|
||||||
|
if (ImGui::Button("100%")) {
|
||||||
|
sampleZoom=1.0;
|
||||||
|
sampleZoomAuto=false;
|
||||||
|
updateSampleTex=true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ImGui::Button("Auto")) {
|
||||||
|
sampleZoomAuto=true;
|
||||||
|
updateSampleTex=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImVec2 avail=ImGui::GetContentRegionAvail();
|
ImVec2 avail=ImGui::GetContentRegionAvail(); // graph size determined here
|
||||||
|
if (ImGui::GetContentRegionAvail().y>(ImGui::GetContentRegionAvail().x*0.5f)) {
|
||||||
|
avail=ImVec2(ImGui::GetContentRegionAvail().x,ImGui::GetContentRegionAvail().x*0.5f);
|
||||||
|
}
|
||||||
avail.y-=ImGui::GetFontSize()+ImGui::GetStyle().ItemSpacing.y+ImGui::GetStyle().ScrollbarSize;
|
avail.y-=ImGui::GetFontSize()+ImGui::GetStyle().ItemSpacing.y+ImGui::GetStyle().ScrollbarSize;
|
||||||
|
if (avail.y<1.0) { // Prevents crash
|
||||||
|
avail.y=1.0;
|
||||||
|
}
|
||||||
|
|
||||||
int availX=avail.x;
|
int availX=avail.x;
|
||||||
int availY=avail.y;
|
int availY=avail.y;
|
||||||
|
|
||||||
|
|
||||||
if (sampleZoomAuto) {
|
if (sampleZoomAuto) {
|
||||||
samplePos=0;
|
samplePos=0;
|
||||||
if (sample->samples<1 || avail.x<=0) {
|
if (sample->samples<1 || avail.x<=0) {
|
||||||
|
@ -805,47 +1323,6 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY()+ImGui::GetStyle().ScrollbarSize);
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY()+ImGui::GetStyle().ScrollbarSize);
|
||||||
ImGui::Text("%s",statusBar.c_str());
|
ImGui::Text("%s",statusBar.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
bool considerations=false;
|
|
||||||
ImGui::Text("notes:");
|
|
||||||
if (sample->loopStart>=0) {
|
|
||||||
considerations=true;
|
|
||||||
ImGui::Text("- sample won't loop on Neo Geo ADPCM-A and X1-010");
|
|
||||||
if (sample->loopStart&1) {
|
|
||||||
ImGui::Text("- sample loop start will be aligned to the nearest even sample on Amiga");
|
|
||||||
}
|
|
||||||
if (sample->loopStart>0) {
|
|
||||||
ImGui::Text("- sample loop start will be ignored on Neo Geo ADPCM-B");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sample->samples&1) {
|
|
||||||
considerations=true;
|
|
||||||
ImGui::Text("- sample length will be aligned to the nearest even sample on Amiga");
|
|
||||||
}
|
|
||||||
if (sample->samples&511) {
|
|
||||||
considerations=true;
|
|
||||||
ImGui::Text("- sample length will be aligned and padded to 512 sample units on Neo Geo ADPCM.");
|
|
||||||
}
|
|
||||||
if (sample->samples&4095) {
|
|
||||||
considerations=true;
|
|
||||||
ImGui::Text("- sample length will be aligned and padded to 4096 sample units on X1-010.");
|
|
||||||
}
|
|
||||||
if (sample->samples>65535) {
|
|
||||||
considerations=true;
|
|
||||||
ImGui::Text("- maximum sample length on Sega PCM and QSound is 65536 samples");
|
|
||||||
}
|
|
||||||
if (sample->samples>131071) {
|
|
||||||
considerations=true;
|
|
||||||
ImGui::Text("- maximum sample length on X1-010 is 131072 samples");
|
|
||||||
}
|
|
||||||
if (sample->samples>2097151) {
|
|
||||||
considerations=true;
|
|
||||||
ImGui::Text("- maximum sample length on Neo Geo ADPCM is 2097152 samples");
|
|
||||||
}
|
|
||||||
if (!considerations) {
|
|
||||||
ImGui::Text("- none");
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_SAMPLE_EDIT;
|
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_SAMPLE_EDIT;
|
||||||
|
|
|
@ -832,6 +832,8 @@ void FurnaceGUI::drawSettings() {
|
||||||
settings.susPosition=1;
|
settings.susPosition=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
bool macroViewB=settings.macroView;
|
bool macroViewB=settings.macroView;
|
||||||
if (ImGui::Checkbox("Classic macro view (standard macros only; deprecated!)",¯oViewB)) {
|
if (ImGui::Checkbox("Classic macro view (standard macros only; deprecated!)",¯oViewB)) {
|
||||||
settings.macroView=macroViewB;
|
settings.macroView=macroViewB;
|
||||||
|
@ -878,6 +880,11 @@ void FurnaceGUI::drawSettings() {
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
bool sampleLayoutB=settings.sampleLayout;
|
||||||
|
if (ImGui::Checkbox("Use compact sample editor",&sampleLayoutB)) {
|
||||||
|
settings.sampleLayout=sampleLayoutB;
|
||||||
|
}
|
||||||
|
|
||||||
bool roundedWindowsB=settings.roundedWindows;
|
bool roundedWindowsB=settings.roundedWindows;
|
||||||
if (ImGui::Checkbox("Rounded window corners",&roundedWindowsB)) {
|
if (ImGui::Checkbox("Rounded window corners",&roundedWindowsB)) {
|
||||||
settings.roundedWindows=roundedWindowsB;
|
settings.roundedWindows=roundedWindowsB;
|
||||||
|
@ -1502,6 +1509,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
settings.roundedMenus=e->getConfInt("roundedMenus",0);
|
settings.roundedMenus=e->getConfInt("roundedMenus",0);
|
||||||
settings.loadJapanese=e->getConfInt("loadJapanese",0);
|
settings.loadJapanese=e->getConfInt("loadJapanese",0);
|
||||||
settings.fmLayout=e->getConfInt("fmLayout",0);
|
settings.fmLayout=e->getConfInt("fmLayout",0);
|
||||||
|
settings.sampleLayout=e->getConfInt("sampleLayout",0);
|
||||||
settings.susPosition=e->getConfInt("susPosition",0);
|
settings.susPosition=e->getConfInt("susPosition",0);
|
||||||
settings.effectCursorDir=e->getConfInt("effectCursorDir",1);
|
settings.effectCursorDir=e->getConfInt("effectCursorDir",1);
|
||||||
settings.cursorPastePos=e->getConfInt("cursorPastePos",1);
|
settings.cursorPastePos=e->getConfInt("cursorPastePos",1);
|
||||||
|
@ -1564,6 +1572,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
clampSetting(settings.titleBarSys,0,1);
|
clampSetting(settings.titleBarSys,0,1);
|
||||||
clampSetting(settings.frameBorders,0,1);
|
clampSetting(settings.frameBorders,0,1);
|
||||||
clampSetting(settings.effectDeletionAltersValue,0,1);
|
clampSetting(settings.effectDeletionAltersValue,0,1);
|
||||||
|
clampSetting(settings.sampleLayout,0,1);
|
||||||
|
|
||||||
// keybinds
|
// keybinds
|
||||||
for (int i=0; i<GUI_ACTION_MAX; i++) {
|
for (int i=0; i<GUI_ACTION_MAX; i++) {
|
||||||
|
@ -1632,6 +1641,7 @@ void FurnaceGUI::commitSettings() {
|
||||||
e->setConf("roundedMenus",settings.roundedMenus);
|
e->setConf("roundedMenus",settings.roundedMenus);
|
||||||
e->setConf("loadJapanese",settings.loadJapanese);
|
e->setConf("loadJapanese",settings.loadJapanese);
|
||||||
e->setConf("fmLayout",settings.fmLayout);
|
e->setConf("fmLayout",settings.fmLayout);
|
||||||
|
e->setConf("sampleLayout",settings.sampleLayout);
|
||||||
e->setConf("susPosition",settings.susPosition);
|
e->setConf("susPosition",settings.susPosition);
|
||||||
e->setConf("effectCursorDir",settings.effectCursorDir);
|
e->setConf("effectCursorDir",settings.effectCursorDir);
|
||||||
e->setConf("cursorPastePos",settings.cursorPastePos);
|
e->setConf("cursorPastePos",settings.cursorPastePos);
|
||||||
|
|
Loading…
Reference in a new issue