diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2017-11-24 07:55:56 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2017-11-24 08:55:49 -0500 |
commit | abef23608152a2839c34dcfc283d1561b3eadd45 (patch) | |
tree | eb03da5bfd7bc9ec7858e3fed123b93ece24df90 /apps/playback.c | |
parent | 75d2e1f35c0ec40f839687ed2d1a670b0da41a36 (diff) | |
download | rockbox-abef23608152a2839c34dcfc283d1561b3eadd45.tar.gz rockbox-abef23608152a2839c34dcfc283d1561b3eadd45.zip |
Do playback restarts the proper way
It isn't necessary to explicitly stop and restart playback to
force it to update something that must cause rebuffering.
Change-Id: I6ff5394fcafc7374af67ef9fbf9022bb4a79b773
Diffstat (limited to 'apps/playback.c')
-rw-r--r-- | apps/playback.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/apps/playback.c b/apps/playback.c index 54410ad2cc..28e520319d 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -52,6 +52,10 @@ | |||
52 | #endif | 52 | #endif |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #ifdef HAVE_PLAY_FREQ | ||
56 | #include "pcm_mixer.h" | ||
57 | #endif | ||
58 | |||
55 | /* TODO: The audio thread really is doing multitasking of acting like a | 59 | /* TODO: The audio thread really is doing multitasking of acting like a |
56 | consumer and producer of tracks. It may be advantageous to better | 60 | consumer and producer of tracks. It may be advantageous to better |
57 | logically separate the two functions. I won't go that far just yet. */ | 61 | logically separate the two functions. I won't go that far just yet. */ |
@@ -2523,6 +2527,7 @@ static void audio_start_playback(const struct audio_resume_info *resume_info, | |||
2523 | resume.elapsed = id3_get(PLAYING_ID3)->elapsed; | 2527 | resume.elapsed = id3_get(PLAYING_ID3)->elapsed; |
2524 | resume.offset = id3_get(PLAYING_ID3)->offset; | 2528 | resume.offset = id3_get(PLAYING_ID3)->offset; |
2525 | track_list_clear(TRACK_LIST_CLEAR_ALL); | 2529 | track_list_clear(TRACK_LIST_CLEAR_ALL); |
2530 | pcmbuf_update_frequency(); | ||
2526 | } | 2531 | } |
2527 | else | 2532 | else |
2528 | { | 2533 | { |
@@ -2556,9 +2561,6 @@ static void audio_start_playback(const struct audio_resume_info *resume_info, | |||
2556 | #ifndef PLATFORM_HAS_VOLUME_CHANGE | 2561 | #ifndef PLATFORM_HAS_VOLUME_CHANGE |
2557 | sound_set_volume(global_settings.volume); | 2562 | sound_set_volume(global_settings.volume); |
2558 | #endif | 2563 | #endif |
2559 | #ifdef HAVE_PLAY_FREQ | ||
2560 | settings_apply_play_freq(global_settings.play_frequency, true); | ||
2561 | #endif | ||
2562 | pcmbuf_update_frequency(); | 2564 | pcmbuf_update_frequency(); |
2563 | 2565 | ||
2564 | /* Be sure channel is audible */ | 2566 | /* Be sure channel is audible */ |
@@ -3628,6 +3630,12 @@ void playback_release_aa_slot(int slot) | |||
3628 | aa_slot->used--; | 3630 | aa_slot->used--; |
3629 | } | 3631 | } |
3630 | } | 3632 | } |
3633 | |||
3634 | void playback_update_aa_dims(void) | ||
3635 | { | ||
3636 | LOGFQUEUE("audio >| audio Q_AUDIO_REMAKE_AUDIO_BUFFER"); | ||
3637 | audio_queue_send(Q_AUDIO_REMAKE_AUDIO_BUFFER, 0); | ||
3638 | } | ||
3631 | #endif /* HAVE_ALBUMART */ | 3639 | #endif /* HAVE_ALBUMART */ |
3632 | 3640 | ||
3633 | /* Return file byte offset */ | 3641 | /* Return file byte offset */ |
@@ -3702,6 +3710,26 @@ void audio_set_crossfade(int enable) | |||
3702 | } | 3710 | } |
3703 | #endif /* HAVE_CROSSFADE */ | 3711 | #endif /* HAVE_CROSSFADE */ |
3704 | 3712 | ||
3713 | #ifdef HAVE_PLAY_FREQ | ||
3714 | void audio_set_playback_frequency(int setting) | ||
3715 | { | ||
3716 | static const unsigned long play_sampr[] = { SAMPR_44, SAMPR_48 }; | ||
3717 | |||
3718 | if ((unsigned)setting >= ARRAYLEN(play_sampr)) | ||
3719 | setting = 0; | ||
3720 | |||
3721 | unsigned long playback_sampr = mixer_get_frequency(); | ||
3722 | unsigned long sampr = play_sampr[setting]; | ||
3723 | |||
3724 | if (sampr != playback_sampr) | ||
3725 | { | ||
3726 | mixer_set_frequency(sampr); | ||
3727 | LOGFQUEUE("audio >| audio Q_AUDIO_REMAKE_AUDIO_BUFFER"); | ||
3728 | audio_queue_send(Q_AUDIO_REMAKE_AUDIO_BUFFER, 0); | ||
3729 | } | ||
3730 | } | ||
3731 | #endif /* HAVE_PLAY_FREQ */ | ||
3732 | |||
3705 | unsigned int playback_status(void) | 3733 | unsigned int playback_status(void) |
3706 | { | 3734 | { |
3707 | return play_status; | 3735 | return play_status; |