GUI: add an audio load chart

This commit is contained in:
tildearrow 2025-03-01 06:10:59 -05:00
parent dd7e1def3d
commit 6dc4f16689
3 changed files with 18 additions and 2 deletions

View file

@ -8569,6 +8569,7 @@ FurnaceGUI::FurnaceGUI():
lastPatternWidth(0.0f),
longThreshold(0.48f),
buttonLongThreshold(0.20f),
lastAudioLoadsPos(0),
latchNote(-1),
latchIns(-2),
latchVol(-1),
@ -8937,6 +8938,8 @@ FurnaceGUI::FurnaceGUI():
memset(keyHit,0,sizeof(float)*DIV_MAX_CHANS);
memset(keyHit1,0,sizeof(float)*DIV_MAX_CHANS);
memset(lastAudioLoads,0,sizeof(float)*120);
memset(pianoKeyHit,0,sizeof(float)*180);
memset(pianoKeyPressed,0,sizeof(bool)*180);

View file

@ -2379,6 +2379,9 @@ class FurnaceGUI {
String nextDesc;
String nextDescName;
float lastAudioLoads[120];
int lastAudioLoadsPos;
OperationMask opMaskDelete, opMaskPullDelete, opMaskInsert, opMaskPaste, opMaskTransposeNote, opMaskTransposeValue;
OperationMask opMaskInterpolate, opMaskFade, opMaskInvertVal, opMaskScale;
OperationMask opMaskRandomize, opMaskFlip, opMaskCollapseExpand;

View file

@ -31,11 +31,21 @@ void FurnaceGUI::drawStats() {
if (ImGui::Begin("Statistics",&statsOpen,globalWinFlags,_("Statistics"))) {
size_t lastProcTime=e->processTime;
double maxGot=1000000000.0*(double)e->getAudioDescGot().bufsize/(double)e->getAudioDescGot().rate;
String procStr=fmt::sprintf("%.1f%%",100.0*((double)lastProcTime/(double)maxGot));
ImGui::AlignTextToFramePadding();
ImGui::Text(_("Audio load"));
ImGui::SameLine();
ImGui::ProgressBar((double)lastProcTime/maxGot,ImVec2(-FLT_MIN,0),procStr.c_str());
ImGui::ProgressBar((double)lastProcTime/maxGot,ImVec2(ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize("100.0%").x,0),"");
ImGui::SameLine();
ImGui::Text("%.1f%%",100.0*((double)lastProcTime/(double)maxGot));
if (ImGui::GetContentRegionAvail().y>8.0f*dpiScale) {
// draw a chart
lastAudioLoads[lastAudioLoadsPos]=(double)lastProcTime/maxGot;
if (++lastAudioLoadsPos>=120) lastAudioLoadsPos=0;
ImGui::PushStyleColor(ImGuiCol_FrameBg,ImVec4(0,0,0,0));
ImGui::PlotLines("##ALChart",lastAudioLoads,120,lastAudioLoadsPos,NULL,0.0f,1.0f,ImGui::GetContentRegionAvail());
ImGui::PopStyleColor();
}
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_STATS;
ImGui::End();