From da1d59670bd56b655b1c62d29a8a0401d9557168 Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Tue, 17 Apr 2012 14:09:17 +0000 Subject: Don’t divide sample rate by number of channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With stereo (two channel) output, the sleep was only allowing just over half a "period" of frames to drain. Reduced processor usage a little bit, from 4.5 percent to 2.6 percent. --- plugins/alsa/alsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/alsa') diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index 3579e9c3..618465b7 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -677,7 +677,7 @@ palsa_thread (void *context) { UNLOCK; int sleeptime = period_size-frames_to_deliver; if (sleeptime > 0 && plugin.fmt.samplerate > 0 && plugin.fmt.channels > 0) { - usleep (sleeptime * 1000 / plugin.fmt.samplerate / plugin.fmt.channels * 1000); + usleep (sleeptime * 1000 / plugin.fmt.samplerate * 1000); } } } -- cgit v1.2.3