diff options
Diffstat (limited to 'firmware/pcm.c')
-rw-r--r-- | firmware/pcm.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/firmware/pcm.c b/firmware/pcm.c index d15c129015..b7415f329b 100644 --- a/firmware/pcm.c +++ b/firmware/pcm.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include "audio.h" | 28 | #include "audio.h" |
29 | #include "sound.h" | 29 | #include "sound.h" |
30 | #include "general.h" | 30 | #include "general.h" |
31 | #include "pcm-internal.h" | ||
32 | #include "pcm_mixer.h" | ||
31 | 33 | ||
32 | /** | 34 | /** |
33 | * Aspects implemented in the target-specific portion: | 35 | * Aspects implemented in the target-specific portion: |
@@ -78,8 +80,8 @@ | |||
78 | */ | 80 | */ |
79 | 81 | ||
80 | /* the registered callback function to ask for more mp3 data */ | 82 | /* the registered callback function to ask for more mp3 data */ |
81 | static volatile pcm_play_callback_type pcm_callback_for_more | 83 | static pcm_play_callback_type pcm_callback_for_more SHAREDBSS_ATTR = NULL; |
82 | SHAREDBSS_ATTR = NULL; | 84 | void (* pcm_play_dma_started)(void) SHAREDBSS_ATTR = NULL; |
83 | /* PCM playback state */ | 85 | /* PCM playback state */ |
84 | volatile bool pcm_playing SHAREDBSS_ATTR = false; | 86 | volatile bool pcm_playing SHAREDBSS_ATTR = false; |
85 | /* PCM paused state. paused implies playing */ | 87 | /* PCM paused state. paused implies playing */ |
@@ -95,6 +97,7 @@ int pcm_fsel SHAREDBSS_ATTR = HW_FREQ_DEFAULT; | |||
95 | static void pcm_play_stopped(void) | 97 | static void pcm_play_stopped(void) |
96 | { | 98 | { |
97 | pcm_callback_for_more = NULL; | 99 | pcm_callback_for_more = NULL; |
100 | pcm_play_dma_started = NULL; | ||
98 | pcm_paused = false; | 101 | pcm_paused = false; |
99 | pcm_playing = false; | 102 | pcm_playing = false; |
100 | } | 103 | } |
@@ -404,6 +407,12 @@ void pcm_apply_settings(void) | |||
404 | } | 407 | } |
405 | } | 408 | } |
406 | 409 | ||
410 | /* register callback to buffer more data */ | ||
411 | void pcm_play_set_dma_started_callback(void (* callback)(void)) | ||
412 | { | ||
413 | pcm_play_dma_started = callback; | ||
414 | } | ||
415 | |||
407 | #ifdef HAVE_RECORDING | 416 | #ifdef HAVE_RECORDING |
408 | /** Low level pcm recording apis **/ | 417 | /** Low level pcm recording apis **/ |
409 | 418 | ||
@@ -475,6 +484,11 @@ void pcm_init_recording(void) | |||
475 | { | 484 | { |
476 | logf("pcm_init_recording"); | 485 | logf("pcm_init_recording"); |
477 | 486 | ||
487 | #ifndef HAVE_PCM_FULL_DUPLEX | ||
488 | /* Stop the beasty before attempting recording */ | ||
489 | mixer_reset(); | ||
490 | #endif | ||
491 | |||
478 | /* Recording init is locked unlike general pcm init since this is not | 492 | /* Recording init is locked unlike general pcm init since this is not |
479 | * just a one-time event at startup and it should and must be safe by | 493 | * just a one-time event at startup and it should and must be safe by |
480 | * now. */ | 494 | * now. */ |