summaryrefslogtreecommitdiff
path: root/apps/pcmbuf.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-11-16 05:33:42 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-11-16 05:33:42 +0000
commitbf656762262e5382af222a657b4358a988e138d3 (patch)
treea5b0bcef96ecbb5ead5a1577480de6d75e716c59 /apps/pcmbuf.c
parentef35bb9d475ca46b9d2efbba31a5a7a3f18d044a (diff)
Removed muting from pcm buffer during starts, stops and pauses for tlv320 and uda1380. Far less in the way of pops now. Voice during FM radio playback keeps radio steady. If it is determined that other audio codecs don't benefit from this remove the muting code and defines altogether. Saving the state and not resetting more than needed seems to prevent popping more effectively than muting at DMA starts and stops. Voice can click a little if truncating a clip (not annoyingly though) but that should be handled by a DSP fade out over a few ms instead-- a side benefit would be a general DSP fade rather than using volume control.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11538 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/pcmbuf.c')
-rw-r--r--apps/pcmbuf.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index 5152db8bad..347a9fa8fb 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -37,6 +37,13 @@
#include "dsp.h"
#include "thread.h"
+/* Define PCMBUF_MUTING if the codec requires muting to prevent pops
+ * Currently assumes anything other than tlv320 and uda1380 require it
+ */
+#if !defined(HAVE_UDA1380) && !defined(HAVE_TLV320)
+#define PCMBUF_MUTING
+#endif
+
/* Keep watermark high for iPods at least (2s) */
#define PCMBUF_WATERMARK (NATIVE_FREQUENCY * 4 * 2)
@@ -333,9 +340,13 @@ void pcmbuf_play_stop(void)
{
/** Prevent a very tiny pop from happening by muting audio
* until dma has been initialized. */
+#ifdef PCMBUF_MUTING
pcm_mute(true);
+#endif
pcm_play_stop();
+#ifdef PCMBUF_MUTING
pcm_mute(false);
+#endif
pcmbuf_unplayed_bytes = 0;
pcmbuf_mix_chunk = NULL;
@@ -413,11 +424,15 @@ size_t pcmbuf_get_bufsize(void)
}
void pcmbuf_pause(bool pause) {
+#ifdef PCMBUF_MUTING
if (pause)
- pcm_mute(true);
+ pcm_mute(true);
+#endif
pcm_play_pause(!pause);
+#ifdef PCMBUF_MUTING
if (!pause)
pcm_mute(false);
+#endif
trigger_cpu_boost();
}
@@ -426,9 +441,11 @@ void pcmbuf_play_start(void)
{
if (!pcm_is_playing() && pcmbuf_unplayed_bytes)
{
+#ifdef PCMBUF_MUTING
/** Prevent a very tiny pop from happening by muting audio
* until dma has been initialized. */
pcm_mute(true);
+#endif
if (pcmbuf_read != NULL)
{
@@ -438,8 +455,10 @@ void pcmbuf_play_start(void)
(unsigned char *)pcmbuf_read->addr, last_chunksize);
}
+#ifdef PCMBUF_MUTING
/* Now unmute the audio. */
pcm_mute(false);
+#endif
}
}