add the remaining deletes, spectrum lines mult by dpiScale
This commit is contained in:
parent
d8d1993a4a
commit
bde9d9a890
4 changed files with 22 additions and 5 deletions
|
|
@ -8611,9 +8611,17 @@ bool FurnaceGUI::finish(bool saveConfig) {
|
|||
delete[] spectrum.in;
|
||||
spectrum.in=NULL;
|
||||
}
|
||||
if (spectrum.plan) {
|
||||
fftw_free(spectrum.plan);
|
||||
spectrum.plan=NULL;
|
||||
}
|
||||
if (spectrum.buffer) {
|
||||
fftw_free(spectrum.buffer);
|
||||
}
|
||||
if (spectrum.plot) {
|
||||
delete[] spectrum.plot;
|
||||
spectrum.plot=NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2757,12 +2757,13 @@ class FurnaceGUI {
|
|||
bool update, running, mono;
|
||||
bool showXGrid, showYGrid, showXScale, showYScale;
|
||||
SpectrumSettings():
|
||||
bins(2048),
|
||||
bins(4096),
|
||||
xZoom(1.0f),
|
||||
xOffset(0.0f),
|
||||
yOffset(0.0f),
|
||||
buffer(NULL),
|
||||
in(NULL),
|
||||
plot(NULL),
|
||||
frequencies({}),
|
||||
update(true),
|
||||
running(false),
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ void FurnaceGUI::drawSpectrum() {
|
|||
dl->AddLine(
|
||||
origin+ImVec2(0,size.y*((float)z/lines-offset)),
|
||||
origin+ImVec2(size.x,size.y*((float)z/lines-offset)),
|
||||
0x55ffffff);
|
||||
0x55ffffff,
|
||||
dpiScale);
|
||||
}
|
||||
}
|
||||
// x grid
|
||||
|
|
@ -104,7 +105,8 @@ void FurnaceGUI::drawSpectrum() {
|
|||
if (spectrum.showXGrid) dl->AddLine(
|
||||
origin+ImVec2(pos,0),
|
||||
origin+ImVec2(pos,size.y),
|
||||
color);
|
||||
color,
|
||||
dpiScale);
|
||||
prevPos=pos;
|
||||
}
|
||||
}
|
||||
|
|
@ -124,6 +126,10 @@ void FurnaceGUI::drawSpectrum() {
|
|||
delete[] spectrum.plot;
|
||||
spectrum.plot=NULL;
|
||||
}
|
||||
if (spectrum.plan) {
|
||||
fftw_free(spectrum.plan);
|
||||
spectrum.plan=NULL;
|
||||
}
|
||||
spectrum.buffer=(fftw_complex*)fftw_malloc(sizeof(fftw_complex)*spectrum.bins);
|
||||
if (!spectrum.buffer) spectrum.running=false;
|
||||
spectrum.in=new double[spectrum.bins];
|
||||
|
|
@ -131,6 +137,7 @@ void FurnaceGUI::drawSpectrum() {
|
|||
spectrum.plot=new ImVec2[spectrum.bins/2];
|
||||
if (!spectrum.plot) spectrum.running=false;
|
||||
spectrum.plan=fftw_plan_dft_r2c_1d(spectrum.bins,spectrum.in,spectrum.buffer,FFTW_ESTIMATE);
|
||||
if (!spectrum.plan) spectrum.running=false;
|
||||
spectrum.frequencies.clear();
|
||||
float freq;
|
||||
float maxRate=e->getAudioDescGot().rate/2;
|
||||
|
|
@ -175,7 +182,7 @@ void FurnaceGUI::drawSpectrum() {
|
|||
spectrum.plot[i].y=origin.y+size.y*(y-spectrum.yOffset);
|
||||
}
|
||||
ImGui::PushClipRect(origin,origin+size,true);
|
||||
dl->AddPolyline(spectrum.plot,count,ImGui::GetColorU32(uiColors[spectrum.mono?GUI_COLOR_OSC_WAVE:GUI_COLOR_OSC_WAVE_CH0+z]),0,1.0f);
|
||||
dl->AddPolyline(spectrum.plot,count,ImGui::GetColorU32(uiColors[spectrum.mono?GUI_COLOR_OSC_WAVE:GUI_COLOR_OSC_WAVE_CH0+z]),0,dpiScale);
|
||||
dl->PathFillConcave(ImGui::GetColorU32(uiColors[spectrum.mono?GUI_COLOR_OSC_WAVE:GUI_COLOR_OSC_WAVE_CH0+z]));
|
||||
ImGui::PopClipRect();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,11 +126,12 @@ void FurnaceGUI::drawTuner() {
|
|||
ImU32 lowColor=ImGui::GetColorU32(uiColors[GUI_COLOR_TUNER_SCALE_LOW]);
|
||||
ImU32 highColor=ImGui::GetColorU32(uiColors[GUI_COLOR_TUNER_SCALE_HIGH]);
|
||||
|
||||
// needle bg
|
||||
ImGui::Dummy(ImVec2(size.x,boxHeight));
|
||||
dl->AddRectFilledMultiColor(origin,origin+ImVec2(size.x/2.0f,boxHeight),highColor,lowColor,lowColor,highColor);
|
||||
dl->AddRectFilledMultiColor(origin+ImVec2(size.x/2.0f,0),origin+ImVec2(size.x,boxHeight),lowColor,highColor,highColor,lowColor);
|
||||
dl->AddLine(origin+ImVec2(size.x/2.0f,0),origin+ImVec2(size.x/2.0f,boxHeight),ImGui::GetColorU32(uiColors[GUI_COLOR_TUNER_NEEDLE]),2.0f*dpiScale);
|
||||
|
||||
// needle
|
||||
float needleX=size.x*(0.5f+cents);
|
||||
dl->AddLine(origin+ImVec2(needleX,boxHeight-needleHeight),origin+ImVec2(needleX,needleHeight),ImGui::GetColorU32(uiColors[GUI_COLOR_TUNER_NEEDLE]),4.0f*dpiScale);
|
||||
// text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue