From 0ad26b7da76a5c2b6d1eb652c9aeb22740bc10a6 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 17 Jan 2022 22:49:19 +1100 Subject: [PATCH] [client] audio: redraw the graphs if they have been updated --- client/include/app.h | 1 + client/src/app.c | 5 +++++ client/src/audio.c | 2 ++ client/src/overlay/graphs.c | 8 ++++++++ client/src/overlays.h | 1 + 5 files changed, 17 insertions(+) diff --git a/client/include/app.h b/client/include/app.h index 8baa6225..f1e979cb 100644 --- a/client/include/app.h +++ b/client/include/app.h @@ -116,6 +116,7 @@ typedef const char * (*GraphFormatFn)(const char * name, GraphHandle app_registerGraph(const char * name, RingBuffer buffer, float min, float max, GraphFormatFn formatFn); void app_unregisterGraph(GraphHandle handle); +void app_invalidateGraphs(void); void app_overlayConfigRegister(const char * title, void (*callback)(void * udata, int * id), void * udata); diff --git a/client/src/app.c b/client/src/app.c index 74252e46..4dbdc519 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -706,6 +706,11 @@ void app_unregisterGraph(GraphHandle handle) overlayGraph_unregister(handle); } +void app_invalidateGraphs(void) +{ + overlayGraph_invalidate(); +} + void app_registerOverlay(const struct LG_OverlayOps * ops, const void * params) { ASSERT_LG_OVERLAY_VALID(ops); diff --git a/client/src/audio.c b/client/src/audio.c index 78e756bf..53c18845 100644 --- a/client/src/audio.c +++ b/client/src/audio.c @@ -298,4 +298,6 @@ void audio_tick(unsigned long long tickCount) ringbuffer_push(audio.playback.timings, &flatency); LG_UNLOCK(audio.playback.lock); + + app_invalidateGraphs(); } diff --git a/client/src/overlay/graphs.c b/client/src/overlay/graphs.c index 556d3054..630f5a72 100644 --- a/client/src/overlay/graphs.c +++ b/client/src/overlay/graphs.c @@ -241,3 +241,11 @@ void overlayGraph_iterate(void (*callback)(GraphHandle handle, const char * name callback(graph, graph->name, &graph->enabled, udata); ll_unlock(gs.graphs); } + +void overlayGraph_invalidate(void) +{ + if (!gs.show) + return; + + app_invalidateWindow(false); +} diff --git a/client/src/overlays.h b/client/src/overlays.h index f96c1195..6cc899d5 100644 --- a/client/src/overlays.h +++ b/client/src/overlays.h @@ -47,6 +47,7 @@ GraphHandle overlayGraph_register(const char * name, RingBuffer buffer, void overlayGraph_unregister(); void overlayGraph_iterate(void (*callback)(GraphHandle handle, const char * name, bool * enabled, void * udata), void * udata); +void overlayGraph_invalidate(void); void overlayConfig_register(const char * title, void (*callback)(void * udata, int * id), void * udata);