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/settings.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/settings.c')
-rw-r--r-- | apps/settings.c | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/apps/settings.c b/apps/settings.c index aa51e051e9..8afec9f806 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -87,10 +87,6 @@ struct system_status global_status; | |||
87 | #include "enc_config.h" | 87 | #include "enc_config.h" |
88 | #endif | 88 | #endif |
89 | #include "pcm_sampr.h" | 89 | #include "pcm_sampr.h" |
90 | #ifdef HAVE_PLAY_FREQ | ||
91 | #include "pcm_mixer.h" | ||
92 | #include "dsp_core.h" | ||
93 | #endif | ||
94 | #endif /* CONFIG_CODEC == SWCODEC */ | 90 | #endif /* CONFIG_CODEC == SWCODEC */ |
95 | 91 | ||
96 | #define NVRAM_BLOCK_SIZE 44 | 92 | #define NVRAM_BLOCK_SIZE 44 |
@@ -735,41 +731,6 @@ void settings_apply_pm_range(void) | |||
735 | } | 731 | } |
736 | #endif /* HAVE_LCD_BITMAP */ | 732 | #endif /* HAVE_LCD_BITMAP */ |
737 | 733 | ||
738 | #ifdef HAVE_PLAY_FREQ | ||
739 | void settings_apply_play_freq(int value, bool playback) | ||
740 | { | ||
741 | static const unsigned long play_sampr[] = { SAMPR_44, SAMPR_48 }; | ||
742 | static int prev_setting = 0; | ||
743 | |||
744 | if ((unsigned)value >= ARRAYLEN(play_sampr)) | ||
745 | value = 0; | ||
746 | |||
747 | bool changed = value != prev_setting; | ||
748 | prev_setting = value; | ||
749 | |||
750 | unsigned long elapsed = 0; | ||
751 | unsigned long offset = 0; | ||
752 | bool playing = changed && !playback && | ||
753 | audio_status() == AUDIO_STATUS_PLAY; | ||
754 | |||
755 | if (playing) | ||
756 | { | ||
757 | struct mp3entry *id3 = audio_current_track(); | ||
758 | elapsed = id3->elapsed; | ||
759 | offset = id3->offset; | ||
760 | } | ||
761 | |||
762 | if (changed && !playback) | ||
763 | audio_hard_stop(); | ||
764 | |||
765 | /* Other sub-areas of playback pick it up from the mixer */ | ||
766 | mixer_set_frequency(play_sampr[value]); | ||
767 | |||
768 | if (playing) | ||
769 | audio_play(elapsed, offset); | ||
770 | } | ||
771 | #endif /* HAVE_PLAY_FREQ */ | ||
772 | |||
773 | void sound_settings_apply(void) | 734 | void sound_settings_apply(void) |
774 | { | 735 | { |
775 | #ifdef AUDIOHW_HAVE_BASS | 736 | #ifdef AUDIOHW_HAVE_BASS |
@@ -1023,10 +984,11 @@ void settings_apply(bool read_disk) | |||
1023 | lcd_scroll_delay(global_settings.scroll_delay); | 984 | lcd_scroll_delay(global_settings.scroll_delay); |
1024 | 985 | ||
1025 | 986 | ||
987 | #if CONFIG_CODEC == SWCODEC | ||
1026 | #ifdef HAVE_PLAY_FREQ | 988 | #ifdef HAVE_PLAY_FREQ |
1027 | settings_apply_play_freq(global_settings.play_frequency, false); | 989 | /* before crossfade */ |
990 | audio_set_playback_frequency(global_settings.play_frequency); | ||
1028 | #endif | 991 | #endif |
1029 | #if CONFIG_CODEC == SWCODEC | ||
1030 | #ifdef HAVE_CROSSFADE | 992 | #ifdef HAVE_CROSSFADE |
1031 | audio_set_crossfade(global_settings.crossfade); | 993 | audio_set_crossfade(global_settings.crossfade); |
1032 | #endif | 994 | #endif |