1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00

Play Custom functions with no file selected slowed down the radio

This commit is contained in:
bsongis 2014-03-17 12:27:38 +01:00
parent c3e0d1967b
commit 0c9b45e738

View file

@ -3353,12 +3353,14 @@ uint8_t fnSwitchDuration[NUM_CFN] = { 0 };
inline void playCustomFunctionFile(CustomFnData *sd, uint8_t id) inline void playCustomFunctionFile(CustomFnData *sd, uint8_t id)
{ {
char filename[sizeof(SOUNDS_PATH)+sizeof(sd->play.name)+sizeof(SOUNDS_EXT)] = SOUNDS_PATH "/"; if (sd->play.name[0] != '\0') {
strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2); char filename[sizeof(SOUNDS_PATH)+sizeof(sd->play.name)+sizeof(SOUNDS_EXT)] = SOUNDS_PATH "/";
strncpy(filename+sizeof(SOUNDS_PATH), sd->play.name, sizeof(sd->play.name)); strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
filename[sizeof(SOUNDS_PATH)+sizeof(sd->play.name)] = '\0'; strncpy(filename+sizeof(SOUNDS_PATH), sd->play.name, sizeof(sd->play.name));
strcat(filename+sizeof(SOUNDS_PATH), SOUNDS_EXT); filename[sizeof(SOUNDS_PATH)+sizeof(sd->play.name)] = '\0';
PLAY_FILE(filename, sd->func==FUNC_BACKGND_MUSIC ? PLAY_BACKGROUND : 0, id); strcat(filename+sizeof(SOUNDS_PATH), SOUNDS_EXT);
PLAY_FILE(filename, sd->func==FUNC_BACKGND_MUSIC ? PLAY_BACKGROUND : 0, id);
}
} }
#endif #endif