diff --git a/sndlock.cpp b/sndlock.cpp index e653f86..b1cdf41 100644 --- a/sndlock.cpp +++ b/sndlock.cpp @@ -18,8 +18,8 @@ #define SND_BUFLEN 4096 static std::atomic shutdown_threads; -static std::atomic frequency[SND_PCHAN]; -static std::atomic lpf_bandwidth[SND_PCHAN]; +static std::atomic frequency[SND_PCHAN]; +static std::atomic lpf_bandwidth[SND_PCHAN]; static std::mutex lpf_hist_mutex; static float lpf_hist[SND_PCHAN][512]; @@ -64,7 +64,7 @@ static void dsp_thread() size_t buf_out_idx = SND_BUFLEN*SND_PCHAN; uint32_t phase_in[SND_PCHAN] = { 0 }; - std::complex lpf_y[SND_PCHAN]; + std::complex lpf_y[SND_PCHAN]; int lpf_count[SND_PCHAN] = { 0 }; nfds_t nfds = sio_nfds(hdl); @@ -75,18 +75,18 @@ static void dsp_thread() int revents = sio_revents(hdl, pfd); uint32_t ftw[SND_PCHAN]; - float lpf_k[SND_PCHAN]; + double lpf_k[SND_PCHAN]; for(int i=0;i rotated; - rotated = (float)buf_in[j]*std::polar(scale, phase_in[i]*2.0f*(float)M_PI/(float)UINT32_MAX); + std::complex rotated; + rotated = (double)buf_in[j]*std::polar(scale, phase_in[i]*2.0*M_PI/(double)UINT32_MAX); phase_in[i] += ftw[i]; // wraps on underflow lpf_y[i] += (rotated - lpf_y[i])*lpf_k[i]; - float mag = std::abs(lpf_y[i]); + double mag = std::abs(lpf_y[i]); lpf_count[i]++; if(lpf_count[i] == 200) { @@ -165,8 +165,8 @@ int main(int argc, char* argv[]) std::atexit(ImGui_ImplOpenGL3_Shutdown); for(int i=0;i