GUI: sample editor changes
This commit is contained in:
parent
3e997ae886
commit
5e4bfe2f11
|
@ -2125,7 +2125,7 @@ void DivEngine::previewSample(int sample, int note, int pStart, int pEnd) {
|
|||
blip_clear(samp_bb);
|
||||
double rate=song.sample[sample]->rate;
|
||||
if (note>=0) {
|
||||
rate=(song.tuning*pow(2.0,(double)(note+3)/12.0)*((double)song.sample[sample]->centerRate/8363.0));
|
||||
rate=(pow(2.0,(double)(note)/12.0)*((double)song.sample[sample]->centerRate)*0.0625);
|
||||
if (rate<=0) rate=song.sample[sample]->rate;
|
||||
}
|
||||
if (rate<100) rate=100;
|
||||
|
|
|
@ -217,6 +217,15 @@ enum FurnaceGUIColors {
|
|||
GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY,
|
||||
GUI_COLOR_PATTERN_EFFECT_MISC,
|
||||
|
||||
GUI_COLOR_SAMPLE_BG,
|
||||
GUI_COLOR_SAMPLE_FG,
|
||||
GUI_COLOR_SAMPLE_LOOP,
|
||||
GUI_COLOR_SAMPLE_CENTER,
|
||||
GUI_COLOR_SAMPLE_GRID,
|
||||
GUI_COLOR_SAMPLE_SEL,
|
||||
GUI_COLOR_SAMPLE_SEL_POINT,
|
||||
GUI_COLOR_SAMPLE_NEEDLE,
|
||||
|
||||
GUI_COLOR_PAT_MANAGER_NULL,
|
||||
GUI_COLOR_PAT_MANAGER_USED,
|
||||
GUI_COLOR_PAT_MANAGER_OVERUSED,
|
||||
|
|
|
@ -846,6 +846,15 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
|
|||
D(GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY,"",ImVec4(0.0f,1.0f,0.5f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_EFFECT_MISC,"",ImVec4(0.3f,0.3f,1.0f,1.0f)),
|
||||
|
||||
D(GUI_COLOR_SAMPLE_BG,"",ImVec4(0.04f,0.13f,0.2f,1.0f)),
|
||||
D(GUI_COLOR_SAMPLE_FG,"",ImVec4(0.7f,0.7f,0.7f,1.0f)),
|
||||
D(GUI_COLOR_SAMPLE_LOOP,"",ImVec4(0.1f,0.22f,0.35f,1.0f)),
|
||||
D(GUI_COLOR_SAMPLE_CENTER,"",ImVec4(0.2f,0.2f,0.2f,1.0f)),
|
||||
D(GUI_COLOR_SAMPLE_GRID,"",ImVec4(0.1f,0.1f,0.15f,1.0f)),
|
||||
D(GUI_COLOR_SAMPLE_SEL,"",ImVec4(0.26f,0.59f,0.98f,0.25f)),
|
||||
D(GUI_COLOR_SAMPLE_SEL_POINT,"",ImVec4(0.06f,0.53f,0.98f,0.5f)),
|
||||
D(GUI_COLOR_SAMPLE_NEEDLE,"",ImVec4(1.0f,0.8f,0.0f,1.0f)),
|
||||
|
||||
D(GUI_COLOR_PAT_MANAGER_NULL,"",ImVec4(0.15f,0.15f,0.15f,1.0f)),
|
||||
D(GUI_COLOR_PAT_MANAGER_USED,"",ImVec4(0.15f,1.0f,0.15f,1.0f)),
|
||||
D(GUI_COLOR_PAT_MANAGER_OVERUSED,"",ImVec4(1.0f,1.0f,0.15f,1.0f)),
|
||||
|
|
|
@ -1231,10 +1231,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);
|
||||
|
@ -1443,6 +1443,39 @@ 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) {
|
||||
|
@ -1458,10 +1491,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;
|
||||
|
|
|
@ -1773,6 +1773,17 @@ void FurnaceGUI::drawSettings() {
|
|||
UI_COLOR_CONFIG(GUI_COLOR_EE_VALUE,"External command output");
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Sample Editor")) {
|
||||
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_BG,"Background");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_FG,"Waveform");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_LOOP,"Loop region");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CENTER,"Center guide");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_GRID,"Grid");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_SEL,"Selection");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_SEL_POINT,"Selection points");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_NEEDLE,"Preview needle");
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Pattern Manager")) {
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_NULL,"Unallocated");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_UNUSED,"Unused");
|
||||
|
|
Loading…
Reference in New Issue