diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2006-01-21 22:35:42 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2006-01-21 22:35:42 +0000 |
commit | 3458be2d9da84c159c3957316839271ea01193ba (patch) | |
tree | 6e7d2da058f818b83ac75a4e15a54026f9142564 /firmware/pcm_playback.c | |
parent | 132599a8582ea74b0402e318b6a84c01bbb7fb58 (diff) |
Prevent a very tiny pop from happening when starting/stopping pcm
playback.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8406 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/pcm_playback.c')
-rw-r--r-- | firmware/pcm_playback.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c index 36c6ab6a75..6a190e4d23 100644 --- a/firmware/pcm_playback.c +++ b/firmware/pcm_playback.c @@ -75,6 +75,11 @@ static void dma_start(const void *addr, long size) EBU1CONFIG = IIS_RESET | EBU_DEFPARM; #endif + /** Prevent a very tiny pop from happening by muting audio + * until dma has been initialized. */ + uda1380_mute(true); + sleep(HZ/16); + /* Set up DMA transfer */ SAR0 = ((unsigned long)addr); /* Source address */ DAR0 = (unsigned long)&PDOR3; /* Destination address */ @@ -87,6 +92,9 @@ static void dma_start(const void *addr, long size) EBU1CONFIG = EBU_DEFPARM; #endif DCR0 = DMA_INT | DMA_EEXT | DMA_CS | DMA_SINC | DMA_START; + + /* Now unmute the audio. */ + uda1380_mute(false); } /* Stops the DMA transfer and interrupt */ @@ -215,7 +223,11 @@ long pcm_get_bytes_waiting(void) void pcm_play_stop(void) { if (pcm_playing) { + /* Same muting trick here to prevent a tiny pop. */ + uda1380_mute(true); + sleep(HZ/16); dma_stop(); + uda1380_mute(false); } } @@ -274,7 +286,7 @@ void DMA0(void) /* Stop on error */ if(res & 0x70) { - pcm_play_stop(); + dma_stop(); logf("DMA Error:0x%04x", res); } else @@ -290,7 +302,7 @@ void DMA0(void) else { /* Finished playing */ - pcm_play_stop(); + dma_stop(); logf("DMA No Data:0x%04x", res); } } @@ -340,7 +352,6 @@ void pcm_init(void) sleep(HZ/4); tlv320_mute(false); #endif - /* Call dma_stop to initialize everything. */ dma_stop(); |