summaryrefslogtreecommitdiffstats
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)
#ifdef HAVE_PLAY_FREQ
static unsigned long audio_guess_frequency(struct mp3entry *id3)
{
- return (id3->frequency % 4000) ? SAMPR_44 : SAMPR_48;
+ switch (id3->frequency)
+ {
+#if HAVE_PLAY_FREQ >= 48
+ case 44100:
+ return SAMPR_44;
+ case 48000:
+ return SAMPR_48;
+#endif
+#if HAVE_PLAY_FREQ >= 96
+ case 88200:
+ return SAMPR_88;
+ case 96000:
+ return SAMPR_96;
+#endif
+#if HAVE_PLAY_FREQ >= 192
+ case 176400:
+ return SAMPR_176;
+ case 192000:
+ return SAMPR_192;
+#endif
+ default:
+ return (id3->frequency % 4000) ? SAMPR_44 : SAMPR_48;
+ }
}
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)
void audio_set_playback_frequency(int setting)
{
+#if HAVE_PLAY_FREQ >= 192
+ static const unsigned long play_sampr[] = { SAMPR_44, SAMPR_48, SAMPR_88, SAMPR_96, SAMPR_176, SAMPR_192 };
+#elif HAVE_PLAY_FREQ >= 96
+ static const unsigned long play_sampr[] = { SAMPR_44, SAMPR_48, SAMPR_88, SAMPR_96 };
+#elif HAVE_PLAY_FREQ >= 48
static const unsigned long play_sampr[] = { SAMPR_44, SAMPR_48 };
+#else
+ #error "HAVE_PLAY_FREQ < 48 ??"
+#endif
if ((unsigned)setting > ARRAYLEN(play_sampr)) /* [0] is "automatic" */
setting = 0;