tidy up GUI a little, add plot scale slider

This commit is contained in:
Sébastien Bourdeauducq 2025-01-01 10:49:28 +08:00
parent 92ae6ae23c
commit 14c0b2919f

View File

@ -201,6 +201,9 @@ int main(int argc, char* argv[])
std::atexit(SetShutdown);
bool exit = false;
float plot_scale[SND_PCHAN];
for(int i=0;i<SND_PCHAN;i++)
plot_scale[i] = 0.005f;
while(!exit && !glfwWindowShouldClose(window)) {
glfwPollEvents();
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
@ -217,8 +220,9 @@ int main(int argc, char* argv[])
if(ImGui::CollapsingHeader("Modulation", ImGuiTreeNodeFlags_DefaultOpen)) {
for(int i=0;i<SND_PCHAN;i++) {
ImGui::Text("Channel %d", i);
char str[64];
sprintf(str, "Frequency ch%d", i);
sprintf(str, "frequency##%d", i);
float frequency_l = frequency[i];
ImGui::SliderFloat(str, &frequency_l, 50.0f, 8000.0f);
frequency[i] = frequency_l;
@ -227,15 +231,19 @@ int main(int argc, char* argv[])
if(ImGui::CollapsingHeader("Demodulation", ImGuiTreeNodeFlags_DefaultOpen)) {
for(int i=0;i<SND_PCHAN;i++) {
char str[64];
sprintf(str, "LPF bandwidth ch%d", i);
ImGui::Text("Channel %d", i);
sprintf(str, "LPF BW##%d", i);
float lpf_bandwidth_l = lpf_bandwidth[i];
ImGui::SliderFloat(str, &lpf_bandwidth_l, 0.5f, 200.0f);
lpf_bandwidth[i] = lpf_bandwidth_l;
sprintf(str, "Output ch%d", i);
sprintf(str, "plot scale##%d", i);
ImGui::SliderFloat(str, &plot_scale[i], 0.001f, 0.01f);
sprintf(str, "output##%d", i);
{
std::lock_guard<std::mutex> guard(lpf_hist_mutex);
ImGui::PlotLines(str, lpf_hist[i], 512, 0, 0, -0.0f, 0.01f, ImVec2(0, 200.0f));
ImGui::PlotLines(str, lpf_hist[i], 512, 0, 0, -0.0f, plot_scale[i], ImVec2(0.0f, 200.0f));
}
}
}