summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 9d03cd266c..2b08a99a8a 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -396,8 +396,18 @@ unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size)
396 logf("get buffer: talk_buf"); 396 logf("get buffer: talk_buf");
397 /* ok to use everything from audiobuf to audiobufend */ 397 /* ok to use everything from audiobuf to audiobufend */
398 if (buffer_state != BUFFER_STATE_TRASHED) 398 if (buffer_state != BUFFER_STATE_TRASHED)
399 {
399 talk_buffer_steal(); 400 talk_buffer_steal();
400 buffer_state = BUFFER_STATE_TRASHED; 401#ifdef PLAYBACK_VOICE
402 if (NULL != iram_buf[CODEC_IDX_VOICE])
403 {
404 /* Voice could be swapped out - wait for it to return */
405 while (current_codec != CODEC_IDX_VOICE)
406 yield();
407 }
408#endif /* PLAYBACK_VOICE */
409 buffer_state = BUFFER_STATE_TRASHED;
410 }
401 } 411 }
402 else 412 else
403 { 413 {
@@ -423,6 +433,10 @@ void audio_iram_steal(void)
423#ifdef PLAYBACK_VOICE 433#ifdef PLAYBACK_VOICE
424 if (NULL != iram_buf[CODEC_IDX_VOICE]) 434 if (NULL != iram_buf[CODEC_IDX_VOICE])
425 { 435 {
436 /* Can't already be stolen */
437 if (voice_iram_stolen)
438 return;
439
426 /* Wait for voice to swap back in if current codec was audio */ 440 /* Wait for voice to swap back in if current codec was audio */
427 while (current_codec != CODEC_IDX_VOICE) 441 while (current_codec != CODEC_IDX_VOICE)
428 yield(); 442 yield();
@@ -455,15 +469,14 @@ unsigned char *audio_get_recording_buffer(size_t *buffer_size)
455 469
456#ifdef PLAYBACK_VOICE 470#ifdef PLAYBACK_VOICE
457#ifdef IRAM_STEAL 471#ifdef IRAM_STEAL
458 end = dram_buf[CODEC_IDX_VOICE] ? 472 end = dram_buf[CODEC_IDX_VOICE];
459 dram_buf[CODEC_IDX_VOICE] : audiobufend;
460#else 473#else
461 end = iram_buf[CODEC_IDX_VOICE] ? 474 end = iram_buf[CODEC_IDX_VOICE];
462 iram_buf[CODEC_IDX_VOICE] : audiobufend;
463#endif /* IRAM_STEAL */ 475#endif /* IRAM_STEAL */
464#else 476 if (NULL == end)
465 end = audiobufend;
466#endif /* PLAYBACK_VOICE */ 477#endif /* PLAYBACK_VOICE */
478 end = audiobufend;
479
467 480
468 buffer_state = BUFFER_STATE_TRASHED; 481 buffer_state = BUFFER_STATE_TRASHED;
469 482