summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-09-30 18:21:38 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-09-30 21:37:11 -0400
commit01650b8bc9e400d3b90ebfba403033c7a87bc35e (patch)
tree573c00d9d652a8bb9da9ac5c3d606d819b676e9a /apps
parentc2c59457e132c1d296d23363d1fb3757cdbf2080 (diff)
downloadrockbox-01650b8bc9e400d3b90ebfba403033c7a87bc35e.tar.gz
rockbox-01650b8bc9e400d3b90ebfba403033c7a87bc35e.tar.bz2
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')
-rw-r--r--apps/enc_config.c2
-rw-r--r--apps/playback.c32
-rw-r--r--apps/settings_list.c10
3 files changed, 42 insertions, 2 deletions
diff --git a/apps/enc_config.c b/apps/enc_config.c
index a971343cab..66aaac22e6 100644
--- a/apps/enc_config.c
+++ b/apps/enc_config.c
@@ -375,7 +375,7 @@ bool enc_get_caps(const struct encoder_config *cfg,
else
{
/* If no function provided...defaults to all */
- caps->samplerate_caps = SAMPR_CAP_ALL;
+ caps->samplerate_caps = SAMPR_CAP_ALL_192;
caps->channel_caps = CHN_CAP_ALL;
}
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;
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 64a150c806..41c20c7809 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -879,8 +879,18 @@ const struct settings_list settings[] = {
), /* CHOICE_SETTING( repeat_mode ) */
#ifdef HAVE_PLAY_FREQ
STRINGCHOICE_SETTING(0, play_frequency, LANG_FREQUENCY, 0,
+#if HAVE_PLAY_FREQ >= 192
+ "playback frequency", "auto,44.1 kHz,48 kHz,88.2 kHz,96 kHz,176.4 kHz,192 kHz", NULL, 7,
+ LANG_AUTOMATIC, TALK_ID_DECIMAL(441, 1, UNIT_KHZ), TALK_ID(48, UNIT_KHZ), TALK_ID_DECIMAL(882, 1, UNIT_KHZ), TALK_ID(96, UNIT_KHZ), TALK_ID_DECIMAL(1764, 1, UNIT_KHZ), TALK_ID(192, UNIT_KHZ)),
+#elif HAVE_PLAY_FREQ >= 96
+ "playback frequency", "auto,44.1 kHz,48 kHz,88.2 kHz,96 kHz", NULL, 5,
+ LANG_AUTOMATIC, TALK_ID_DECIMAL(441, 1, UNIT_KHZ), TALK_ID(48, UNIT_KHZ), TALK_ID_DECIMAL(882, 1, UNIT_KHZ), TALK_ID(96, UNIT_KHZ)),
+#elif HAVE_PLAY_FREQ >= 48
"playback frequency", "auto,44.1 kHz,48 kHz", NULL, 3,
LANG_AUTOMATIC, TALK_ID_DECIMAL(441, 1, UNIT_KHZ), TALK_ID(48, UNIT_KHZ)),
+#else
+ #error "HAVE_PLAY_FREQ < 48???"
+#endif
#endif /* HAVE_PLAY_FREQ */
/* LCD */
#ifdef HAVE_LCD_CONTRAST