aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosty <gabriel@bwaaa.monster>2026-05-16 01:54:37 -0400
committerfrosty <gabriel@bwaaa.monster>2026-05-16 01:54:37 -0400
commit28b2df3f6f1291d29ea5c39404675361902da59e (patch)
treedbf5b913f067889b7702cf59d220abd92c4896a5 /src
parentafcb3cf660f0ec3137f7edf470ddeff2ae546726 (diff)
downloadPNDacc-28b2df3f6f1291d29ea5c39404675361902da59e.tar.gz
test: test
Diffstat (limited to 'src')
-rw-r--r--src/Main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Main.c b/src/Main.c
index 71b2580..a578620 100644
--- a/src/Main.c
+++ b/src/Main.c
@@ -52,8 +52,11 @@ int SDLCALL audio_thread_func(void *data) {
for (int i = 0; i < BUFFER_SIZE; i++)
sum_squares += (double)buffer[i] * buffer[i];
float rms = (float)sqrt(sum_squares / BUFFER_SIZE);
+ int speaking = rms > VOLUME_THRESHOLD ? 1 : 0;
atomic_store_float(&shared_rms_bits, rms);
- SDL_SetAtomicInt(&is_speaking, rms > VOLUME_THRESHOLD ? 1 : 0);
+ SDL_SetAtomicInt(&is_speaking, speaking);
+ fprintf(stderr, "[MIC] rms=%-8.2f threshold=%-8.2f %s\n", rms,
+ (float)VOLUME_THRESHOLD, speaking ? "SPEAKING" : "silent ");
}
pa_simple_free(s);
return 0;
@@ -93,6 +96,10 @@ int main(void) {
uint64_t ticks = SDL_GetTicks();
float bob = sinf(ticks * IDLE_BOB_SPEED) * IDLE_BOB_AMP;
float tilt = sinf(ticks * (IDLE_BOB_SPEED * 0.7f)) * IDLE_TILT_AMP;
+ fprintf(stderr,
+ "[VIS] vol_norm=%-5.2f stretch_y=%-5.2f squash_x=%-5.2f bob=%-6.1f "
+ "tilt=%-5.1f\n",
+ volume_norm, stretch_y, squash_x, bob, tilt);
if (tex) {
float img_w, img_h;
SDL_GetTextureSize(tex, &img_w, &img_h);