diff options
-rw-r--r-- | apps/pcmbuf.c | 21 |
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 @@ | |||
37 | #include "dsp.h" | 37 | #include "dsp.h" |
38 | #include "thread.h" | 38 | #include "thread.h" |
39 | 39 | ||
40 | /* Define PCMBUF_MUTING if the codec requires muting to prevent pops | ||
41 | * Currently assumes anything other than tlv320 and uda1380 require it | ||
42 | */ | ||
43 | #if !defined(HAVE_UDA1380) && !defined(HAVE_TLV320) | ||
44 | #define PCMBUF_MUTING | ||
45 | #endif | ||
46 | |||
40 | /* Keep watermark high for iPods at least (2s) */ | 47 | /* Keep watermark high for iPods at least (2s) */ |
41 | #define PCMBUF_WATERMARK (NATIVE_FREQUENCY * 4 * 2) | 48 | #define PCMBUF_WATERMARK (NATIVE_FREQUENCY * 4 * 2) |
42 | 49 | ||
@@ -333,9 +340,13 @@ void pcmbuf_play_stop(void) | |||
333 | { | 340 | { |
334 | /** Prevent a very tiny pop from happening by muting audio | 341 | /** Prevent a very tiny pop from happening by muting audio |
335 | * until dma has been initialized. */ | 342 | * until dma has been initialized. */ |
343 | #ifdef PCMBUF_MUTING | ||
336 | pcm_mute(true); | 344 | pcm_mute(true); |
345 | #endif | ||
337 | pcm_play_stop(); | 346 | pcm_play_stop(); |
347 | #ifdef PCMBUF_MUTING | ||
338 | pcm_mute(false); | 348 | pcm_mute(false); |
349 | #endif | ||
339 | 350 | ||
340 | pcmbuf_unplayed_bytes = 0; | 351 | pcmbuf_unplayed_bytes = 0; |
341 | pcmbuf_mix_chunk = NULL; | 352 | pcmbuf_mix_chunk = NULL; |
@@ -413,11 +424,15 @@ size_t pcmbuf_get_bufsize(void) | |||
413 | } | 424 | } |
414 | 425 | ||
415 | void pcmbuf_pause(bool pause) { | 426 | void pcmbuf_pause(bool pause) { |
427 | #ifdef PCMBUF_MUTING | ||
416 | if (pause) | 428 | if (pause) |
417 | pcm_mute(true); | 429 | pcm_mute(true); |
430 | #endif | ||
418 | pcm_play_pause(!pause); | 431 | pcm_play_pause(!pause); |
432 | #ifdef PCMBUF_MUTING | ||
419 | if (!pause) | 433 | if (!pause) |
420 | pcm_mute(false); | 434 | pcm_mute(false); |
435 | #endif | ||
421 | trigger_cpu_boost(); | 436 | trigger_cpu_boost(); |
422 | } | 437 | } |
423 | 438 | ||
@@ -426,9 +441,11 @@ void pcmbuf_play_start(void) | |||
426 | { | 441 | { |
427 | if (!pcm_is_playing() && pcmbuf_unplayed_bytes) | 442 | if (!pcm_is_playing() && pcmbuf_unplayed_bytes) |
428 | { | 443 | { |
444 | #ifdef PCMBUF_MUTING | ||
429 | /** Prevent a very tiny pop from happening by muting audio | 445 | /** Prevent a very tiny pop from happening by muting audio |
430 | * until dma has been initialized. */ | 446 | * until dma has been initialized. */ |
431 | pcm_mute(true); | 447 | pcm_mute(true); |
448 | #endif | ||
432 | 449 | ||
433 | if (pcmbuf_read != NULL) | 450 | if (pcmbuf_read != NULL) |
434 | { | 451 | { |
@@ -438,8 +455,10 @@ void pcmbuf_play_start(void) | |||
438 | (unsigned char *)pcmbuf_read->addr, last_chunksize); | 455 | (unsigned char *)pcmbuf_read->addr, last_chunksize); |
439 | } | 456 | } |
440 | 457 | ||
458 | #ifdef PCMBUF_MUTING | ||
441 | /* Now unmute the audio. */ | 459 | /* Now unmute the audio. */ |
442 | pcm_mute(false); | 460 | pcm_mute(false); |
461 | #endif | ||
443 | } | 462 | } |
444 | } | 463 | } |
445 | 464 | ||