[Taranis/sky9x] SD sounds directory /SOUNDS/en/SYSTEM instead of /SOUNDS/SYSTEM/en
This commit is contained in:
+13
-11
@@ -97,8 +97,8 @@ void refreshSystemAudioFiles()
|
||||
info.lfsize = sizeof(lfn);
|
||||
#endif
|
||||
|
||||
char filename[32] = SYSTEM_SOUNDS_PATH "/en/";
|
||||
strncpy(filename+sizeof(SYSTEM_SOUNDS_PATH), currentLanguagePack->id, 2);
|
||||
char filename[32] = SYSTEM_SOUNDS_PATH "/";
|
||||
strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
|
||||
assert(sizeof(audioFilenames)==AU_FRSKY_FIRST*sizeof(char *));
|
||||
assert(sizeof(sdAvailableSystemAudioFiles)*8 > AU_FRSKY_FIRST);
|
||||
@@ -106,8 +106,8 @@ void refreshSystemAudioFiles()
|
||||
uint32_t availableAudioFiles = 0;
|
||||
|
||||
for (uint32_t i=0; i<AU_FRSKY_FIRST; i++) {
|
||||
strcpy(filename+sizeof(SYSTEM_SOUNDS_PATH)+3, audioFilenames[i]);
|
||||
strcat(filename+sizeof(SYSTEM_SOUNDS_PATH)+3, SOUNDS_EXT);
|
||||
strcpy(filename+sizeof(SYSTEM_SOUNDS_PATH), audioFilenames[i]);
|
||||
strcat(filename+sizeof(SYSTEM_SOUNDS_PATH), SOUNDS_EXT);
|
||||
if (f_stat(filename, &info) == FR_OK)
|
||||
availableAudioFiles |= ((uint32_t)1 << i);
|
||||
}
|
||||
@@ -170,16 +170,17 @@ bool isAudioFileAvailable(uint32_t i, char * filename)
|
||||
|
||||
if (category == SYSTEM_AUDIO_CATEGORY) {
|
||||
if (sdAvailableSystemAudioFiles & ((uint32_t)1 << event)) {
|
||||
strcpy(filename, SYSTEM_SOUNDS_PATH "/en/");
|
||||
strncpy(filename+sizeof(SYSTEM_SOUNDS_PATH), currentLanguagePack->id, 2);
|
||||
strcpy(filename+sizeof(SYSTEM_SOUNDS_PATH)+3, audioFilenames[i]);
|
||||
strcat(filename+sizeof(SYSTEM_SOUNDS_PATH)+3, SOUNDS_EXT);
|
||||
strcpy(filename, SYSTEM_SOUNDS_PATH);
|
||||
strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
strcpy(filename+sizeof(SYSTEM_SOUNDS_PATH), audioFilenames[i]);
|
||||
strcat(filename+sizeof(SYSTEM_SOUNDS_PATH), SOUNDS_EXT);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (category == PHASE_AUDIO_CATEGORY) {
|
||||
if (sdAvailablePhaseAudioFiles[index] & ((uint32_t)1 << event)) {
|
||||
strcpy(filename, SOUNDS_PATH "/");
|
||||
strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
char *str = strcat_modelname(filename+sizeof(SOUNDS_PATH), g_eeGeneral.currModel);
|
||||
*str++ = '/';
|
||||
char * tmp = strcat_phasename(str, index);
|
||||
@@ -193,6 +194,7 @@ bool isAudioFileAvailable(uint32_t i, char * filename)
|
||||
else if (category == MIXER_AUDIO_CATEGORY) {
|
||||
if (sdAvailableMixerAudioFiles[index] & ((uint32_t)1 << event)) {
|
||||
strcpy(filename, SOUNDS_PATH "/");
|
||||
strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
char *str = strcat_modelname(filename+sizeof(SOUNDS_PATH), g_eeGeneral.currModel);
|
||||
*str++ = '/';
|
||||
char * tmp = strcat_mixername(str, index);
|
||||
@@ -916,11 +918,11 @@ void pushPrompt(uint16_t prompt, uint8_t id)
|
||||
{
|
||||
#if defined(SDCARD)
|
||||
|
||||
char filename[] = SYSTEM_SOUNDS_PATH "/en/0000" SOUNDS_EXT;
|
||||
strncpy(filename+sizeof(SYSTEM_SOUNDS_PATH), currentLanguagePack->id, 2);
|
||||
char filename[] = SYSTEM_SOUNDS_PATH "/0000" SOUNDS_EXT;
|
||||
strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
|
||||
for (int8_t i=3; i>=0; i--) {
|
||||
filename[sizeof(SYSTEM_SOUNDS_PATH)+3+i] = '0' + (prompt%10);
|
||||
filename[sizeof(SYSTEM_SOUNDS_PATH)+i] = '0' + (prompt%10);
|
||||
prompt /= 10;
|
||||
}
|
||||
|
||||
|
||||
@@ -4039,8 +4039,8 @@ void onCustomFunctionsMenu(const char *result)
|
||||
int8_t sub = m_posVert - 1;
|
||||
|
||||
if (result == STR_UPDATE_LIST) {
|
||||
char directory[] = SOUNDS_PATH "/en";
|
||||
strncpy(directory+sizeof(SOUNDS_PATH), currentLanguagePack->id, 2);
|
||||
char directory[] = SOUNDS_PATH;
|
||||
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
if (!listSdFiles(directory, SOUNDS_EXT, sizeof(g_model.funcSw[sub].param), NULL)) {
|
||||
POPUP_WARNING(STR_NO_SOUNDS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
@@ -4165,8 +4165,8 @@ void menuModelCustomFunctions(uint8_t event)
|
||||
lcd_putsiAtt(x, y, STR_VCSWFUNC, 0, attr);
|
||||
if (active && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
char directory[] = SOUNDS_PATH "/en";
|
||||
strncpy(directory+sizeof(SOUNDS_PATH), currentLanguagePack->id, 2);
|
||||
char directory[] = SOUNDS_PATH;
|
||||
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
if (listSdFiles(directory, SOUNDS_EXT, sizeof(sd->param.name), sd->param.name)) {
|
||||
menuHandler = onCustomFunctionsMenu;
|
||||
}
|
||||
|
||||
+5
-5
@@ -2422,11 +2422,11 @@ uint8_t fnSwitchDuration[NUM_CFN] = { 0 };
|
||||
|
||||
inline void playCustomFunctionFile(CustomFnData *sd, uint8_t id)
|
||||
{
|
||||
char filename[] = SOUNDS_PATH "/en/xxxxxx.wav";
|
||||
strncpy(filename+sizeof(SOUNDS_PATH), currentLanguagePack->id, 2);
|
||||
strncpy(filename+sizeof(SOUNDS_PATH)+3, sd->param.name, sizeof(sd->param.name));
|
||||
filename[sizeof(SOUNDS_PATH)+3+sizeof(sd->param.name)] = '\0';
|
||||
strcat(filename+sizeof(SOUNDS_PATH)+3, SOUNDS_EXT);
|
||||
char filename[] = SOUNDS_PATH "/xxxxxx.wav";
|
||||
strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
strncpy(filename+sizeof(SOUNDS_PATH), sd->param.name, sizeof(sd->param.name));
|
||||
filename[sizeof(SOUNDS_PATH)+sizeof(sd->param.name)] = '\0';
|
||||
strcat(filename+sizeof(SOUNDS_PATH), SOUNDS_EXT);
|
||||
PLAY_FILE(filename, sd->func==FUNC_BACKGND_MUSIC ? PLAY_BACKGROUND : 0, id);
|
||||
}
|
||||
#endif
|
||||
|
||||
+5
-3
@@ -43,14 +43,16 @@
|
||||
#define ROOT_PATH "."
|
||||
#define MODELS_PATH "."
|
||||
#define LOGS_PATH "."
|
||||
#define SOUNDS_PATH "."
|
||||
#define SYSTEM_SOUNDS_PATH "."
|
||||
#define SOUNDS_PATH "./en"
|
||||
#define SOUNDS_PATH_LNG_OFS 2
|
||||
#define SYSTEM_SOUNDS_PATH SOUNDS_PATH "/SYSTEM"
|
||||
#define BITMAPS_PATH "."
|
||||
#else
|
||||
#define ROOT_PATH "/"
|
||||
#define MODELS_PATH "/MODELS"
|
||||
#define LOGS_PATH "/LOGS" // no trailing slash = important
|
||||
#define SOUNDS_PATH "/SOUNDS" // no trailing slash = important
|
||||
#define SOUNDS_PATH "/SOUNDS/en" // no trailing slash = important
|
||||
#define SOUNDS_PATH_LNG_OFS 8
|
||||
#define SYSTEM_SOUNDS_PATH SOUNDS_PATH "/SYSTEM" // no trailing slash = important
|
||||
#define BITMAPS_PATH "/BMP"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user