diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-09-17 14:53:29 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2020-09-18 00:22:52 +0000 |
commit | 2df3a5b04c40d548391c69c18780fefd420fac02 (patch) | |
tree | 48f56c70a30c688e9360a03eff836de7fba9f73b /apps/misc.c | |
parent | 4fa945d810a574c96503834d1c9324d02f17fc4b (diff) | |
download | rockbox-2df3a5b04c40d548391c69c18780fefd420fac02.tar.gz rockbox-2df3a5b04c40d548391c69c18780fefd420fac02.zip |
Headphone / lineout pause/resume #FS13237
Allow Lineout to behave like headphone port in regards to
plug/unplug pause/resume
Change-Id: I9cb2c9c40e0bdf3bf7e1e272164acd343f6b3850
Diffstat (limited to 'apps/misc.c')
-rw-r--r-- | apps/misc.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/apps/misc.c b/apps/misc.c index 2d60ecca49..d255eaf766 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -498,7 +498,7 @@ void car_adapter_mode_init(void) | |||
498 | #ifdef HAVE_HEADPHONE_DETECTION | 498 | #ifdef HAVE_HEADPHONE_DETECTION |
499 | static void hp_unplug_change(bool inserted) | 499 | static void hp_unplug_change(bool inserted) |
500 | { | 500 | { |
501 | static bool headphone_caused_pause = false; | 501 | static bool headphone_caused_pause = true; |
502 | 502 | ||
503 | if (global_settings.unplug_mode) | 503 | if (global_settings.unplug_mode) |
504 | { | 504 | { |
@@ -526,7 +526,7 @@ static void hp_unplug_change(bool inserted) | |||
526 | audio_enable_speaker(global_settings.speaker_mode); | 526 | audio_enable_speaker(global_settings.speaker_mode); |
527 | #endif | 527 | #endif |
528 | } | 528 | } |
529 | #endif | 529 | #endif /*HAVE_HEADPHONE_DETECTION*/ |
530 | 530 | ||
531 | #ifdef HAVE_LINEOUT_DETECTION | 531 | #ifdef HAVE_LINEOUT_DETECTION |
532 | static void lo_unplug_change(bool inserted) | 532 | static void lo_unplug_change(bool inserted) |
@@ -534,11 +534,32 @@ static void lo_unplug_change(bool inserted) | |||
534 | #ifdef HAVE_LINEOUT_POWEROFF | 534 | #ifdef HAVE_LINEOUT_POWEROFF |
535 | lineout_set(inserted); | 535 | lineout_set(inserted); |
536 | #else | 536 | #else |
537 | (void)inserted; | 537 | audiohw_set_lineout_volume(0,0); /*hp vol re-set by this function as well*/ |
538 | audiohw_set_lineout_volume(0,0); | 538 | static bool lineout_caused_pause = true; |
539 | #endif | 539 | |
540 | if (global_settings.unplug_mode) | ||
541 | { | ||
542 | int audio_stat = audio_status(); | ||
543 | if (inserted) | ||
544 | { | ||
545 | backlight_on(); | ||
546 | if ((audio_stat & AUDIO_STATUS_PLAY) && | ||
547 | lineout_caused_pause && | ||
548 | global_settings.unplug_mode > 1 ) | ||
549 | unpause_action(true, true); | ||
550 | lineout_caused_pause = false; | ||
551 | } else { | ||
552 | if ((audio_stat & AUDIO_STATUS_PLAY) && | ||
553 | !(audio_stat & AUDIO_STATUS_PAUSE)) | ||
554 | { | ||
555 | lineout_caused_pause = true; | ||
556 | pause_action(false, false); | ||
557 | } | ||
558 | } | ||
559 | } | ||
560 | #endif /*HAVE_LINEOUT_POWEROFF*/ | ||
540 | } | 561 | } |
541 | #endif | 562 | #endif /*HAVE_LINEOUT_DETECTION*/ |
542 | 563 | ||
543 | long default_event_handler_ex(long event, void (*callback)(void *), void *parameter) | 564 | long default_event_handler_ex(long event, void (*callback)(void *), void *parameter) |
544 | { | 565 | { |