diff --git a/src/translations/tts_es.cpp b/src/translations/tts_es.cpp new file mode 100644 index 000000000..d9ad238d3 --- /dev/null +++ b/src/translations/tts_es.cpp @@ -0,0 +1,207 @@ +/* + * Authors (alphabetical order) + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * open9x is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "../open9x.h" + +enum SpanishPrompts { + PROMPT_NUMBERS_BASE = 0, + PROMPT_ZERO = PROMPT_NUMBERS_BASE+0, + PROMPT_CIEN = PROMPT_NUMBERS_BASE+100, + PROMPT_CIENTO = PROMPT_NUMBERS_BASE+101, + PROMPT_DOSCIENTOS = PROMPT_NUMBERS_BASE+102, + PROMPT_TRESCIENTOS, + PROMPT_CUATROCIENTOS, + PROMPT_QUINIENTOS, + PROMPT_SESCIENTOS, + PROMPT_SETECIENTOS, + PROMPT_OCHOCIENTOS, + PROMPT_NUEVECIENTOS, + PROMPT_MIL = PROMPT_NUMBERS_BASE+110, + PROMPT_VIRGOLA = 111, + PROMPT_UN, + PROMPT_UNA, + PROMPT_Y, + PROMPT_MENO, + PROMPT_HORA, + PROMPT_HORAS, + PROMPT_MINUTO, + PROMPT_MINUTOS, + PROMPT_SEGUNDO, + PROMPT_SEGUNDOS, + + PROMPT_UNITS_BASE = 122, + PROMPT_VOLTS = PROMPT_UNITS_BASE+UNIT_VOLTS, + PROMPT_AMPS = PROMPT_UNITS_BASE+UNIT_AMPS, + PROMPT_METERS_PER_SECOND = PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, + PROMPT_SPARE1 = PROMPT_UNITS_BASE+UNIT_RAW, + PROMPT_KMH = PROMPT_UNITS_BASE+UNIT_KMH, + PROMPT_METERS = PROMPT_UNITS_BASE+UNIT_METERS, + PROMPT_DEGREES = PROMPT_UNITS_BASE+UNIT_DEGREES, + PROMPT_PERCENT = PROMPT_UNITS_BASE+UNIT_PERCENT, + PROMPT_MILLIAMPS = PROMPT_UNITS_BASE+UNIT_MILLIAMPS, + PROMPT_MAH = PROMPT_UNITS_BASE+UNIT_MAH, + PROMPT_WATTS = PROMPT_UNITS_BASE+UNIT_WATTS, + PROMPT_FEET = PROMPT_UNITS_BASE+UNIT_FEET, + PROMPT_KTS = PROMPT_UNITS_BASE+UNIT_KTS, + + PROMPT_LABELS_BASE = 134, + PROMPT_TIMER1 = PROMPT_LABELS_BASE+TELEM_TM1, + PROMPT_TIMER2 = PROMPT_LABELS_BASE+TELEM_TM2, + PROMPT_RSSI_TX = PROMPT_LABELS_BASE+TELEM_RSSI_TX, + PROMPT_RSSI_RX = PROMPT_LABELS_BASE+TELEM_RSSI_RX, + PROMPT_A1 = PROMPT_LABELS_BASE+TELEM_A1, + PROMPT_A2 = PROMPT_LABELS_BASE+TELEM_A2, + PROMPT_ALTITUDE = PROMPT_LABELS_BASE+TELEM_ALT, + PROMPT_RPM = PROMPT_LABELS_BASE+TELEM_RPM, + PROMPT_ESSENCE = PROMPT_LABELS_BASE+TELEM_FUEL, + PROMPT_T1 = PROMPT_LABELS_BASE+TELEM_T1, + PROMPT_T2 = PROMPT_LABELS_BASE+TELEM_T2, + PROMPT_VITESSE = PROMPT_LABELS_BASE+TELEM_SPEED, + PROMPT_DISTANCE = PROMPT_LABELS_BASE+TELEM_DIST, + PROMPT_GPSALTITUDE = PROMPT_LABELS_BASE+TELEM_GPSALT, + PROMPT_ELEMENTS_LIPO = PROMPT_LABELS_BASE+TELEM_CELL, + PROMPT_TOTAL_LIPO = PROMPT_LABELS_BASE+TELEM_CELLS_SUM, + PROMPT_VFAS = PROMPT_LABELS_BASE+TELEM_VFAS, + PROMPT_COURANT = PROMPT_LABELS_BASE+TELEM_CURRENT, + PROMPT_CONSOMMATION = PROMPT_LABELS_BASE+TELEM_CONSUMPTION, + PROMPT_PUISSANCE = PROMPT_LABELS_BASE+TELEM_POWER, + PROMPT_ACCELx = PROMPT_LABELS_BASE+TELEM_ACCx, + PROMPT_ACCELy = PROMPT_LABELS_BASE+TELEM_ACCy, + PROMPT_ACCELz = PROMPT_LABELS_BASE+TELEM_ACCz, + PROMPT_HDG = PROMPT_LABELS_BASE+TELEM_HDG, + PROMPT_VARIO = PROMPT_LABELS_BASE+TELEM_VSPD, + +}; + +#if defined(VOICE) + +PLAY_FUNCTION(playNumber, int16_t number, uint8_t unit, uint8_t att) +{ +/* if digit >= 1000000000: + temp_digit, digit = divmod(digit, 1000000000) + prompts.extend(self.getNumberPrompt(temp_digit)) + prompts.append(Prompt(GUIDE_00_BILLION, dir=2)) + if digit >= 1000000: + temp_digit, digit = divmod(digit, 1000000) + prompts.extend(self.getNumberPrompt(temp_digit)) + prompts.append(Prompt(GUIDE_00_MILLION, dir=2)) +*/ + + if (number < 0) { + PUSH_PROMPT(PROMPT_MENO); + number = -number; + } + int8_t mode = MODE(att); + if (mode > 0) { + div_t qr = div(number, (mode == 1 ? 10 : 100)); + if (qr.rem > 0) { + PLAY_NUMBER(qr.quot, 0, 0); + PUSH_PROMPT(PROMPT_VIRGOLA); + if (mode==2 && qr.rem < 10) + PUSH_PROMPT(PROMPT_ZERO); + PLAY_NUMBER(qr.rem, unit, 0); + } + else { + PLAY_NUMBER(qr.quot, unit, 0); + } + return; + } + + if (number >= 1000) { + if (number >= 2000) { + PLAY_NUMBER(number / 1000, 0, 0); + PUSH_PROMPT(PROMPT_MIL); + } else { + PUSH_PROMPT(PROMPT_MIL); + } + number %= 1000; + if (number == 0) + number = -1; + } + if (number >= 100) { + PUSH_PROMPT(PROMPT_CIENTO + number/100); + number %= 100; + if (number == 0) + number = -1; + } + PUSH_PROMPT(PROMPT_ZERO+number); + + if (unit) { + PUSH_PROMPT(PROMPT_UNITS_BASE+unit-1); + } +} + +PLAY_FUNCTION(playDuration, int16_t seconds) +{ + if (seconds < 0) { + PUSH_PROMPT(PROMPT_MENO); + seconds = -seconds; + } + + uint8_t ore = 0; + uint8_t tmp = seconds / 3600; + seconds %= 3600; + if (tmp > 0) { + ore=tmp; + if (tmp > 1) { + PLAY_NUMBER(tmp, 0, 0); + PUSH_PROMPT(PROMPT_HORAS); + } else { + PUSH_PROMPT(PROMPT_UNA); + PUSH_PROMPT(PROMPT_HORA); + } + } + + tmp = seconds / 60; + seconds %= 60; + if (tmp > 0 || ore >0) { + if (tmp != 1) { + PLAY_NUMBER(tmp, 0, 0); + PUSH_PROMPT(PROMPT_MINUTOS); + } else { + PUSH_PROMPT(PROMPT_UN); + PUSH_PROMPT(PROMPT_MINUTO); + } + PUSH_PROMPT(PROMPT_Y); + } + + if (seconds != 1) { + PLAY_NUMBER(seconds, 0, 0); + PUSH_PROMPT(PROMPT_SEGUNDOS); + } else { + PUSH_PROMPT(PROMPT_UN); + PUSH_PROMPT(PROMPT_SEGUNDO); + } +} + +#endif \ No newline at end of file diff --git a/src/translations/tts_pt.cpp b/src/translations/tts_pt.cpp new file mode 100644 index 000000000..4751a0293 --- /dev/null +++ b/src/translations/tts_pt.cpp @@ -0,0 +1,200 @@ +/* + * Authors (alphabetical order) + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * open9x is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "../open9x.h" + +enum PortuguesePrompts { + PROMPT_NUMBERS_BASE = 0, + PROMPT_ZERO = PROMPT_NUMBERS_BASE+0, + PROMPT_CEM = PROMPT_NUMBERS_BASE+100, + PROMPT_CENTO = PROMPT_NUMBERS_BASE+101, + PROMPT_DUZENTOS = PROMPT_NUMBERS_BASE+102, + PROMPT_TREZCENTOS, + PROMPT_QUATROCENTOS, + PROMPT_QUINHENTOS, + PROMPT_SEISCENTOS, + PROMPT_SETECENTOS, + PROMPT_OITOCENTOS, + PROMPT_NUEVECENTOS, + PROMPT_MIL = PROMPT_NUMBERS_BASE+110, + PROMPT_VIRGULA = 111, + PROMPT_UMA, + PROMPT_DUAS, + PROMPT_E, + PROMPT_MENOS, + PROMPT_HORA, + PROMPT_HORAS, + PROMPT_MINUTO, + PROMPT_MINUTOS, + PROMPT_SEGUNDO, + PROMPT_SEGUNDOS, + + PROMPT_UNITS_BASE = 122, + PROMPT_VOLTS = PROMPT_UNITS_BASE+UNIT_VOLTS, + PROMPT_AMPS = PROMPT_UNITS_BASE+UNIT_AMPS, + PROMPT_METERS_PER_SECOND = PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, + PROMPT_SPARE1 = PROMPT_UNITS_BASE+UNIT_RAW, + PROMPT_KMH = PROMPT_UNITS_BASE+UNIT_KMH, + PROMPT_METERS = PROMPT_UNITS_BASE+UNIT_METERS, + PROMPT_DEGREES = PROMPT_UNITS_BASE+UNIT_DEGREES, + PROMPT_PERCENT = PROMPT_UNITS_BASE+UNIT_PERCENT, + PROMPT_MILLIAMPS = PROMPT_UNITS_BASE+UNIT_MILLIAMPS, + PROMPT_MAH = PROMPT_UNITS_BASE+UNIT_MAH, + PROMPT_WATTS = PROMPT_UNITS_BASE+UNIT_WATTS, + PROMPT_FEET = PROMPT_UNITS_BASE+UNIT_FEET, + PROMPT_KTS = PROMPT_UNITS_BASE+UNIT_KTS, + + PROMPT_LABELS_BASE = 134, + PROMPT_TIMER1 = PROMPT_LABELS_BASE+TELEM_TM1, + PROMPT_TIMER2 = PROMPT_LABELS_BASE+TELEM_TM2, + PROMPT_RSSI_TX = PROMPT_LABELS_BASE+TELEM_RSSI_TX, + PROMPT_RSSI_RX = PROMPT_LABELS_BASE+TELEM_RSSI_RX, + PROMPT_A1 = PROMPT_LABELS_BASE+TELEM_A1, + PROMPT_A2 = PROMPT_LABELS_BASE+TELEM_A2, + PROMPT_ALTITUDE = PROMPT_LABELS_BASE+TELEM_ALT, + PROMPT_RPM = PROMPT_LABELS_BASE+TELEM_RPM, + PROMPT_ESSENCE = PROMPT_LABELS_BASE+TELEM_FUEL, + PROMPT_T1 = PROMPT_LABELS_BASE+TELEM_T1, + PROMPT_T2 = PROMPT_LABELS_BASE+TELEM_T2, + PROMPT_VITESSE = PROMPT_LABELS_BASE+TELEM_SPEED, + PROMPT_DISTANCE = PROMPT_LABELS_BASE+TELEM_DIST, + PROMPT_GPSALTITUDE = PROMPT_LABELS_BASE+TELEM_GPSALT, + PROMPT_ELEMENTS_LIPO = PROMPT_LABELS_BASE+TELEM_CELL, + PROMPT_TOTAL_LIPO = PROMPT_LABELS_BASE+TELEM_CELLS_SUM, + PROMPT_VFAS = PROMPT_LABELS_BASE+TELEM_VFAS, + PROMPT_COURANT = PROMPT_LABELS_BASE+TELEM_CURRENT, + PROMPT_CONSOMMATION = PROMPT_LABELS_BASE+TELEM_CONSUMPTION, + PROMPT_PUISSANCE = PROMPT_LABELS_BASE+TELEM_POWER, + PROMPT_ACCELx = PROMPT_LABELS_BASE+TELEM_ACCx, + PROMPT_ACCELy = PROMPT_LABELS_BASE+TELEM_ACCy, + PROMPT_ACCELz = PROMPT_LABELS_BASE+TELEM_ACCz, + PROMPT_HDG = PROMPT_LABELS_BASE+TELEM_HDG, + PROMPT_VARIO = PROMPT_LABELS_BASE+TELEM_VSPD, + +}; + +#if defined(VOICE) + +PLAY_FUNCTION(playNumber, int16_t number, uint8_t unit, uint8_t att) +{ + if (number < 0) { + PUSH_PROMPT(PROMPT_MENOS); + number = -number; + } + int8_t mode = MODE(att); + if (mode > 0) { + div_t qr = div(number, (mode == 1 ? 10 : 100)); + if (qr.rem > 0) { + PLAY_NUMBER(qr.quot, 0, 0); + PUSH_PROMPT(PROMPT_VIRGOLA); + if (mode==2 && qr.rem < 10) + PUSH_PROMPT(PROMPT_ZERO); + PLAY_NUMBER(qr.rem, unit, 0); + } + else { + PLAY_NUMBER(qr.quot, unit, 0); + } + return; + } + + if (number >= 1000) { + if (number >= 2000) { + PLAY_NUMBER(number / 1000, 0, 0); + PUSH_PROMPT(PROMPT_MIL); + } else { + PUSH_PROMPT(PROMPT_MIL); + } + number %= 1000; + if (number == 0) + number = -1; + } + if (number >= 100) { + PUSH_PROMPT(PROMPT_CIENTO + number/100); + number %= 100; + if (number == 0) + number = -1; + } + PUSH_PROMPT(PROMPT_ZERO+number); + + if (unit) { + PUSH_PROMPT(PROMPT_UNITS_BASE+unit-1); + } +} + +PLAY_FUNCTION(playDuration, int16_t seconds) +{ + if (seconds < 0) { + PUSH_PROMPT(PROMPT_MENO); + seconds = -seconds; + } + + uint8_t ore = 0; + uint8_t tmp = seconds / 3600; + seconds %= 3600; + if (tmp > 0) { + ore=tmp; + if (tmp > 2) { + PLAY_NUMBER(tmp, 0, 0); + PUSH_PROMPT(PROMPT_HORAS); + } else if (tmp==2) { + PUSH_PROMPT(PROMPT_DUAS); + PUSH_PROMPT(PROMPT_HORAS); + } else if (tmp==1) { + PUSH_PROMPT(PROMPT_UMA); + PUSH_PROMPT(PROMPT_HORA); + } + } + + tmp = seconds / 60; + seconds %= 60; + if (tmp > 0 || ore >0) { + if (tmp != 1) { + PLAY_NUMBER(tmp, 0, 0); + PUSH_PROMPT(PROMPT_MINUTOS); + } else { + PUSH_PROMPT(PROMPT_UN); + PUSH_PROMPT(PROMPT_MINUTO); + } + PUSH_PROMPT(PROMPT_Y); + } + + if (seconds != 1) { + PLAY_NUMBER(seconds, 0, 0); + PUSH_PROMPT(PROMPT_SEGUNDOS); + } else { + PUSH_PROMPT(PROMPT_UN); + PUSH_PROMPT(PROMPT_SEGUNDO); + } +} + +#endif diff --git a/util/tts.py b/util/tts.py index cfc640345..916aa4585 100644 --- a/util/tts.py +++ b/util/tts.py @@ -410,6 +410,84 @@ if __name__ == "__main__": (u"Regime 9", "fltmd9"), ]): sounds.extend(generate(s, f, 256+i)) + + elif "pt" in sys.argv: + if "sapi" in sys.argv: + tts.SetVoiceByName("ScanSoftVirginie_Full_22kHz") + voice = "portuguese" + else: + espeakVoice = "mb-pt4" + espeakspeed = "160" + voice = "portuguese" + + for i in range(101): + systemSounds.extend(generate(str(i), i)) + systemSounds.extend(generate("cento", 101)) + systemSounds.extend(generate("duzentos", 102)) + systemSounds.extend(generate("trezcentos", 103)) + systemSounds.extend(generate("quatrocentoc", 104)) + systemSounds.extend(generate("quinhentos", 105)) + systemSounds.extend(generate("seiscentos", 106)) + systemSounds.extend(generate("setecentos", 107)) + systemSounds.extend(generate("oitocentos", 108)) + systemSounds.extend(generate("nuevecentos", 109)) + systemSounds.extend(generate("mil", 110)) + for i, s in enumerate(["virgula", "uma", "duas", "e", "menos", "hora", "horas", "minuto", "minutos", "segundo", "segundos"]): + systemSounds.extend(generate(s, 111+i)) + for i, s in enumerate([u"Volt", u"ampére", u"metros por segundo", u"", u"quilômetros por hora", "metros", "graus", "cento", "miliamperes", "miliamperes por hora", "watt", "db", "estar", "nós", "horas", "minutos", "segundos", "RPM", "g"]): + systemSounds.extend(generate(s, 122+i)) + for s, f, a in [(u"comando rádio inativo", "inatividade", 230), + (u"descarregamento da bateria de rádio", "mensagem LowBatt", 231), + (u"controle não motor em posição, verifique", "thralert", 232), + (u"não muda de posição, verificar", "swalert", 233), + (u"eeprom corrompido", "eebad", 0), + (u"formattazone eeprom em andamento", "eeformat", 0), + (u"erro", "erro", 0), + (u"trim centrada", "midtrim", 244), + (u"tada", "tada", 245), + (u"potenciómetro centrado", "midpot", 246), + (u"atingiu máximo de compensação", "endtrim", 0), + (u"3 segundos a final", "timerlt3", 250), + (u"10 segondos", "timer10", 251), + (u"20 segondos", "timer20", 252), + (u"30 segondos", "timer30", 253), + ]: + systemSounds.extend(generate(s, f, a)) + for i, s in enumerate([u"Tiempo", u"Tiempo", u"transmissão", u"recepção", u"A1", u"A2", u"altitude", u"motor", + u"Fuel", u"temperatura", u"temperatura", u"velocidade", u"distância", u"altitude", u"célula lipo" + u"Total lipo", u"tensão", u"corrente", u"consumo", u"poder", u"aceleração X", u"Y aceleração", u"aceleração Z" + u"Direção", u"vario", u"mínimo", u"máximo"]): + systemSounds.extend(generate(s, 135+i)) + for i, (s, f) in enumerate([ + (u"carro fechado", "GearUp") + (u"carro aberto", "geardn") + (u"flaps recolhidos", "flapup"), + (u"flaps estendidos", "flapdn"), + (u"aterragem", "Attero"), + (u"modo principal ativo", "trnon") + (u"modo master off", "trnoff") + (u"motor desligado", "engoff") + (u"muito alto", "tohigh") + (u"muito baixo", "tolow"), + (u"bateria fraca", "LOWBAT") + (u"corvo on", "crowon") + (u"corvo off", "crowof") + (u"sinal de rádio de baixa", "siglow") + (u"sinal de rádio crítica", "sigcrt"), + (u"modo de velocidade", "spdmod") + (u"modo de térmica", "thmmod"), + (u"modo de voo normal", "nrmmod"), + (u"fase de voo 1", "fltmd1"), + (u"fase de voo 2", "fltmd2") + (u"fase de voo 3", "fltmd3") + (u"fase de voo 4", "fltmd4") + (u"fase de voo 5", "fltmd5") + (u"fase de vôo 6", "fltmd6") + (u"fase de voo 7", "fltmd7"), + (u"fase de voo 8", "fltmd8") + (u"fase de voo 9", "fltmd9" + ]): + sounds.extend(generate(s, f, 256+i)) elif "cz" in sys.argv: if "sapi" in sys.argv: