From b7973f13db3c57d853530d74ad54415e833b2178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bourdeauducq?= Date: Sat, 28 Dec 2024 19:26:40 +0800 Subject: [PATCH] use 24-bit audio --- sndlock.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sndlock.cpp b/sndlock.cpp index 8fb2ae1..69480e4 100644 --- a/sndlock.cpp +++ b/sndlock.cpp @@ -12,7 +12,7 @@ #include "imgui_impl_glfw.h" #include "imgui_impl_opengl3.h" -#define SND_BITS 16 +#define SND_BITS 24 #define SND_PCHAN 2 #define SND_RCHAN 2 #define SND_RATE 44100 @@ -61,7 +61,7 @@ static void dsp_thread() } uint32_t phase_out[SND_PCHAN] = { 0 }; - int16_t buf_out[SND_BUFLEN*SND_PCHAN]; + int32_t buf_out[SND_BUFLEN*SND_PCHAN]; size_t buf_out_offset = sizeof(buf_out); uint32_t phase_in[SND_PCHAN] = { 0 }; @@ -97,7 +97,7 @@ static void dsp_thread() } if(revents & POLLIN) { - int16_t buf_in[SND_BUFLEN*SND_RCHAN]; + int32_t buf_in[SND_BUFLEN*SND_RCHAN]; size_t read = sio_read(hdl, buf_in, sizeof(buf_in)); // input channels are averaged together to reduce uncorrelated noise double scale = pow(0.5, SND_BITS-1)/SND_RCHAN;