From 9acf026ed0c148bc03579a6a2159b347ab7cd095 Mon Sep 17 00:00:00 2001 From: torben Date: Tue, 3 Mar 2009 02:38:25 +0000 Subject: [PATCH] [alsa-out] quantize PI controller output around resample_mean git-svn-id: svn+ssh://jackaudio.org/trunk/jack@3385 0c269be4-1314-0410-8aa9-9f06e86f4224 --- tools/alsa_out.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/alsa_out.c b/tools/alsa_out.c index 94ebab6..15bf2cd 100644 --- a/tools/alsa_out.c +++ b/tools/alsa_out.c @@ -389,7 +389,7 @@ int process (jack_nframes_t nframes, void *arg) { smooth_offset = 0.0; current_resample_factor = 1.0 - smooth_offset / (double) catch_factor - offset_integral / (double) catch_factor / (double)catch_factor2; - current_resample_factor = floor( current_resample_factor * 100000.0 + 0.5 ) / 100000.0; + current_resample_factor = floor( (current_resample_factor - resample_mean) * 10000.0 + 0.5 ) / 10000.0 + resample_mean; //current_resample_factor -= offset_integral / (double) nframes / (double)10000000 / (double) catch_factor; //current_resample_factor -= pow(smooth_offset/ (double) nframes, 3) / (double) catch_factor; @@ -437,7 +437,7 @@ int process (jack_nframes_t nframes, void *arg) { outbuf = alloca( rlen * sizeof( ALSASAMPLE ) * num_channels ); floatbuf = alloca( rlen * sizeof( float ) ); - resampbuf = alloca( nframes * sizeof( float ) ); + resampbuf = alloca( rlen * sizeof( float ) ); /* * render jack ports to the outbuf... */