| Re: [hatari-devel] Gain too low in DmaSnd_LowPassFilter for STE ? | 
[ Thread Index | 
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
] 
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Gain too low in DmaSnd_LowPassFilter for STE ?
- From: David Savinkoff <dsavnkff@xxxxxxxxx>
- Date: Sun, 7 Aug 2016 19:43:17 -0600 (MDT)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telus.net; s=neo;	t=1470620598; bh=D0QA4eGEyOirplbhtX1h2kArcIZ3Nj5HqfVheZkI5Rs=;	h=Date:From:To:In-Reply-To:References:Subject;	b=jp4a+BIBx1zetWg4DMQrDQgERcfQvWjmPnB3XCswZ9wAVB7ctwnoPHCW4pNTMB9iQ	 yJdtPuzL3Gwiz0TPn5P1I+G5tQ4uxU6II3Qwjmm7wf9JqmVnXIpN7jYi1h3xNwWXNf	 ZKSM89XbHmhjf4Av3ZGohw+/mncgo3FByxwDcXG6e15b465ZK3txukTkLaDmAT7rNg	 RFwjxm307jggvKug2x7OLdm/ptcuhFgoELmbyKcU/8ZzjJZKxkOpOiIOzNSddUcCF2	 9uXx4RvxtH5tK1RZbCCgJG/KtSkGrBzbkvq1+JFPNuL1jnAtIHWyCtXT+gAGvHQItf	 AYwUJsB/1w4+A==
- Thread-index: +tbjmxbA3o4D7/XDsuD3fRHJmaYs1VaEPPRq
- Thread-topic: Gain too low in DmaSnd_LowPassFilter for STE ?
Hi,
Here is a patch that may solve the problem (untested).
--- hatari/src/dmaSnd.c	2016-08-06 10:07:17.000000000 -0700
+++ hatari/src/dmaSnd.c	2016-08-07 18:32:07.142586393 -0700
@@ -550,6 +550,11 @@
 			/* Increase freq counter */
 			frameCounter_float += FreqRatio;
 			n = frameCounter_float >> 32;				/* number of samples to skip */
+			if ( n == 0 )						/* advance filter at least once per iteration */
+			{
+				dma.FrameLeft  = DmaSnd_LowPassFilterLeft( (Sint16)MonoByte );
+				dma.FrameRight = DmaSnd_LowPassFilterRight( (Sint16)MonoByte );
+			}
 			while ( n > 0 )						/* pull as many bytes from the FIFO as needed */
 			{
 				MonoByte = DmaSnd_FIFO_PullByte ();
@@ -594,6 +599,11 @@
 			/* Increase freq counter */
 			frameCounter_float += FreqRatio;
 			n = frameCounter_float >> 32;				/* number of samples to skip */
+			if ( n == 0 )						/* advance filter at least once per iteration */
+			{
+				dma.FrameLeft  = DmaSnd_LowPassFilterLeft( (Sint16)LeftByte );
+				dma.FrameRight = DmaSnd_LowPassFilterRight( (Sint16)RightByte );
+			}
 			while ( n > 0 )						/* pull as many bytes from the FIFO as needed */
 			{
 				LeftByte = DmaSnd_FIFO_PullByte ();