summaryrefslogtreecommitdiff
path: root/apps/playback.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c32
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
3821static unsigned long audio_guess_frequency(struct mp3entry *id3) 3821static 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
3826static void audio_change_frequency_callback(unsigned short id, void *data) 3848static 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
3859void audio_set_playback_frequency(int setting) 3881void 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;