diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-09-30 18:21:38 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-09-30 21:37:11 -0400 |
commit | 01650b8bc9e400d3b90ebfba403033c7a87bc35e (patch) | |
tree | 573c00d9d652a8bb9da9ac5c3d606d819b676e9a /apps/playback.c | |
parent | c2c59457e132c1d296d23363d1fb3757cdbf2080 (diff) | |
download | rockbox-01650b8bc9e400d3b90ebfba403033c7a87bc35e.tar.gz rockbox-01650b8bc9e400d3b90ebfba403033c7a87bc35e.zip |
audio: Add support for 192 and 176KHz playback
* SAMPR_CAPS_ALL -> SAMPR_CAPS_ALL_48/96/192
* All targets claiming SAMPR_CAPS_ALL now get appropriate subset
* No need to explicitly define HAVE_PLAY_FREQ
* Rates that are a multiple of 44 or 48KHz can be used for playback
Inspired by a patch by Roman Stolyarov, but substantially rewritten by myself.
Change-Id: Iaca7363521b1cb9921e047ba1004d3cbe9c9c23e
Diffstat (limited to 'apps/playback.c')
-rw-r--r-- | apps/playback.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/apps/playback.c b/apps/playback.c index 504b3f4825..922837af18 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -3820,7 +3820,29 @@ void audio_set_crossfade(int enable) | |||
3820 | #ifdef HAVE_PLAY_FREQ | 3820 | #ifdef HAVE_PLAY_FREQ |
3821 | static unsigned long audio_guess_frequency(struct mp3entry *id3) | 3821 | static unsigned long audio_guess_frequency(struct mp3entry *id3) |
3822 | { | 3822 | { |
3823 | return (id3->frequency % 4000) ? SAMPR_44 : SAMPR_48; | 3823 | switch (id3->frequency) |
3824 | { | ||
3825 | #if HAVE_PLAY_FREQ >= 48 | ||
3826 | case 44100: | ||
3827 | return SAMPR_44; | ||
3828 | case 48000: | ||
3829 | return SAMPR_48; | ||
3830 | #endif | ||
3831 | #if HAVE_PLAY_FREQ >= 96 | ||
3832 | case 88200: | ||
3833 | return SAMPR_88; | ||
3834 | case 96000: | ||
3835 | return SAMPR_96; | ||
3836 | #endif | ||
3837 | #if HAVE_PLAY_FREQ >= 192 | ||
3838 | case 176400: | ||
3839 | return SAMPR_176; | ||
3840 | case 192000: | ||
3841 | return SAMPR_192; | ||
3842 | #endif | ||
3843 | default: | ||
3844 | return (id3->frequency % 4000) ? SAMPR_44 : SAMPR_48; | ||
3845 | } | ||
3824 | } | 3846 | } |
3825 | 3847 | ||
3826 | static void audio_change_frequency_callback(unsigned short id, void *data) | 3848 | static void audio_change_frequency_callback(unsigned short id, void *data) |
@@ -3858,7 +3880,15 @@ static void audio_change_frequency_callback(unsigned short id, void *data) | |||
3858 | 3880 | ||
3859 | void audio_set_playback_frequency(int setting) | 3881 | void audio_set_playback_frequency(int setting) |
3860 | { | 3882 | { |
3883 | #if HAVE_PLAY_FREQ >= 192 | ||
3884 | static const unsigned long play_sampr[] = { SAMPR_44, SAMPR_48, SAMPR_88, SAMPR_96, SAMPR_176, SAMPR_192 }; | ||
3885 | #elif HAVE_PLAY_FREQ >= 96 | ||
3886 | static const unsigned long play_sampr[] = { SAMPR_44, SAMPR_48, SAMPR_88, SAMPR_96 }; | ||
3887 | #elif HAVE_PLAY_FREQ >= 48 | ||
3861 | static const unsigned long play_sampr[] = { SAMPR_44, SAMPR_48 }; | 3888 | static const unsigned long play_sampr[] = { SAMPR_44, SAMPR_48 }; |
3889 | #else | ||
3890 | #error "HAVE_PLAY_FREQ < 48 ??" | ||
3891 | #endif | ||
3862 | 3892 | ||
3863 | if ((unsigned)setting > ARRAYLEN(play_sampr)) /* [0] is "automatic" */ | 3893 | if ((unsigned)setting > ARRAYLEN(play_sampr)) /* [0] is "automatic" */ |
3864 | setting = 0; | 3894 | setting = 0; |