From 01650b8bc9e400d3b90ebfba403033c7a87bc35e Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Wed, 30 Sep 2020 18:21:38 -0400 Subject: 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 --- apps/enc_config.c | 2 +- apps/playback.c | 32 +++++++++- apps/settings_list.c | 10 ++++ firmware/export/config.h | 2 +- firmware/export/config/agptekrocker.h | 3 +- firmware/export/config/creativezen.h | 4 +- firmware/export/config/creativezenmozaic.h | 4 +- firmware/export/config/creativezenv.h | 4 +- firmware/export/config/creativezenxfi.h | 4 +- firmware/export/config/creativezenxfi2.h | 4 +- firmware/export/config/creativezenxfi3.h | 4 +- firmware/export/config/creativezenxfistyle.h | 4 +- firmware/export/config/ibassodx50.h | 3 +- firmware/export/config/ibassodx90.h | 3 +- firmware/export/config/samsungypz5.h | 4 +- firmware/export/config/sansac200v2.h | 2 +- firmware/export/config/sansaclip.h | 2 +- firmware/export/config/sansaclipplus.h | 2 +- firmware/export/config/sansaclipv2.h | 2 +- firmware/export/config/sansaclipzip.h | 2 +- firmware/export/config/sansae200v2.h | 2 +- firmware/export/config/sansafuze.h | 2 +- firmware/export/config/sansafuzeplus.h | 4 +- firmware/export/config/sansafuzev2.h | 2 +- firmware/export/config/sansam200v4.h | 2 +- firmware/export/config/sonynwze360.h | 2 +- firmware/export/config/sonynwze370.h | 2 +- firmware/export/config/xduoox20.h | 3 +- firmware/export/config/xduoox3.h | 6 +- firmware/export/config/xduoox3ii.h | 9 +-- firmware/export/config_caps.h | 21 +++++-- firmware/export/pcm_sampr.h | 87 +++++++++++++++++++++------- 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, 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 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 */ #elif defined(XDUOO_X20) #include "config/xduoox20.h" #else -/* no known platform */ +//#error "unknown hwardware platform!" #endif #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 @@ #define HAVE_SW_TONE_CONTROLS /* HW codec is flexible */ -#define HW_SAMPR_CAPS SAMPR_CAP_ALL -#define HAVE_PLAY_FREQ +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_192 /* Battery */ #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 @@ /* Define if boot data from bootloader has been enabled for the target */ #define HAVE_BOOTDATA -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48 /* define this if you have recording possibility */ #define HAVE_RECORDING -#define REC_SAMPR_CAPS SAMPR_CAP_ALL +#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48 /* Default recording levels */ #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 @@ #define MODEL_NUMBER 87 #define MODEL_NAME "Creative ZEN Mozaic" -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48 /* define this if you have recording possibility */ #define HAVE_RECORDING -#define REC_SAMPR_CAPS SAMPR_CAP_ALL +#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48 /* Default recording levels */ #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 @@ #define MODEL_NUMBER 92 #define MODEL_NAME "Creative ZEN V" -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48 /* define this if you have recording possibility */ #define HAVE_RECORDING -#define REC_SAMPR_CAPS SAMPR_CAP_ALL +#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48 /* Default recording levels */ #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 @@ #define MODEL_NUMBER 86 #define MODEL_NAME "Creative Zen X-Fi" -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48 /* define this if you have recording possibility */ #define HAVE_RECORDING -#define REC_SAMPR_CAPS SAMPR_CAP_ALL +#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48 /* Default recording levels */ #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 @@ /* Define if boot data from bootloader has been enabled for the target */ #define HAVE_BOOTDATA -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48 /* define this if you have recording possibility */ #define HAVE_RECORDING -#define REC_SAMPR_CAPS SAMPR_CAP_ALL +#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48 /* Default recording levels */ #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 @@ /* Define if boot data from bootloader has been enabled for the target */ #define HAVE_BOOTDATA -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48 /* define this if you have recording possibility */ #define HAVE_RECORDING -#define REC_SAMPR_CAPS SAMPR_CAP_ALL +#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48 /* Default recording levels */ #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 @@ #define MODEL_NUMBER 94 #define MODEL_NAME "Creative Zen X-Fi Style" -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48 /* define this if you have recording possibility */ #define HAVE_RECORDING -#define REC_SAMPR_CAPS SAMPR_CAP_ALL +#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48 /* Default recording levels */ #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 @@ #define HAVE_SW_TONE_CONTROLS #define HAVE_SW_VOLUME_CONTROL -#define HW_SAMPR_CAPS SAMPR_CAP_ALL -#define HAVE_PLAY_FREQ +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 //#define HAVE_MULTIMEDIA_KEYS #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 @@ #define HAVE_SW_TONE_CONTROLS #define HAVE_SW_VOLUME_CONTROL -#define HW_SAMPR_CAPS SAMPR_CAP_ALL -#define HAVE_PLAY_FREQ +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 //#define HAVE_MULTIMEDIA_KEYS #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 @@ /* Define if boot data from bootloader has been enabled for the target */ #define HAVE_BOOTDATA -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48 /* define this if you have recording possibility */ #define HAVE_RECORDING -#define REC_SAMPR_CAPS SAMPR_CAP_ALL +#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48 /* Default recording levels */ #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 @@ #define FIRMWARE_OFFSET_FILE_DATA 8 #define FIRMWARE_OFFSET_FILE_CRC 0 -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* define this if you have recording possibility */ #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 @@ #define FIRMWARE_OFFSET_FILE_DATA 8 #define FIRMWARE_OFFSET_FILE_CRC 0 -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* define this if you have recording possibility */ #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 @@ #define HAVE_HOTSWAP #endif -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* define this if you have recording possibility */ #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 @@ /* Define if boot data from bootloader has been enabled for the target */ #define HAVE_BOOTDATA -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* define this if you have recording possibility */ #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 @@ #define HAVE_RDS_CAP #endif -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* define this if you have recording possibility */ #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 @@ #define MODEL_NUMBER 41 #define MODEL_NAME "Sandisk Sansa e200v2 series" -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* define this if you have recording possibility */ #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 @@ /* define boot redirect file name allows booting from external drives */ #define BOOT_REDIR "rockbox_main.fuze" -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* define this if you have recording possibility */ #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 @@ /* define boot redirect file name allows booting from external drives */ #define BOOT_REDIR "rockbox_main.fuze+" -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_48 /* define this if you have recording possibility */ #define HAVE_RECORDING -#define REC_SAMPR_CAPS SAMPR_CAP_ALL +#define REC_SAMPR_CAPS SAMPR_CAP_ALL_48 /* Default recording levels */ #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 @@ /* define boot redirect file name allows booting from external drives */ #define BOOT_REDIR "rockbox_main.fuze2" -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* define this if you have recording possibility */ #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 @@ /* Enable FAT16 support */ #define HAVE_FAT16SUPPORT -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* define this if you have recording possibility */ #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 @@ /* Define if boot data from bootloader has been enabled for the target */ #define HAVE_BOOTDATA -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* Define bitmask of input sources - recordable bitmask can be defined 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 @@ /* Define if boot data from bootloader has been enabled for the target */ #define HAVE_BOOTDATA -#define HW_SAMPR_CAPS SAMPR_CAP_ALL +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 /* Define bitmask of input sources - recordable bitmask can be defined 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 @@ #define HAVE_SW_TONE_CONTROLS /* HW codec is flexible */ -#define HW_SAMPR_CAPS SAMPR_CAP_ALL -#define HAVE_PLAY_FREQ +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_192 /* Battery */ #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 @@ /* ChinaChip NAND FTL */ #define CONFIG_NAND NAND_CC - - - /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN @@ -112,8 +109,7 @@ #define HAVE_SW_TONE_CONTROLS /* define the bitmask of hardware sample rates */ -#define HW_SAMPR_CAPS SAMPR_CAP_ALL -#define HAVE_PLAY_FREQ +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96 #define AB_REPEAT_ENABLE 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 @@ #define CONFIG_PLATFORM (PLATFORM_HOSTED) #endif - - - /* define this if you have a colour LCD */ #define HAVE_LCD_COLOR @@ -72,9 +69,6 @@ /* The number of bytes reserved for loadable plugins */ #define PLUGIN_BUFFER_SIZE 0x100000 - - - #define HAVE_HEADPHONE_DETECTION /* KeyPad configuration for plugins */ @@ -123,8 +117,7 @@ #define HAVE_SW_TONE_CONTROLS /* HW codec is flexible */ -#define HW_SAMPR_CAPS SAMPR_CAP_ALL -#define HAVE_PLAY_FREQ +#define HW_SAMPR_CAPS SAMPR_CAP_ALL_192 /* Battery */ #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 @@ #include "pcm_sampr.h" #undef PCM_SAMPR_CONFIG_ONLY -#define PLAY_SAMPR_CAPS (HW_SAMPR_CAPS & (SAMPR_CAP_44 | SAMPR_CAP_48)) /** * PLAY_SAMPR_MIN: The minimum allowable samplerate for global playback. * Music won't play at a lower rate. @@ -133,18 +132,30 @@ * as the DSP core. DSP never exceeds *MAX to lessen * buffer allocation demands and overhead. */ -#if PLAY_SAMPR_CAPS & (PLAY_SAMPR_CAPS - 1) -#define HAVE_PLAY_FREQ +#if (HW_SAMPR_CAPS & SAMPR_CAP_192) +#define HAVE_PLAY_FREQ 192 +# define PLAY_SAMPR_MIN SAMPR_44 +# define PLAY_SAMPR_MAX SAMPR_192 +# define PLAY_SAMPR_DEFAULT SAMPR_44 +# define PLAY_SAMPR_HW_MIN HW_SAMPR_MIN +#elif (HW_SAMPR_CAPS & SAMPR_CAP_96) +#define HAVE_PLAY_FREQ 96 +# define PLAY_SAMPR_MIN SAMPR_44 +# define PLAY_SAMPR_MAX SAMPR_96 +# define PLAY_SAMPR_DEFAULT SAMPR_44 +# define PLAY_SAMPR_HW_MIN HW_SAMPR_MIN +#elif ((HW_SAMPR_CAPS & (SAMPR_CAP_48 | SAMPR_CAP_44)) == (SAMPR_CAP_48 | SAMPR_CAP_44)) +#define HAVE_PLAY_FREQ 48 # define PLAY_SAMPR_MIN SAMPR_44 # define PLAY_SAMPR_MAX SAMPR_48 # define PLAY_SAMPR_DEFAULT SAMPR_44 # define PLAY_SAMPR_HW_MIN HW_SAMPR_MIN -#elif PLAY_SAMPR_CAPS & SAMPR_CAP_44 +#elif (HW_SAMPR_CAPS & SAMPR_CAP_44) # define PLAY_SAMPR_MIN SAMPR_44 # define PLAY_SAMPR_MAX SAMPR_44 # define PLAY_SAMPR_DEFAULT SAMPR_44 # define PLAY_SAMPR_HW_MIN HW_SAMPR_MIN -#elif PLAY_SAMPR_CAPS & SAMPR_CAP_48 +#elif (HW_SAMPR_CAPS & SAMPR_CAP_48) # define PLAY_SAMPR_MIN SAMPR_48 # define PLAY_SAMPR_MAX SAMPR_48 # 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 @@ /* These must be macros for comparison with SAMPR_CAP_* flags by the preprocessor. Add samplerate index in descending order renumbering the ones later in the list if any */ -#define FREQ_96 0 -#define FREQ_88 1 -#define FREQ_64 2 -#define FREQ_48 3 -#define FREQ_44 4 -#define FREQ_32 5 -#define FREQ_24 6 -#define FREQ_22 7 -#define FREQ_16 8 -#define FREQ_12 9 -#define FREQ_11 10 -#define FREQ_8 11 -#define SAMPR_NUM_FREQ 12 +#define FREQ_192 0 +#define FREQ_176 1 +#define FREQ_96 2 +#define FREQ_88 3 +#define FREQ_64 4 +#define FREQ_48 5 +#define FREQ_44 6 +#define FREQ_32 7 +#define FREQ_24 8 +#define FREQ_22 9 +#define FREQ_16 10 +#define FREQ_12 11 +#define FREQ_11 12 +#define FREQ_8 13 +#define SAMPR_NUM_FREQ 14 /* sample rate values in HZ */ +#define SAMPR_192 192000 +#define SAMPR_176 176400 #define SAMPR_96 96000 #define SAMPR_88 88200 #define SAMPR_64 64000 @@ -63,6 +67,8 @@ #define SAMPR_8 8000 /* sample rate capability bits */ +#define SAMPR_CAP_192 (1 << FREQ_192) +#define SAMPR_CAP_176 (1 << FREQ_176) #define SAMPR_CAP_96 (1 << FREQ_96) #define SAMPR_CAP_88 (1 << FREQ_88) #define SAMPR_CAP_64 (1 << FREQ_64) @@ -75,13 +81,25 @@ #define SAMPR_CAP_12 (1 << FREQ_12) #define SAMPR_CAP_11 (1 << FREQ_11) #define SAMPR_CAP_8 (1 << FREQ_8) -#define SAMPR_CAP_ALL (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \ + +#define SAMPR_CAP_ALL_192 (SAMPR_CAP_192 | SAMPR_CAP_176 | \ + SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \ + SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ + SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ + SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8) + +#define SAMPR_CAP_ALL_96 (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \ SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8) +#define SAMPR_CAP_ALL_48 (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ + SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ + SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8) + /* List of sampling rates that are good enough for most purposes. */ -#define SAMPR_CAP_ALL_GE_22 (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \ +#define SAMPR_CAP_ALL_GE_22 (SAMPR_CAP_192 | SAMPR_CAP_176 | \ + SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \ SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ SAMPR_CAP_24 | SAMPR_CAP_22) @@ -99,13 +117,29 @@ enum hw_freq_indexes { __HW_FREQ_START_INDEX = -1, /* Make sure first in list is 0 */ +/* 192000 */ +#if (HW_SAMPR_CAPS & SAMPR_CAP_192) /* Macros and enums for each FREQ: */ + HW_FREQ_192, /* Index in enumeration */ +#define HW_HAVE_192 /* Defined if this FREQ is defined */ +#define HW_HAVE_192_(...) __VA_ARGS__ /* Output its parameters for this FREQ */ +#else +#define HW_HAVE_192_(...) /* Discards its parameters for this FREQ */ +#endif +/* 176400 */ +#if (HW_SAMPR_CAPS & SAMPR_CAP_176) + HW_FREQ_176, +#define HW_HAVE_176 +#define HW_HAVE_176_(...) __VA_ARGS__ +#else +#define HW_HAVE_176_(...) +#endif /* 96000 */ -#if (HW_SAMPR_CAPS & SAMPR_CAP_96) /* Macros and enums for each FREQ: */ - HW_FREQ_96, /* Index in enumeration */ -#define HW_HAVE_96 /* Defined if this FREQ is defined */ -#define HW_HAVE_96_(...) __VA_ARGS__ /* Output its parameters for this FREQ */ +#if (HW_SAMPR_CAPS & SAMPR_CAP_96) + HW_FREQ_96, +#define HW_HAVE_96 +#define HW_HAVE_96_(...) __VA_ARGS__ #else -#define HW_HAVE_96_(...) /* Discards its parameters for this FREQ */ +#define HW_HAVE_96_(...) #endif /* 88200 */ #if (HW_SAMPR_CAPS & SAMPR_CAP_88) @@ -202,11 +236,22 @@ enum hw_freq_indexes extern const unsigned long hw_freq_sampr[HW_NUM_FREQ]; #endif /* PCM_SAMPR_CONFIG_ONLY */ +#if HW_SAMPR_CAPS & SAMPR_CAP_44 #define HW_FREQ_DEFAULT HW_FREQ_44 #define HW_SAMPR_DEFAULT SAMPR_44 +#elif HW_SAMPR_CAPS & SAMPR_CAP_48 +#define HW_FREQ_DEFAULT HW_FREQ_48 +#define HW_SAMPR_DEFAULT SAMPR_48 +#else +#error "Neither 48 or 44KHz supported?" +#endif -#if HW_SAMPR_CAPS & SAMPR_CAP_96 +#if HW_SAMPR_CAPS & SAMPR_CAP_192 +# define HW_SAMPR_MAX SAMPR_192 +#elif HW_SAMPR_CAPS & SAMPR_CAP_176 +# define HW_SAMPR_MAX SAMPR_176 +#elif HW_SAMPR_CAPS & SAMPR_CAP_96 # define HW_SAMPR_MAX SAMPR_96 #elif HW_SAMPR_CAPS & SAMPR_CAP_88 # define HW_SAMPR_MAX SAMPR_88 -- cgit v1.2.3