On Tuesday, 7 January 2014, 22:56, j rocket <dogrocket2...@yahoo.com> wrote:

Steven,  I dont know if this is any help to you but heres a link to a website 
with c++ code that explains audio passthru.. 
One of the statements in the code example says this
If SND_PCM_NONBLOCK is used, read / write access to the    */
    /* PCM device will return immediately. If SND_PCM_ASYNC is   
*/
    /* specified, SIGIO will be emitted whenever a period has     */
    /* been completely processed by the soundcard.     


heres link, to get code click on getting exersize materials at top.
http://www.elinux.org/EBC_Exercise_17_Using_ALSA_for_Audio_Processing

Jay




On Tuesday, January 7, 2014 8:05 AM, Max Kellermann <m...@duempel.org> wrote:

On 2014/01/07 13:59, Steven OBrien <steven_obri...@yahoo.co.uk> wrote:
> Since my last update, I've been thinking that the alsa poll is
> really just a timer, it fires every time a fixed number of frames
> have been written to its internal buffer, and as a real-time stream
> this equates to a fixed number of milli-seconds. So the MPD code
> would be much simpler if we could just use a TimeoutMonitor to
> produce the wake-up instead of trying to integrate with the alsa lib
> here.

No, bad idea, because you never know when exactly the data will be
available. 
What if you wake up too early?  Or too late?

The only way to do it properly is let the audio device do the timing,
and follow that.  The audio device is the authority here.  Guessing
when it will deliver is error prone.


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

The high CPU load in the Alsa input plugin was caused by a mistake in the alsa 
software parameters configuration. Clearly I misunderstood what this particular 
setting was for. The attached patch simply removes the setting of that 
parameter and now the plugin runs very smoothly for me with ~0.3% CPU load.
Thanks
Steven
From aa93a8edb8e4a93cd5a199a35f24b06a83836fa8 Mon Sep 17 00:00:00 2001
From: Steven O'Brien <steven_obri...@yahoo.co.uk>
Date: Wed, 8 Jan 2014 12:52:39 +0000
Subject: [PATCH] input/AlsaInputPlugin: remove unnecessary alsa s/w param
 setting to fix high CPU load issue

---
 src/input/AlsaInputPlugin.cxx | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/src/input/AlsaInputPlugin.cxx b/src/input/AlsaInputPlugin.cxx
index 5aa0a69..9990091 100644
--- a/src/input/AlsaInputPlugin.cxx
+++ b/src/input/AlsaInputPlugin.cxx
@@ -364,15 +364,6 @@ AlsaInputStream::OpenDevice(const char *device,
 		return nullptr;
 	}
 
-	if ((err = snd_pcm_sw_params_set_period_event(capture_handle, sw_params,
-						      1)) < 0) {
-		error.Format(alsa_input_domain,
-			     "unable to set period event (%s)", snd_strerror(err));
-		snd_pcm_sw_params_free(sw_params);
-		snd_pcm_close(capture_handle);
-		return nullptr;
-	}
-
 	if ((err = snd_pcm_sw_params(capture_handle, sw_params)) < 0) {
 		error.Format(alsa_input_domain,
 			     "unable to install sw params (%s)", snd_strerror(err));
-- 
1.8.3.2

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to