diff --git a/module_usb_audio/devicedefines.h b/module_usb_audio/devicedefines.h index 70d901bc..6db781ed 100644 --- a/module_usb_audio/devicedefines.h +++ b/module_usb_audio/devicedefines.h @@ -160,6 +160,10 @@ #error MCLK_441 not defined #endif +#if defined(AUDIO_CLASS_FALLBACK) && (AUDIO_CLASS_FALLBACK==0) +#undef AUDIO_CLASS_FALLBACK +#endif + /* The number of clock ticks to wait for the audio PLL to lock */ #define AUDIO_PLL_LOCK_DELAY (40000000) @@ -174,8 +178,22 @@ #define VENDOR_ID (0x20B1) /* XMOS VID */ #endif -#if defined(AUDIO_CLASS_FALLBACK) && (AUDIO_CLASS_FALLBACK==0) -#undef AUDIO_CLASS_FALLBACK +#ifdef PRODUCT_STR +#define PRODUCT_STR_A2 PRODUCT_STR +#define PRODUCT_STR_A1 PRODUCT_STR +#endif + +/* Product string for Audio Class 2.0 mode */ +#ifndef PRODUCT_STR_A2 +#warning PRODUCT_STR_A2 not defined. Using default string +#define PRODUCT_STR_A2 "xCORE USB Audio 2.0 " +#endif + + +/* Product string for Audio Class 1.0 mode */ +#ifndef PRODUCT_STR_A1 +#warning PRODUCT_STR_A1 not defined. Using default string +#define PRODUCT_STR_A1 "xCORE USB Audio 1.0 " #endif #if (AUDIO_CLASS==1) || defined(AUDIO_CLASS_FALLBACK) diff --git a/module_usb_audio/endpoint0/descriptors_2.h b/module_usb_audio/endpoint0/descriptors_2.h index d974a35b..194acd82 100644 --- a/module_usb_audio/endpoint0/descriptors_2.h +++ b/module_usb_audio/endpoint0/descriptors_2.h @@ -1310,8 +1310,6 @@ unsigned char cfgDesc_Audio2[] = -#define APPEND_VENDOR_STR(x) VENDOR_STR#x - /* String table */ #ifdef SPDIF_RX #define SPDIF_RX_NUM_STRS 1 @@ -1337,30 +1335,42 @@ unsigned char cfgDesc_Audio2[] = #define DFU_NUM_STRS 0 #endif - #define STR_INDEX_OUT_CHAN (10 + SPDIF_RX_NUM_STRS + ADAT_RX_NUM_STRS + MIDI_NUM_STRS + DFU_NUM_STRS) #define STR_INDEX_IN_CHAN (STR_INDEX_OUT_CHAN + NUM_USB_CHAN_OUT) + +#define APPEND_VENDOR_STR(x) VENDOR_STR#x + +//#define xstr(s) str(s) +//#define str(s) #s + + +#define APPEND_PRODUCT_STR_A2_(x) PRODUCT_STR_A2 #x +#define APPEND_PRODUCT_STR_A2(x) APPEND_PRODUCT_STR_A2_(x) + +#define APPEND_PRODUCT_STR_A1_(x) PRODUCT_STR_A1 #x +#define APPEND_PRODUCT_STR_A1(x) APPEND_PRODUCT_STR_A1_(x) + static unsigned char strDescs[][40] = { - "Langids", /* String 0 (LangIDs) place holder */ + "Langids", /* 0 LangIDs) place holder */ APPEND_VENDOR_STR( ), // 1 iManufacturer (at MANUFACTURER_STRING_INDEX) /* Audio 2.0 Strings */ - APPEND_VENDOR_STR(USB Audio 2.0), // 2 iProduct and iInterface for control interface (at PRODUCT_STR_INDEX) + PRODUCT_STR_A2, // 2 iProduct and iInterface for control interface (at PRODUCT_STR_INDEX) "",//SERIAL_STR, // 3 iSerialNumber (at SERIAL_STR_INDEX) - APPEND_VENDOR_STR(USB 2.0 Audio Out), // 4 iInterface for Streaming interaces - APPEND_VENDOR_STR(USB 2.0 Audio In), // 5 + APPEND_PRODUCT_STR_A2(Output), // 4 iInterface for Streaming interaces + APPEND_PRODUCT_STR_A2(Input), // 5 - APPEND_VENDOR_STR(Audio 2.0 Output), // 6 "USB Input Terminal" (User sees as output from host) - APPEND_VENDOR_STR(Audio 2.0 Input), // 7 "USB Output Terminal" (User sees as input to host) + APPEND_PRODUCT_STR_A2(Output), // 6 "USB Input Terminal" (User sees as output from host) + APPEND_PRODUCT_STR_A2(Input), // 7 "USB Output Terminal" (User sees as input to host) /* Audio 1.0 Strings */ - APPEND_VENDOR_STR(USB Audio 1.0), // 8 iProduct and iInterface for control interface - APPEND_VENDOR_STR(USB 1.0 Audio Out), // 9 iInterface for Streaming interaces - APPEND_VENDOR_STR(USB 1.0 Audio In), // 10 - APPEND_VENDOR_STR(Audio 1.0 Output), // 11 "USB Input Terminal" (User sees as output from host) - APPEND_VENDOR_STR(Audio 1.0 Input), // 12 "USB Output Terminal" (User sees as input to host) + PRODUCT_STR_A1, // 8 iProduct and iInterface for control interface + APPEND_PRODUCT_STR_A1(Output), // 9 iInterface for Streaming interaces + APPEND_PRODUCT_STR_A1(Input), // 10 + APPEND_PRODUCT_STR_A1(Output), // 11 "USB Input Terminal" (User sees as output from host) + APPEND_PRODUCT_STR_A1(Input), // 12 "USB Output Terminal" (User sees as input to host) APPEND_VENDOR_STR(Clock Selector), // 13 iClockSel APPEND_VENDOR_STR(Internal Clock), // 14 iClockSource