Move renderSamples() to DivDispatch implementations.

To prevent rendering samples for systems that are not in use.

Additionally, it gives the systems more flexibility to render the samples
according to their specific configuration.
This commit is contained in:
Laurens Holst 2022-05-01 19:57:44 +02:00
parent 58fe971a3c
commit 7f0074511c
16 changed files with 327 additions and 219 deletions

View file

@ -28,22 +28,17 @@ void FurnaceGUI::drawStats() {
}
if (!statsOpen) return;
if (ImGui::Begin("Statistics",&statsOpen)) {
String adpcmAUsage=fmt::sprintf("%d/16384KB",e->adpcmAMemLen/1024);
String adpcmBUsage=fmt::sprintf("%d/16384KB",e->adpcmBMemLen/1024);
String qsoundUsage=fmt::sprintf("%d/16384KB",e->qsoundMemLen/1024);
String x1_010Usage=fmt::sprintf("%d/1024KB",e->x1_010MemLen/1024);
ImGui::Text("ADPCM-A");
ImGui::SameLine();
ImGui::ProgressBar(((float)e->adpcmAMemLen)/16777216.0f,ImVec2(-FLT_MIN,0),adpcmAUsage.c_str());
ImGui::Text("ADPCM-B");
ImGui::SameLine();
ImGui::ProgressBar(((float)e->adpcmBMemLen)/16777216.0f,ImVec2(-FLT_MIN,0),adpcmBUsage.c_str());
ImGui::Text("QSound");
ImGui::SameLine();
ImGui::ProgressBar(((float)e->qsoundMemLen)/16777216.0f,ImVec2(-FLT_MIN,0),qsoundUsage.c_str());
ImGui::Text("X1-010");
ImGui::SameLine();
ImGui::ProgressBar(((float)e->x1_010MemLen)/1048576.0f,ImVec2(-FLT_MIN,0),x1_010Usage.c_str());
for (int i=0; i<e->song.systemLen; i++) {
DivDispatch* dispatch=e->getDispatch(i);
for (int j=0; dispatch!=NULL && dispatch->getSampleMemCapacity(j)>0; j++) {
size_t capacity=dispatch->getSampleMemCapacity(j);
size_t usage=dispatch->getSampleMemUsage(j);
String usageStr=fmt::sprintf("%d/%dKB",usage/1024,capacity/1024);
ImGui::Text("%s [%d]", e->getSystemName(e->song.system[i]), j);
ImGui::SameLine();
ImGui::ProgressBar(((float)usage)/((float)capacity),ImVec2(-FLT_MIN,0),usageStr.c_str());
}
}
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_STATS;
ImGui::End();