summaryrefslogtreecommitdiff
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
parentc2c59457e132c1d296d23363d1fb3757cdbf2080 (diff)
downloadrockbox-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
-rw-r--r--apps/enc_config.c2
-rw-r--r--apps/playback.c32
-rw-r--r--apps/settings_list.c10
-rw-r--r--firmware/export/config.h2
-rw-r--r--firmware/export/config/agptekrocker.h3
-rw-r--r--firmware/export/config/creativezen.h4
-rw-r--r--firmware/export/config/creativezenmozaic.h4
-rw-r--r--firmware/export/config/creativezenv.h4
-rw-r--r--firmware/export/config/creativezenxfi.h4
-rw-r--r--firmware/export/config/creativezenxfi2.h4
-rw-r--r--firmware/export/config/creativezenxfi3.h4
-rw-r--r--firmware/export/config/creativezenxfistyle.h4
-rw-r--r--firmware/export/config/ibassodx50.h3
-rw-r--r--firmware/export/config/ibassodx90.h3
-rw-r--r--firmware/export/config/samsungypz5.h4
-rw-r--r--firmware/export/config/sansac200v2.h2
-rw-r--r--firmware/export/config/sansaclip.h2
-rw-r--r--firmware/export/config/sansaclipplus.h2
-rw-r--r--firmware/export/config/sansaclipv2.h2
-rw-r--r--firmware/export/config/sansaclipzip.h2
-rw-r--r--firmware/export/config/sansae200v2.h2
-rw-r--r--firmware/export/config/sansafuze.h2
-rw-r--r--firmware/export/config/sansafuzeplus.h4
-rw-r--r--firmware/export/config/sansafuzev2.h2
-rw-r--r--firmware/export/config/sansam200v4.h2
-rw-r--r--firmware/export/config/sonynwze360.h2
-rw-r--r--firmware/export/config/sonynwze370.h2
-rw-r--r--firmware/export/config/xduoox20.h3
-rw-r--r--firmware/export/config/xduoox3.h6
-rw-r--r--firmware/export/config/xduoox3ii.h9
-rw-r--r--firmware/export/config_caps.h21
-rw-r--r--firmware/export/pcm_sampr.h87
32 files changed, 160 insertions, 79 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,
375 else 375 else
376 { 376 {
377 /* If no function provided...defaults to all */ 377 /* If no function provided...defaults to all */
378 caps->samplerate_caps = SAMPR_CAP_ALL; 378 caps->samplerate_caps = SAMPR_CAP_ALL_192;
379 caps->channel_caps = CHN_CAP_ALL; 379 caps->channel_caps = CHN_CAP_ALL;
380 } 380 }
381 381
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;
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[] = {
879 ), /* CHOICE_SETTING( repeat_mode ) */ 879 ), /* CHOICE_SETTING( repeat_mode ) */
880#ifdef HAVE_PLAY_FREQ 880#ifdef HAVE_PLAY_FREQ
881 STRINGCHOICE_SETTING(0, play_frequency, LANG_FREQUENCY, 0, 881 STRINGCHOICE_SETTING(0, play_frequency, LANG_FREQUENCY, 0,
882#if HAVE_PLAY_FREQ >= 192
883 "playback frequency", "auto,44.1 kHz,48 kHz,88.2 kHz,96 kHz,176.4 kHz,192 kHz", NULL, 7,
884 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)),
885#elif HAVE_PLAY_FREQ >= 96
886 "playback frequency", "auto,44.1 kHz,48 kHz,88.2 kHz,96 kHz", NULL, 5,
887 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)),
888#elif HAVE_PLAY_FREQ >= 48
882 "playback frequency", "auto,44.1 kHz,48 kHz", NULL, 3, 889 "playback frequency", "auto,44.1 kHz,48 kHz", NULL, 3,
883 LANG_AUTOMATIC, TALK_ID_DECIMAL(441, 1, UNIT_KHZ), TALK_ID(48, UNIT_KHZ)), 890 LANG_AUTOMATIC, TALK_ID_DECIMAL(441, 1, UNIT_KHZ), TALK_ID(48, UNIT_KHZ)),
891#else
892 #error "HAVE_PLAY_FREQ < 48???"
893#endif
884#endif /* HAVE_PLAY_FREQ */ 894#endif /* HAVE_PLAY_FREQ */
885 /* LCD */ 895 /* LCD */
886#ifdef HAVE_LCD_CONTRAST 896#ifdef HAVE_LCD_CONTRAST
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 65fdc6a03c..7c57d9a120 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -600,7 +600,7 @@ Lyre prototype 1 */
600#elif defined(XDUOO_X20) 600#elif defined(XDUOO_X20)
601#include "config/xduoox20.h" 601#include "config/xduoox20.h"
602#else 602#else
603/* no known platform */ 603//#error "unknown hwardware platform!"
604#endif 604#endif
605 605
606#ifdef __PCTOOL__ 606#ifdef __PCTOOL__
diff --git a/firmware/export/config/agptekrocker.h b/firmware/export/config/agptekrocker.h
index 46c9e43b7c..31ef904109 100644
--- a/firmware/export/config/agptekrocker.h
+++ b/firmware/export/config/agptekrocker.h
@@ -124,8 +124,7 @@
124#define HAVE_SW_TONE_CONTROLS 124#define HAVE_SW_TONE_CONTROLS
125 125
126/* HW codec is flexible */ 126/* HW codec is flexible */
127#define HW_SAMPR_CAPS SAMPR_CAP_ALL 127#define HW_SAMPR_CAPS SAMPR_CAP_ALL_192
128#define HAVE_PLAY_FREQ
129 128
130/* Battery */ 129/* Battery */
131#define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */ 130#define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */
diff --git a/firmware/export/config/creativezen.h b/firmware/export/config/creativezen.h
index 2592325160..bd1dd6c2b1 100644
--- a/firmware/export/config/creativezen.h
+++ b/firmware/export/config/creativezen.h
@@ -11,12 +11,12 @@
11/* Define if boot data from bootloader has been enabled for the target */ 11/* Define if boot data from bootloader has been enabled for the target */
12#define HAVE_BOOTDATA 12#define HAVE_BOOTDATA
13 13
14#define HW_SAMPR_CAPS SAMPR_CAP_ALL 14#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48
15 15
16/* define this if you have recording possibility */ 16/* define this if you have recording possibility */
17#define HAVE_RECORDING 17#define HAVE_RECORDING
18 18
19#define REC_SAMPR_CAPS SAMPR_CAP_ALL 19#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48
20 20
21/* Default recording levels */ 21/* Default recording levels */
22#define DEFAULT_REC_MIC_GAIN 23 22#define DEFAULT_REC_MIC_GAIN 23
diff --git a/firmware/export/config/creativezenmozaic.h b/firmware/export/config/creativezenmozaic.h
index 0ffe8ed45b..9272a7b412 100644
--- a/firmware/export/config/creativezenmozaic.h
+++ b/firmware/export/config/creativezenmozaic.h
@@ -9,12 +9,12 @@
9#define MODEL_NUMBER 87 9#define MODEL_NUMBER 87
10#define MODEL_NAME "Creative ZEN Mozaic" 10#define MODEL_NAME "Creative ZEN Mozaic"
11 11
12#define HW_SAMPR_CAPS SAMPR_CAP_ALL 12#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48
13 13
14/* define this if you have recording possibility */ 14/* define this if you have recording possibility */
15#define HAVE_RECORDING 15#define HAVE_RECORDING
16 16
17#define REC_SAMPR_CAPS SAMPR_CAP_ALL 17#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48
18 18
19/* Default recording levels */ 19/* Default recording levels */
20#define DEFAULT_REC_MIC_GAIN 23 20#define DEFAULT_REC_MIC_GAIN 23
diff --git a/firmware/export/config/creativezenv.h b/firmware/export/config/creativezenv.h
index 288c2aecbd..5caf7c8c2b 100644
--- a/firmware/export/config/creativezenv.h
+++ b/firmware/export/config/creativezenv.h
@@ -9,12 +9,12 @@
9#define MODEL_NUMBER 92 9#define MODEL_NUMBER 92
10#define MODEL_NAME "Creative ZEN V" 10#define MODEL_NAME "Creative ZEN V"
11 11
12#define HW_SAMPR_CAPS SAMPR_CAP_ALL 12#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48
13 13
14/* define this if you have recording possibility */ 14/* define this if you have recording possibility */
15#define HAVE_RECORDING 15#define HAVE_RECORDING
16 16
17#define REC_SAMPR_CAPS SAMPR_CAP_ALL 17#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48
18 18
19/* Default recording levels */ 19/* Default recording levels */
20#define DEFAULT_REC_MIC_GAIN 23 20#define DEFAULT_REC_MIC_GAIN 23
diff --git a/firmware/export/config/creativezenxfi.h b/firmware/export/config/creativezenxfi.h
index 977e11feff..604cf2c3cd 100644
--- a/firmware/export/config/creativezenxfi.h
+++ b/firmware/export/config/creativezenxfi.h
@@ -9,12 +9,12 @@
9#define MODEL_NUMBER 86 9#define MODEL_NUMBER 86
10#define MODEL_NAME "Creative Zen X-Fi" 10#define MODEL_NAME "Creative Zen X-Fi"
11 11
12#define HW_SAMPR_CAPS SAMPR_CAP_ALL 12#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48
13 13
14/* define this if you have recording possibility */ 14/* define this if you have recording possibility */
15#define HAVE_RECORDING 15#define HAVE_RECORDING
16 16
17#define REC_SAMPR_CAPS SAMPR_CAP_ALL 17#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48
18 18
19/* Default recording levels */ 19/* Default recording levels */
20#define DEFAULT_REC_MIC_GAIN 23 20#define DEFAULT_REC_MIC_GAIN 23
diff --git a/firmware/export/config/creativezenxfi2.h b/firmware/export/config/creativezenxfi2.h
index 3a14017bf2..171f5fb2b0 100644
--- a/firmware/export/config/creativezenxfi2.h
+++ b/firmware/export/config/creativezenxfi2.h
@@ -11,12 +11,12 @@
11/* Define if boot data from bootloader has been enabled for the target */ 11/* Define if boot data from bootloader has been enabled for the target */
12#define HAVE_BOOTDATA 12#define HAVE_BOOTDATA
13 13
14#define HW_SAMPR_CAPS SAMPR_CAP_ALL 14#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48
15 15
16/* define this if you have recording possibility */ 16/* define this if you have recording possibility */
17#define HAVE_RECORDING 17#define HAVE_RECORDING
18 18
19#define REC_SAMPR_CAPS SAMPR_CAP_ALL 19#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48
20 20
21/* Default recording levels */ 21/* Default recording levels */
22#define DEFAULT_REC_MIC_GAIN 23 22#define DEFAULT_REC_MIC_GAIN 23
diff --git a/firmware/export/config/creativezenxfi3.h b/firmware/export/config/creativezenxfi3.h
index 5139de0588..5f0914b9e4 100644
--- a/firmware/export/config/creativezenxfi3.h
+++ b/firmware/export/config/creativezenxfi3.h
@@ -11,12 +11,12 @@
11/* Define if boot data from bootloader has been enabled for the target */ 11/* Define if boot data from bootloader has been enabled for the target */
12#define HAVE_BOOTDATA 12#define HAVE_BOOTDATA
13 13
14#define HW_SAMPR_CAPS SAMPR_CAP_ALL 14#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48
15 15
16/* define this if you have recording possibility */ 16/* define this if you have recording possibility */
17#define HAVE_RECORDING 17#define HAVE_RECORDING
18 18
19#define REC_SAMPR_CAPS SAMPR_CAP_ALL 19#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48
20 20
21/* Default recording levels */ 21/* Default recording levels */
22#define DEFAULT_REC_MIC_GAIN 23 22#define DEFAULT_REC_MIC_GAIN 23
diff --git a/firmware/export/config/creativezenxfistyle.h b/firmware/export/config/creativezenxfistyle.h
index 41f5ce97b8..33f459dba9 100644
--- a/firmware/export/config/creativezenxfistyle.h
+++ b/firmware/export/config/creativezenxfistyle.h
@@ -9,12 +9,12 @@
9#define MODEL_NUMBER 94 9#define MODEL_NUMBER 94
10#define MODEL_NAME "Creative Zen X-Fi Style" 10#define MODEL_NAME "Creative Zen X-Fi Style"
11 11
12#define HW_SAMPR_CAPS SAMPR_CAP_ALL 12#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48
13 13
14/* define this if you have recording possibility */ 14/* define this if you have recording possibility */
15#define HAVE_RECORDING 15#define HAVE_RECORDING
16 16
17#define REC_SAMPR_CAPS SAMPR_CAP_ALL 17#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48
18 18
19/* Default recording levels */ 19/* Default recording levels */
20#define DEFAULT_REC_MIC_GAIN 23 20#define DEFAULT_REC_MIC_GAIN 23
diff --git a/firmware/export/config/ibassodx50.h b/firmware/export/config/ibassodx50.h
index 9f5e343978..05e8aa9213 100644
--- a/firmware/export/config/ibassodx50.h
+++ b/firmware/export/config/ibassodx50.h
@@ -99,8 +99,7 @@
99 99
100#define HAVE_SW_TONE_CONTROLS 100#define HAVE_SW_TONE_CONTROLS
101#define HAVE_SW_VOLUME_CONTROL 101#define HAVE_SW_VOLUME_CONTROL
102#define HW_SAMPR_CAPS SAMPR_CAP_ALL 102#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
103#define HAVE_PLAY_FREQ
104 103
105//#define HAVE_MULTIMEDIA_KEYS 104//#define HAVE_MULTIMEDIA_KEYS
106#define CONFIG_KEYPAD DX50_PAD 105#define CONFIG_KEYPAD DX50_PAD
diff --git a/firmware/export/config/ibassodx90.h b/firmware/export/config/ibassodx90.h
index 8155cec5aa..1e2a1be062 100644
--- a/firmware/export/config/ibassodx90.h
+++ b/firmware/export/config/ibassodx90.h
@@ -98,8 +98,7 @@
98 98
99#define HAVE_SW_TONE_CONTROLS 99#define HAVE_SW_TONE_CONTROLS
100#define HAVE_SW_VOLUME_CONTROL 100#define HAVE_SW_VOLUME_CONTROL
101#define HW_SAMPR_CAPS SAMPR_CAP_ALL 101#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
102#define HAVE_PLAY_FREQ
103 102
104//#define HAVE_MULTIMEDIA_KEYS 103//#define HAVE_MULTIMEDIA_KEYS
105#define CONFIG_KEYPAD DX50_PAD 104#define CONFIG_KEYPAD DX50_PAD
diff --git a/firmware/export/config/samsungypz5.h b/firmware/export/config/samsungypz5.h
index c890d629f1..2af62c1cbe 100644
--- a/firmware/export/config/samsungypz5.h
+++ b/firmware/export/config/samsungypz5.h
@@ -11,12 +11,12 @@
11/* Define if boot data from bootloader has been enabled for the target */ 11/* Define if boot data from bootloader has been enabled for the target */
12#define HAVE_BOOTDATA 12#define HAVE_BOOTDATA
13 13
14#define HW_SAMPR_CAPS SAMPR_CAP_ALL 14#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48
15 15
16/* define this if you have recording possibility */ 16/* define this if you have recording possibility */
17#define HAVE_RECORDING 17#define HAVE_RECORDING
18 18
19#define REC_SAMPR_CAPS SAMPR_CAP_ALL 19#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48
20 20
21/* Default recording levels */ 21/* Default recording levels */
22#define DEFAULT_REC_MIC_GAIN 23 22#define DEFAULT_REC_MIC_GAIN 23
diff --git a/firmware/export/config/sansac200v2.h b/firmware/export/config/sansac200v2.h
index 66e02f9738..df306e88b0 100644
--- a/firmware/export/config/sansac200v2.h
+++ b/firmware/export/config/sansac200v2.h
@@ -8,7 +8,7 @@
8#define FIRMWARE_OFFSET_FILE_DATA 8 8#define FIRMWARE_OFFSET_FILE_DATA 8
9#define FIRMWARE_OFFSET_FILE_CRC 0 9#define FIRMWARE_OFFSET_FILE_CRC 0
10 10
11#define HW_SAMPR_CAPS SAMPR_CAP_ALL 11#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
12 12
13/* define this if you have recording possibility */ 13/* define this if you have recording possibility */
14#define HAVE_RECORDING 14#define HAVE_RECORDING
diff --git a/firmware/export/config/sansaclip.h b/firmware/export/config/sansaclip.h
index 84970e820d..faab50590c 100644
--- a/firmware/export/config/sansaclip.h
+++ b/firmware/export/config/sansaclip.h
@@ -8,7 +8,7 @@
8#define FIRMWARE_OFFSET_FILE_DATA 8 8#define FIRMWARE_OFFSET_FILE_DATA 8
9#define FIRMWARE_OFFSET_FILE_CRC 0 9#define FIRMWARE_OFFSET_FILE_CRC 0
10 10
11#define HW_SAMPR_CAPS SAMPR_CAP_ALL 11#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
12 12
13/* define this if you have recording possibility */ 13/* define this if you have recording possibility */
14#define HAVE_RECORDING 14#define HAVE_RECORDING
diff --git a/firmware/export/config/sansaclipplus.h b/firmware/export/config/sansaclipplus.h
index d4638a1acd..3108bace61 100644
--- a/firmware/export/config/sansaclipplus.h
+++ b/firmware/export/config/sansaclipplus.h
@@ -19,7 +19,7 @@
19#define HAVE_HOTSWAP 19#define HAVE_HOTSWAP
20#endif 20#endif
21 21
22#define HW_SAMPR_CAPS SAMPR_CAP_ALL 22#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
23 23
24/* define this if you have recording possibility */ 24/* define this if you have recording possibility */
25#define HAVE_RECORDING 25#define HAVE_RECORDING
diff --git a/firmware/export/config/sansaclipv2.h b/firmware/export/config/sansaclipv2.h
index df5e15d369..6e369db681 100644
--- a/firmware/export/config/sansaclipv2.h
+++ b/firmware/export/config/sansaclipv2.h
@@ -10,7 +10,7 @@
10/* Define if boot data from bootloader has been enabled for the target */ 10/* Define if boot data from bootloader has been enabled for the target */
11#define HAVE_BOOTDATA 11#define HAVE_BOOTDATA
12 12
13#define HW_SAMPR_CAPS SAMPR_CAP_ALL 13#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
14 14
15/* define this if you have recording possibility */ 15/* define this if you have recording possibility */
16#define HAVE_RECORDING 16#define HAVE_RECORDING
diff --git a/firmware/export/config/sansaclipzip.h b/firmware/export/config/sansaclipzip.h
index 01ba0e1346..6afe6e129e 100644
--- a/firmware/export/config/sansaclipzip.h
+++ b/firmware/export/config/sansaclipzip.h
@@ -20,7 +20,7 @@
20#define HAVE_RDS_CAP 20#define HAVE_RDS_CAP
21#endif 21#endif
22 22
23#define HW_SAMPR_CAPS SAMPR_CAP_ALL 23#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
24 24
25/* define this if you have recording possibility */ 25/* define this if you have recording possibility */
26#define HAVE_RECORDING 26#define HAVE_RECORDING
diff --git a/firmware/export/config/sansae200v2.h b/firmware/export/config/sansae200v2.h
index 211fee701b..27dd881e73 100644
--- a/firmware/export/config/sansae200v2.h
+++ b/firmware/export/config/sansae200v2.h
@@ -6,7 +6,7 @@
6#define MODEL_NUMBER 41 6#define MODEL_NUMBER 41
7#define MODEL_NAME "Sandisk Sansa e200v2 series" 7#define MODEL_NAME "Sandisk Sansa e200v2 series"
8 8
9#define HW_SAMPR_CAPS SAMPR_CAP_ALL 9#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
10 10
11/* define this if you have recording possibility */ 11/* define this if you have recording possibility */
12#define HAVE_RECORDING 12#define HAVE_RECORDING
diff --git a/firmware/export/config/sansafuze.h b/firmware/export/config/sansafuze.h
index fb17923e90..b72f5b5198 100644
--- a/firmware/export/config/sansafuze.h
+++ b/firmware/export/config/sansafuze.h
@@ -11,7 +11,7 @@
11/* define boot redirect file name allows booting from external drives */ 11/* define boot redirect file name allows booting from external drives */
12#define BOOT_REDIR "rockbox_main.fuze" 12#define BOOT_REDIR "rockbox_main.fuze"
13 13
14#define HW_SAMPR_CAPS SAMPR_CAP_ALL 14#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
15 15
16/* define this if you have recording possibility */ 16/* define this if you have recording possibility */
17#define HAVE_RECORDING 17#define HAVE_RECORDING
diff --git a/firmware/export/config/sansafuzeplus.h b/firmware/export/config/sansafuzeplus.h
index 0306b4d14a..aeb9153fcc 100644
--- a/firmware/export/config/sansafuzeplus.h
+++ b/firmware/export/config/sansafuzeplus.h
@@ -13,12 +13,12 @@
13/* define boot redirect file name allows booting from external drives */ 13/* define boot redirect file name allows booting from external drives */
14#define BOOT_REDIR "rockbox_main.fuze+" 14#define BOOT_REDIR "rockbox_main.fuze+"
15 15
16#define HW_SAMPR_CAPS SAMPR_CAP_ALL 16#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48
17 17
18/* define this if you have recording possibility */ 18/* define this if you have recording possibility */
19#define HAVE_RECORDING 19#define HAVE_RECORDING
20 20
21#define REC_SAMPR_CAPS SAMPR_CAP_ALL 21#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48
22 22
23/* Default recording levels */ 23/* Default recording levels */
24#define DEFAULT_REC_MIC_GAIN 23 24#define DEFAULT_REC_MIC_GAIN 23
diff --git a/firmware/export/config/sansafuzev2.h b/firmware/export/config/sansafuzev2.h
index 6c42e58f7a..fc2ff68257 100644
--- a/firmware/export/config/sansafuzev2.h
+++ b/firmware/export/config/sansafuzev2.h
@@ -11,7 +11,7 @@
11/* define boot redirect file name allows booting from external drives */ 11/* define boot redirect file name allows booting from external drives */
12#define BOOT_REDIR "rockbox_main.fuze2" 12#define BOOT_REDIR "rockbox_main.fuze2"
13 13
14#define HW_SAMPR_CAPS SAMPR_CAP_ALL 14#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
15 15
16/* define this if you have recording possibility */ 16/* define this if you have recording possibility */
17#define HAVE_RECORDING 17#define HAVE_RECORDING
diff --git a/firmware/export/config/sansam200v4.h b/firmware/export/config/sansam200v4.h
index b6ebaf4266..97462dc6e2 100644
--- a/firmware/export/config/sansam200v4.h
+++ b/firmware/export/config/sansam200v4.h
@@ -10,7 +10,7 @@
10/* Enable FAT16 support */ 10/* Enable FAT16 support */
11#define HAVE_FAT16SUPPORT 11#define HAVE_FAT16SUPPORT
12 12
13#define HW_SAMPR_CAPS SAMPR_CAP_ALL 13#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
14 14
15/* define this if you have recording possibility */ 15/* define this if you have recording possibility */
16#define HAVE_RECORDING 16#define HAVE_RECORDING
diff --git a/firmware/export/config/sonynwze360.h b/firmware/export/config/sonynwze360.h
index 7240070ba4..5b33d9d6d1 100644
--- a/firmware/export/config/sonynwze360.h
+++ b/firmware/export/config/sonynwze360.h
@@ -11,7 +11,7 @@
11/* Define if boot data from bootloader has been enabled for the target */ 11/* Define if boot data from bootloader has been enabled for the target */
12#define HAVE_BOOTDATA 12#define HAVE_BOOTDATA
13 13
14#define HW_SAMPR_CAPS SAMPR_CAP_ALL 14#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
15 15
16/* Define bitmask of input sources - recordable bitmask can be defined 16/* Define bitmask of input sources - recordable bitmask can be defined
17 explicitly if different */ 17 explicitly if different */
diff --git a/firmware/export/config/sonynwze370.h b/firmware/export/config/sonynwze370.h
index 08c5c4a99f..b20ab00550 100644
--- a/firmware/export/config/sonynwze370.h
+++ b/firmware/export/config/sonynwze370.h
@@ -11,7 +11,7 @@
11/* Define if boot data from bootloader has been enabled for the target */ 11/* Define if boot data from bootloader has been enabled for the target */
12#define HAVE_BOOTDATA 12#define HAVE_BOOTDATA
13 13
14#define HW_SAMPR_CAPS SAMPR_CAP_ALL 14#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
15 15
16/* Define bitmask of input sources - recordable bitmask can be defined 16/* Define bitmask of input sources - recordable bitmask can be defined
17 explicitly if different */ 17 explicitly if different */
diff --git a/firmware/export/config/xduoox20.h b/firmware/export/config/xduoox20.h
index 3cfa763f72..a61f2c3aa7 100644
--- a/firmware/export/config/xduoox20.h
+++ b/firmware/export/config/xduoox20.h
@@ -123,8 +123,7 @@
123#define HAVE_SW_TONE_CONTROLS 123#define HAVE_SW_TONE_CONTROLS
124 124
125/* HW codec is flexible */ 125/* HW codec is flexible */
126#define HW_SAMPR_CAPS SAMPR_CAP_ALL 126#define HW_SAMPR_CAPS SAMPR_CAP_ALL_192
127#define HAVE_PLAY_FREQ
128 127
129/* Battery */ 128/* Battery */
130#define BATTERY_CAPACITY_DEFAULT 2400 /* default battery capacity */ 129#define BATTERY_CAPACITY_DEFAULT 2400 /* default battery capacity */
diff --git a/firmware/export/config/xduoox3.h b/firmware/export/config/xduoox3.h
index 7de8fa1510..4c2cc47fc9 100644
--- a/firmware/export/config/xduoox3.h
+++ b/firmware/export/config/xduoox3.h
@@ -17,9 +17,6 @@
17/* ChinaChip NAND FTL */ 17/* ChinaChip NAND FTL */
18#define CONFIG_NAND NAND_CC 18#define CONFIG_NAND NAND_CC
19 19
20
21
22
23/* define this if you have access to the quickscreen */ 20/* define this if you have access to the quickscreen */
24#define HAVE_QUICKSCREEN 21#define HAVE_QUICKSCREEN
25 22
@@ -112,8 +109,7 @@
112#define HAVE_SW_TONE_CONTROLS 109#define HAVE_SW_TONE_CONTROLS
113 110
114/* define the bitmask of hardware sample rates */ 111/* define the bitmask of hardware sample rates */
115#define HW_SAMPR_CAPS SAMPR_CAP_ALL 112#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
116#define HAVE_PLAY_FREQ
117 113
118#define AB_REPEAT_ENABLE 114#define AB_REPEAT_ENABLE
119 115
diff --git a/firmware/export/config/xduoox3ii.h b/firmware/export/config/xduoox3ii.h
index 42fb926697..13072ea3dc 100644
--- a/firmware/export/config/xduoox3ii.h
+++ b/firmware/export/config/xduoox3ii.h
@@ -17,9 +17,6 @@
17#define CONFIG_PLATFORM (PLATFORM_HOSTED) 17#define CONFIG_PLATFORM (PLATFORM_HOSTED)
18#endif 18#endif
19 19
20
21
22
23/* define this if you have a colour LCD */ 20/* define this if you have a colour LCD */
24#define HAVE_LCD_COLOR 21#define HAVE_LCD_COLOR
25 22
@@ -72,9 +69,6 @@
72/* The number of bytes reserved for loadable plugins */ 69/* The number of bytes reserved for loadable plugins */
73#define PLUGIN_BUFFER_SIZE 0x100000 70#define PLUGIN_BUFFER_SIZE 0x100000
74 71
75
76
77
78#define HAVE_HEADPHONE_DETECTION 72#define HAVE_HEADPHONE_DETECTION
79 73
80/* KeyPad configuration for plugins */ 74/* KeyPad configuration for plugins */
@@ -123,8 +117,7 @@
123#define HAVE_SW_TONE_CONTROLS 117#define HAVE_SW_TONE_CONTROLS
124 118
125/* HW codec is flexible */ 119/* HW codec is flexible */
126#define HW_SAMPR_CAPS SAMPR_CAP_ALL 120#define HW_SAMPR_CAPS SAMPR_CAP_ALL_192
127#define HAVE_PLAY_FREQ
128 121
129/* Battery */ 122/* Battery */
130#define BATTERY_CAPACITY_DEFAULT 2000 /* default battery capacity */ 123#define BATTERY_CAPACITY_DEFAULT 2000 /* default battery capacity */
diff --git a/firmware/export/config_caps.h b/firmware/export/config_caps.h
index bc0a42bedf..fe32e4953c 100644
--- a/firmware/export/config_caps.h
+++ b/firmware/export/config_caps.h
@@ -122,7 +122,6 @@
122#include "pcm_sampr.h" 122#include "pcm_sampr.h"
123#undef PCM_SAMPR_CONFIG_ONLY 123#undef PCM_SAMPR_CONFIG_ONLY
124 124
125#define PLAY_SAMPR_CAPS (HW_SAMPR_CAPS & (SAMPR_CAP_44 | SAMPR_CAP_48))
126/** 125/**
127 * PLAY_SAMPR_MIN: The minimum allowable samplerate for global playback. 126 * PLAY_SAMPR_MIN: The minimum allowable samplerate for global playback.
128 * Music won't play at a lower rate. 127 * Music won't play at a lower rate.
@@ -133,18 +132,30 @@
133 * as the DSP core. DSP never exceeds *MAX to lessen 132 * as the DSP core. DSP never exceeds *MAX to lessen
134 * buffer allocation demands and overhead. 133 * buffer allocation demands and overhead.
135 */ 134 */
136#if PLAY_SAMPR_CAPS & (PLAY_SAMPR_CAPS - 1) 135#if (HW_SAMPR_CAPS & SAMPR_CAP_192)
137#define HAVE_PLAY_FREQ 136#define HAVE_PLAY_FREQ 192
137# define PLAY_SAMPR_MIN SAMPR_44
138# define PLAY_SAMPR_MAX SAMPR_192
139# define PLAY_SAMPR_DEFAULT SAMPR_44
140# define PLAY_SAMPR_HW_MIN HW_SAMPR_MIN
141#elif (HW_SAMPR_CAPS & SAMPR_CAP_96)
142#define HAVE_PLAY_FREQ 96
143# define PLAY_SAMPR_MIN SAMPR_44
144# define PLAY_SAMPR_MAX SAMPR_96
145# define PLAY_SAMPR_DEFAULT SAMPR_44
146# define PLAY_SAMPR_HW_MIN HW_SAMPR_MIN
147#elif ((HW_SAMPR_CAPS & (SAMPR_CAP_48 | SAMPR_CAP_44)) == (SAMPR_CAP_48 | SAMPR_CAP_44))
148#define HAVE_PLAY_FREQ 48
138# define PLAY_SAMPR_MIN SAMPR_44 149# define PLAY_SAMPR_MIN SAMPR_44
139# define PLAY_SAMPR_MAX SAMPR_48 150# define PLAY_SAMPR_MAX SAMPR_48
140# define PLAY_SAMPR_DEFAULT SAMPR_44 151# define PLAY_SAMPR_DEFAULT SAMPR_44
141# define PLAY_SAMPR_HW_MIN HW_SAMPR_MIN 152# define PLAY_SAMPR_HW_MIN HW_SAMPR_MIN
142#elif PLAY_SAMPR_CAPS & SAMPR_CAP_44 153#elif (HW_SAMPR_CAPS & SAMPR_CAP_44)
143# define PLAY_SAMPR_MIN SAMPR_44 154# define PLAY_SAMPR_MIN SAMPR_44
144# define PLAY_SAMPR_MAX SAMPR_44 155# define PLAY_SAMPR_MAX SAMPR_44
145# define PLAY_SAMPR_DEFAULT SAMPR_44 156# define PLAY_SAMPR_DEFAULT SAMPR_44
146# define PLAY_SAMPR_HW_MIN HW_SAMPR_MIN 157# define PLAY_SAMPR_HW_MIN HW_SAMPR_MIN
147#elif PLAY_SAMPR_CAPS & SAMPR_CAP_48 158#elif (HW_SAMPR_CAPS & SAMPR_CAP_48)
148# define PLAY_SAMPR_MIN SAMPR_48 159# define PLAY_SAMPR_MIN SAMPR_48
149# define PLAY_SAMPR_MAX SAMPR_48 160# define PLAY_SAMPR_MAX SAMPR_48
150# define PLAY_SAMPR_DEFAULT SAMPR_48 161# define PLAY_SAMPR_DEFAULT SAMPR_48
diff --git a/firmware/export/pcm_sampr.h b/firmware/export/pcm_sampr.h
index 84f4466308..70f2dc2ba2 100644
--- a/firmware/export/pcm_sampr.h
+++ b/firmware/export/pcm_sampr.h
@@ -34,21 +34,25 @@
34/* These must be macros for comparison with SAMPR_CAP_* flags by the 34/* These must be macros for comparison with SAMPR_CAP_* flags by the
35 preprocessor. Add samplerate index in descending order renumbering 35 preprocessor. Add samplerate index in descending order renumbering
36 the ones later in the list if any */ 36 the ones later in the list if any */
37#define FREQ_96 0 37#define FREQ_192 0
38#define FREQ_88 1 38#define FREQ_176 1
39#define FREQ_64 2 39#define FREQ_96 2
40#define FREQ_48 3 40#define FREQ_88 3
41#define FREQ_44 4 41#define FREQ_64 4
42#define FREQ_32 5 42#define FREQ_48 5
43#define FREQ_24 6 43#define FREQ_44 6
44#define FREQ_22 7 44#define FREQ_32 7
45#define FREQ_16 8 45#define FREQ_24 8
46#define FREQ_12 9 46#define FREQ_22 9
47#define FREQ_11 10 47#define FREQ_16 10
48#define FREQ_8 11 48#define FREQ_12 11
49#define SAMPR_NUM_FREQ 12 49#define FREQ_11 12
50#define FREQ_8 13
51#define SAMPR_NUM_FREQ 14
50 52
51/* sample rate values in HZ */ 53/* sample rate values in HZ */
54#define SAMPR_192 192000
55#define SAMPR_176 176400
52#define SAMPR_96 96000 56#define SAMPR_96 96000
53#define SAMPR_88 88200 57#define SAMPR_88 88200
54#define SAMPR_64 64000 58#define SAMPR_64 64000
@@ -63,6 +67,8 @@
63#define SAMPR_8 8000 67#define SAMPR_8 8000
64 68
65/* sample rate capability bits */ 69/* sample rate capability bits */
70#define SAMPR_CAP_192 (1 << FREQ_192)
71#define SAMPR_CAP_176 (1 << FREQ_176)
66#define SAMPR_CAP_96 (1 << FREQ_96) 72#define SAMPR_CAP_96 (1 << FREQ_96)
67#define SAMPR_CAP_88 (1 << FREQ_88) 73#define SAMPR_CAP_88 (1 << FREQ_88)
68#define SAMPR_CAP_64 (1 << FREQ_64) 74#define SAMPR_CAP_64 (1 << FREQ_64)
@@ -75,13 +81,25 @@
75#define SAMPR_CAP_12 (1 << FREQ_12) 81#define SAMPR_CAP_12 (1 << FREQ_12)
76#define SAMPR_CAP_11 (1 << FREQ_11) 82#define SAMPR_CAP_11 (1 << FREQ_11)
77#define SAMPR_CAP_8 (1 << FREQ_8) 83#define SAMPR_CAP_8 (1 << FREQ_8)
78#define SAMPR_CAP_ALL (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \ 84
85#define SAMPR_CAP_ALL_192 (SAMPR_CAP_192 | SAMPR_CAP_176 | \
86 SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \
87 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
88 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \
89 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
90
91#define SAMPR_CAP_ALL_96 (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \
79 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ 92 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
80 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ 93 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \
81 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8) 94 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
82 95
96#define SAMPR_CAP_ALL_48 (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
97 SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \
98 SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
99
83/* List of sampling rates that are good enough for most purposes. */ 100/* List of sampling rates that are good enough for most purposes. */
84#define SAMPR_CAP_ALL_GE_22 (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \ 101#define SAMPR_CAP_ALL_GE_22 (SAMPR_CAP_192 | SAMPR_CAP_176 | \
102 SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \
85 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ 103 SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
86 SAMPR_CAP_24 | SAMPR_CAP_22) 104 SAMPR_CAP_24 | SAMPR_CAP_22)
87 105
@@ -99,13 +117,29 @@ enum hw_freq_indexes
99{ 117{
100 __HW_FREQ_START_INDEX = -1, /* Make sure first in list is 0 */ 118 __HW_FREQ_START_INDEX = -1, /* Make sure first in list is 0 */
101 119
120/* 192000 */
121#if (HW_SAMPR_CAPS & SAMPR_CAP_192) /* Macros and enums for each FREQ: */
122 HW_FREQ_192, /* Index in enumeration */
123#define HW_HAVE_192 /* Defined if this FREQ is defined */
124#define HW_HAVE_192_(...) __VA_ARGS__ /* Output its parameters for this FREQ */
125#else
126#define HW_HAVE_192_(...) /* Discards its parameters for this FREQ */
127#endif
128/* 176400 */
129#if (HW_SAMPR_CAPS & SAMPR_CAP_176)
130 HW_FREQ_176,
131#define HW_HAVE_176
132#define HW_HAVE_176_(...) __VA_ARGS__
133#else
134#define HW_HAVE_176_(...)
135#endif
102/* 96000 */ 136/* 96000 */
103#if (HW_SAMPR_CAPS & SAMPR_CAP_96) /* Macros and enums for each FREQ: */ 137#if (HW_SAMPR_CAPS & SAMPR_CAP_96)
104 HW_FREQ_96, /* Index in enumeration */ 138 HW_FREQ_96,
105#define HW_HAVE_96 /* Defined if this FREQ is defined */ 139#define HW_HAVE_96
106#define HW_HAVE_96_(...) __VA_ARGS__ /* Output its parameters for this FREQ */ 140#define HW_HAVE_96_(...) __VA_ARGS__
107#else 141#else
108#define HW_HAVE_96_(...) /* Discards its parameters for this FREQ */ 142#define HW_HAVE_96_(...)
109#endif 143#endif
110/* 88200 */ 144/* 88200 */
111#if (HW_SAMPR_CAPS & SAMPR_CAP_88) 145#if (HW_SAMPR_CAPS & SAMPR_CAP_88)
@@ -202,11 +236,22 @@ enum hw_freq_indexes
202extern const unsigned long hw_freq_sampr[HW_NUM_FREQ]; 236extern const unsigned long hw_freq_sampr[HW_NUM_FREQ];
203#endif /* PCM_SAMPR_CONFIG_ONLY */ 237#endif /* PCM_SAMPR_CONFIG_ONLY */
204 238
239#if HW_SAMPR_CAPS & SAMPR_CAP_44
205#define HW_FREQ_DEFAULT HW_FREQ_44 240#define HW_FREQ_DEFAULT HW_FREQ_44
206#define HW_SAMPR_DEFAULT SAMPR_44 241#define HW_SAMPR_DEFAULT SAMPR_44
242#elif HW_SAMPR_CAPS & SAMPR_CAP_48
243#define HW_FREQ_DEFAULT HW_FREQ_48
244#define HW_SAMPR_DEFAULT SAMPR_48
245#else
246#error "Neither 48 or 44KHz supported?"
247#endif
207 248
208 249
209#if HW_SAMPR_CAPS & SAMPR_CAP_96 250#if HW_SAMPR_CAPS & SAMPR_CAP_192
251# define HW_SAMPR_MAX SAMPR_192
252#elif HW_SAMPR_CAPS & SAMPR_CAP_176
253# define HW_SAMPR_MAX SAMPR_176
254#elif HW_SAMPR_CAPS & SAMPR_CAP_96
210# define HW_SAMPR_MAX SAMPR_96 255# define HW_SAMPR_MAX SAMPR_96
211#elif HW_SAMPR_CAPS & SAMPR_CAP_88 256#elif HW_SAMPR_CAPS & SAMPR_CAP_88
212# define HW_SAMPR_MAX SAMPR_88 257# define HW_SAMPR_MAX SAMPR_88