feat(lua): Add API for overriding speaker volume (#3784)
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <limits.h>
|
||||
#include "opentx_types.h"
|
||||
#include "translations/untranslated.h"
|
||||
#include "audio.h"
|
||||
|
||||
#if defined(TRANSLATIONS_FR)
|
||||
#include "translations/fr.h"
|
||||
@@ -884,8 +885,8 @@ extern const char STR_MODEL_MENU_TABS[];
|
||||
struct LanguagePack {
|
||||
const char * id;
|
||||
const char * name;
|
||||
void (*playNumber)(getvalue_t number, uint8_t unit, uint8_t flags, uint8_t id);
|
||||
void (*playDuration)(int seconds, uint8_t flags, uint8_t id);
|
||||
void (*playNumber)(getvalue_t number, uint8_t unit, uint8_t flags, uint8_t id, int8_t fragmentVolume);
|
||||
void (*playDuration)(int seconds, uint8_t flags, uint8_t id, int8_t fragmentVolume);
|
||||
};
|
||||
|
||||
extern const LanguagePack * currentLanguagePack;
|
||||
@@ -949,14 +950,14 @@ const LanguagePack * const languagePacks[] = {
|
||||
const LanguagePack* currentLanguagePack = &lng##LanguagePack; \
|
||||
uint8_t currentLanguagePackIdx
|
||||
|
||||
#define PLAY_FUNCTION(x, ...) void x(__VA_ARGS__, uint8_t id)
|
||||
#define PLAY_FUNCTION(x, ...) void x(__VA_ARGS__, uint8_t id, int8_t fragmentVolume = USE_SETTINGS_VOLUME)
|
||||
|
||||
inline PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t flags) {
|
||||
currentLanguagePack->playNumber(number, unit, flags, id);
|
||||
currentLanguagePack->playNumber(number, unit, flags, id, fragmentVolume);
|
||||
}
|
||||
|
||||
inline PLAY_FUNCTION(playDuration, int seconds, uint8_t flags) {
|
||||
currentLanguagePack->playDuration(seconds, flags, id);
|
||||
currentLanguagePack->playDuration(seconds, flags, id, fragmentVolume);
|
||||
}
|
||||
|
||||
extern const char STR_MODELNAME[];
|
||||
|
||||
Reference in New Issue
Block a user