Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt
This commit is contained in:
commit
66f7ab688b
23 changed files with 1760 additions and 50 deletions
|
|
@ -121,10 +121,14 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
updateSampleTex=true;
|
||||
}
|
||||
if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) {
|
||||
ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!");
|
||||
}
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Length: %d",sample->samples);
|
||||
if (doLoop) {
|
||||
if (doLoop || keepLoopAlive) {
|
||||
keepLoopAlive=false;
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Loop Mode");
|
||||
|
|
@ -156,6 +160,12 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
updateSampleTex=true;
|
||||
}
|
||||
if (ImGui::IsItemActive()) {
|
||||
keepLoopAlive=true;
|
||||
}
|
||||
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::SameLine();
|
||||
|
|
@ -169,6 +179,12 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
updateSampleTex=true;
|
||||
}
|
||||
if (ImGui::IsItemActive()) {
|
||||
keepLoopAlive=true;
|
||||
}
|
||||
if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) {
|
||||
ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!");
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
|
@ -181,8 +197,6 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
*/
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||
|
||||
pushToggleColors(!sampleDragMode);
|
||||
if (ImGui::Button(ICON_FA_I_CURSOR "##SSelect")) {
|
||||
sampleDragMode=false;
|
||||
|
|
@ -200,6 +214,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Edit mode: Draw");
|
||||
}
|
||||
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||
ImGui::SameLine();
|
||||
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
||||
ImGui::SameLine();
|
||||
|
|
@ -567,6 +582,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::SameLine();
|
||||
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
||||
ImGui::SameLine();
|
||||
|
|
@ -681,10 +697,14 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
updateSampleTex=true;
|
||||
}
|
||||
if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) {
|
||||
ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!");
|
||||
}
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Length: %d",sample->samples);
|
||||
if (doLoop) {
|
||||
if (doLoop || keepLoopAlive) {
|
||||
keepLoopAlive=false;
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("Loop Mode");
|
||||
|
|
@ -717,6 +737,12 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
updateSampleTex=true;
|
||||
}
|
||||
if (ImGui::IsItemActive()) {
|
||||
keepLoopAlive=true;
|
||||
}
|
||||
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::SameLine();
|
||||
|
|
@ -730,6 +756,12 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
updateSampleTex=true;
|
||||
}
|
||||
if (ImGui::IsItemActive()) {
|
||||
keepLoopAlive=true;
|
||||
}
|
||||
if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) {
|
||||
ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!");
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
|
@ -742,8 +774,6 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
*/
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||
|
||||
pushToggleColors(!sampleDragMode);
|
||||
if (ImGui::Button(ICON_FA_I_CURSOR "##SSelect")) {
|
||||
sampleDragMode=false;
|
||||
|
|
@ -761,6 +791,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Edit mode: Draw");
|
||||
}
|
||||
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||
ImGui::SameLine();
|
||||
ImGui::Dummy(ImVec2(7.0*dpiScale,dpiScale));
|
||||
ImGui::SameLine();
|
||||
|
|
@ -1135,6 +1166,8 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
ImGui::SetTooltip("Trim");
|
||||
}
|
||||
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if (ImGui::Button(ICON_FA_PLAY "##PreviewSample")) {
|
||||
e->previewSample(curSample);
|
||||
}
|
||||
|
|
@ -1236,10 +1269,10 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
if (SDL_LockTexture(sampleTex,NULL,(void**)&data,&pitch)!=0) {
|
||||
logE("error while locking sample texture! %s",SDL_GetError());
|
||||
} else {
|
||||
ImU32 bgColor=ImGui::GetColorU32(ImGuiCol_FrameBg);
|
||||
ImU32 bgColorLoop=ImAlphaBlendColors(bgColor,ImGui::GetColorU32(ImGuiCol_FrameBgHovered,0.5));
|
||||
ImU32 lineColor=ImGui::GetColorU32(ImGuiCol_PlotLines);
|
||||
ImU32 centerLineColor=ImAlphaBlendColors(bgColor,ImGui::GetColorU32(ImGuiCol_PlotLines,0.25));
|
||||
ImU32 bgColor=ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_BG]);
|
||||
ImU32 bgColorLoop=ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_LOOP]);
|
||||
ImU32 lineColor=ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_FG]);
|
||||
ImU32 centerLineColor=ImGui::GetColorU32(uiColors[GUI_COLOR_SAMPLE_CENTER]);
|
||||
for (int i=0; i<availY; i++) {
|
||||
for (int j=0; j<availX; j++) {
|
||||
int scaledPos=samplePos+(j*sampleZoom);
|
||||
|
|
@ -1314,11 +1347,23 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
sampleSelStart=0;
|
||||
sampleSelEnd=sample->samples;
|
||||
} else {
|
||||
if (sample->samples>0 && (sample->depth==DIV_SAMPLE_DEPTH_16BIT || sample->depth==DIV_SAMPLE_DEPTH_8BIT)) {
|
||||
if (sample->samples>0) {
|
||||
sampleDragStart=rectMin;
|
||||
sampleDragAreaSize=rectSize;
|
||||
sampleDrag16=(sample->depth==DIV_SAMPLE_DEPTH_16BIT);
|
||||
sampleDragTarget=(sample->depth==DIV_SAMPLE_DEPTH_16BIT)?((void*)sample->data16):((void*)sample->data8);
|
||||
switch (sample->depth) {
|
||||
case DIV_SAMPLE_DEPTH_8BIT:
|
||||
sampleDrag16=false;
|
||||
sampleDragTarget=(void*)sample->data8;
|
||||
break;
|
||||
case DIV_SAMPLE_DEPTH_16BIT:
|
||||
sampleDrag16=true;
|
||||
sampleDragTarget=(void*)sample->data16;
|
||||
break;
|
||||
default:
|
||||
sampleDrag16=true;
|
||||
sampleDragTarget=NULL;
|
||||
break;
|
||||
}
|
||||
sampleDragLen=sample->samples;
|
||||
sampleDragActive=true;
|
||||
sampleSelStart=-1;
|
||||
|
|
@ -1334,12 +1379,15 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
|
||||
if (ImGui::BeginPopup("SRightClick",ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||
if (ImGui::MenuItem("cut",BIND_FOR(GUI_ACTION_SAMPLE_CUT))) {
|
||||
doAction(GUI_ACTION_SAMPLE_CUT);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
if (ImGui::MenuItem("copy",BIND_FOR(GUI_ACTION_SAMPLE_COPY))) {
|
||||
doAction(GUI_ACTION_SAMPLE_COPY);
|
||||
}
|
||||
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||
if (ImGui::MenuItem("paste",BIND_FOR(GUI_ACTION_SAMPLE_PASTE))) {
|
||||
doAction(GUI_ACTION_SAMPLE_PASTE);
|
||||
}
|
||||
|
|
@ -1349,6 +1397,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
if (ImGui::MenuItem("paste (mix)",BIND_FOR(GUI_ACTION_SAMPLE_PASTE_MIX))) {
|
||||
doAction(GUI_ACTION_SAMPLE_PASTE_MIX);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
if (ImGui::MenuItem("select all",BIND_FOR(GUI_ACTION_SAMPLE_SELECT_ALL))) {
|
||||
doAction(GUI_ACTION_SAMPLE_SELECT_ALL);
|
||||
}
|
||||
|
|
@ -1374,7 +1423,11 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
end^=start;
|
||||
start^=end;
|
||||
}
|
||||
statusBar+=fmt::sprintf(" (%d-%d)",start,end);
|
||||
if (start==end) {
|
||||
statusBar+=fmt::sprintf(" (%d)",start);
|
||||
} else {
|
||||
statusBar+=fmt::sprintf(" (%d-%d: %d samples)",start,end,end-start);
|
||||
}
|
||||
drawSelection=true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1426,6 +1479,43 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
}
|
||||
|
||||
if (e->isPreviewingSample()) {
|
||||
statusBar+=fmt::sprintf(" | %.2fHz",e->getSamplePreviewRate());
|
||||
|
||||
int start=sampleSelStart;
|
||||
int end=sampleSelEnd;
|
||||
if (start>end) {
|
||||
start^=end;
|
||||
end^=start;
|
||||
start^=end;
|
||||
}
|
||||
ImDrawList* dl=ImGui::GetWindowDrawList();
|
||||
ImVec2 p1=rectMin;
|
||||
p1.x+=(e->getSamplePreviewPos()-samplePos)/sampleZoom;
|
||||
ImVec4 posColor=uiColors[GUI_COLOR_SAMPLE_NEEDLE];
|
||||
ImVec4 posTrail1=posColor;
|
||||
ImVec4 posTrail2=posColor;
|
||||
posTrail1.w*=0.5f;
|
||||
posTrail2.w=0.0f;
|
||||
float trailDistance=(e->getSamplePreviewRate()/100.0f)/sampleZoom;
|
||||
|
||||
if (p1.x<rectMin.x) p1.x=rectMin.x;
|
||||
if (p1.x>rectMax.x) p1.x=rectMax.x;
|
||||
|
||||
ImVec2 p2=p1;
|
||||
p2.y=rectMax.y;
|
||||
|
||||
dl->AddRectFilledMultiColor(
|
||||
ImVec2(p1.x-trailDistance,p1.y),
|
||||
p2,
|
||||
ImGui::GetColorU32(posTrail2),
|
||||
ImGui::GetColorU32(posTrail1),
|
||||
ImGui::GetColorU32(posTrail1),
|
||||
ImGui::GetColorU32(posTrail2)
|
||||
);
|
||||
dl->AddLine(p1,p2,ImGui::GetColorU32(posColor));
|
||||
}
|
||||
|
||||
if (drawSelection) {
|
||||
int start=sampleSelStart;
|
||||
int end=sampleSelEnd;
|
||||
|
|
@ -1439,10 +1529,8 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
p1.x+=(start-samplePos)/sampleZoom;
|
||||
|
||||
ImVec2 p2=ImVec2(rectMin.x+(end-samplePos)/sampleZoom,rectMax.y);
|
||||
ImVec4 boundColor=uiColors[GUI_COLOR_ACCENT_PRIMARY];
|
||||
ImVec4 selColor=uiColors[GUI_COLOR_ACCENT_SECONDARY];
|
||||
boundColor.w*=0.5;
|
||||
selColor.w*=0.25;
|
||||
ImVec4 boundColor=uiColors[GUI_COLOR_SAMPLE_SEL_POINT];
|
||||
ImVec4 selColor=uiColors[GUI_COLOR_SAMPLE_SEL];
|
||||
|
||||
if (p1.x<rectMin.x) p1.x=rectMin.x;
|
||||
if (p1.x>rectMax.x) p1.x=rectMax.x;
|
||||
|
|
@ -1470,11 +1558,9 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
}
|
||||
}
|
||||
|
||||
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) {
|
||||
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT && sampleDragMode) {
|
||||
statusBar="Non-8/16-bit samples cannot be edited without prior conversion.";
|
||||
}
|
||||
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY()+ImGui::GetStyle().ScrollbarSize);
|
||||
ImGui::Text("%s",statusBar.c_str());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue