Skip to content

Commit

Permalink
add Text-To-Speech support with eSpeak (#34)
Browse files Browse the repository at this point in the history
* add allyTTS(text,gap,speed,wait) in GMenu2X class
* add allyTTS(file,gap,speed) after TextDialog display
with espeak -f option
* add allyTTS(text) - with ' ' single quotes to preserve the literal value of each character (via GNU bash man)
* TTS read in MessageBox, MenuOption, SettingsDialog, InputDialog, BrowseDialog, TerminalDialog
* kill TTS app before link launch
  otherwise alsa device will be busy, which results in part or total lack of sound in executed app
* TTS hack for "a" letter misinterpreted as article
* detect current *value and prompt if requsted & read Settings only on inputAction
* read Title and 1st setting at entry
* use translation for readSetting
* read voice from translation string
  eg. "_TTS_voice_=pl"
* correct tr string in settingsdialog
* read Link Title if "X" pressed
* add Welcome msg & Hints for TTS
* optionize TTS usage with confInt["enableTTS"]
* define TTS_ENGINE
* add `wait` opt for allyTTS
* use [MODIFIER] key for current value() TTS read
don't rely on [CONFIRM], but use StringBase to handel value read
* read Wallpaper fileName in browser
* quit allyTTS with 'START' press
* update Translations with TTS entries
  • Loading branch information
Apaczer authored Jul 10, 2024
1 parent d9a2374 commit 9027ed0
Show file tree
Hide file tree
Showing 36 changed files with 393 additions and 45 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ The "\_about\_" assigns corresponding text file for displaying _About_ message,

The "\_keyboard_<table_number>_<line_number>\_" string will modify alternative overlay keyboard on Input Dialog (accesed with MODIFY button).

The "\_TTS_voice\_" string assigns voice type used by TTS engine e.g. "\_TTS_voice\_"=en" for English (check for available voices on your device `/usr/share/espeak-data/voices`)

### Dictionary
To view the full list of string messages available to translate in source see: [dictionary.txt](https://github.com/MiyooCFW/gmenu2x/blob/master/dictionary.txt)

Expand Down
12 changes: 12 additions & 0 deletions assets/translations/Chinese(CN)
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Alt=
Appearance & skin settings=外观设置
apps=软件
Are you sure?=是否确定?
at=
Audio volume=全局音量
Automatic load backdrops from skin pack=自动从主题包加载程序背景壁纸
Autostart=自动启动
Expand Down Expand Up @@ -69,6 +70,7 @@ Displays last launched program's output=显示最后运行的程序输出日志
Done processing.=
Edit=编辑
emus=模拟器
Entering Text Dialog editor, press B to exit=
Exit=退出
Explorer=文件管理器
favorites=
Expand All @@ -93,7 +95,9 @@ Hint: Hold 'X' to change Date & Time=提示:长按X更改日期和时间
Hint: Hold 'Y' to restart GMenu2X=提示:长按Y重启GMenu2X
Hint: Press 'Y' now quickly to disable AutoStart=
Hint: Press 'Y' now quickly to reset gmenu2x.cfg=提示:此时快速按下Y重置gmenu2x.cfg配置文件
Hint: To read a selected value or Link's description press X=
Hint: You can AutoStart any game/app!? See settings=提示:可以在设置中设置软件或游戏自动启动
Hint: You can skip reading a message, by pressing START=
Hints=提示
Home path=默认路径
How to scale wallpaper, backdrops and game art=设置壁纸,程序背景和预览图缩放方式
Expand Down Expand Up @@ -153,6 +157,7 @@ Power=关机
Poweroff or reboot the device?=请选择关机还是重启?
Poweroff=关机
Preview mode=预览图模式
Processing output.=
Reboot=重启
Rebooting=
Remember selection=记住选择
Expand All @@ -166,6 +171,7 @@ Reset link's icon back to default=恢复图标为默认设置
Reset settings=恢复默认设置
Reset=重置
Restart=
RGBA values are =
Run last app on restart=重启后运行最后的程序
Running.. Please wait..=
Save changes?=保存更改?
Expand Down Expand Up @@ -224,7 +230,9 @@ Space=空格
Suspend timeout=闲置锁屏时间
SW Clock=系统时间
TEfix method=屏幕撕裂修正方式
Terminal output as follows=
Terminal=
Text To Speak=
Text viewer=
The section this link belongs to=该软件链接属于分组
the settings. Continue?=
Expand All @@ -234,6 +242,7 @@ This section is empty=分组为空
Title font size=标题文字大小
Title=标题
Top/Section Bar=标题栏颜色
Typed=
Umount external media device=
Umount=
Uninstall IPK=卸载IPK程序
Expand All @@ -245,7 +254,9 @@ Unset link's selector box art path=取消设置缩略图路径
Unset link's selector directory=取消设置模拟器程序目录
Unset link's selector file filters=取消设置ROM文件后缀过滤
Use file browser selector=使用文件浏览
Use TTS engine to read menu out loud=
Wallpaper=壁纸
Welcome to GMenu=
Yes=是
Zip content=
_about_=
Expand All @@ -258,3 +269,4 @@ _keyboard_t2_l3_=
_keyboard_t3_l1_=
_keyboard_t3_l2_=
_keyboard_t3_l3_=
_TTS_voice_=zh
12 changes: 12 additions & 0 deletions assets/translations/Polish
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Alt=
Appearance & skin settings=Wygląd i ustawienie skórki
apps=apki
Are you sure?=Jesteś pewien?
at=
Audio volume=Głośność
Automatic load backdrops from skin pack=Automatycznie ładuj plany tła z paczki skórki
Autostart=Autostart
Expand Down Expand Up @@ -69,6 +70,7 @@ Displays last launched program's output=Pokazuje dziennik z ostatnio uruchomione
Done processing.=Skończono przetwarzanie.
Edit=Edytuj
emus=emusy
Entering Text Dialog editor, press B to exit=
Exit=Wyjdź
Explorer=Eksplorator
favorites=ulubione
Expand All @@ -93,7 +95,9 @@ Hint: Hold 'X' to change Date & Time=Tip: Przytrzymaj 'X' do zmiany Daty i Czasu
Hint: Hold 'Y' to restart GMenu2X=Tip: Przytrzymaj 'Y' aby zrestartować GMenu2X
Hint: Press 'Y' now quickly to disable AutoStart=Tip: Naciśnij 'Y' teraz szybko \n aby dezaktywować AutoStart
Hint: Press 'Y' now quickly to reset gmenu2x.cfg=Tip: Naciśnij 'Y' teraz szybko \n aby zresetować gmenu2x.cfg
Hint: To read a selected value or Link's description press X=
Hint: You can AutoStart any game/app!? See settings=Tip: Możesz AutoStartować każdą grę/apkę!?\nZobacz ustawienia
Hint: You can skip reading a message, by pressing START=
Hints=Wskazówki
Home path=Ścieżka domowa
How to scale wallpaper, backdrops and game art=Jak skalować tapetę, tło i okładki
Expand Down Expand Up @@ -153,6 +157,7 @@ Power=Zasilanie
Poweroff or reboot the device?=Wyłączyć czy zresetować urządzenie?
Poweroff=Wyłącz
Preview mode=Tryb podglądu
Processing output.=
Reboot=Restart
Rebooting=Restartuje
Remember selection=Zapamiętaj wybór
Expand All @@ -166,6 +171,7 @@ Reset link's icon back to default=Zresetuj ikony skrótów do domyślnych
Reset settings=Zresetuj ustawienia
Reset=Zresetuj
Restart=Restartuj
RGBA values are =
Run last app on restart=Uruchom ostatnią aplikacje po restarcie
Running.. Please wait..=Uruchamiam.. Proszę czekać..
Save changes?=Zapisać zmiany?
Expand Down Expand Up @@ -224,7 +230,9 @@ Space=Spacja
Suspend timeout=Czas do uśpienia
SW Clock=SW Zegar
TEfix method=metoda TEfix
Terminal output as follows=
Terminal=Terminal
Text To Speak=
Text viewer=Przeglądarka tekstu
The section this link belongs to=Sekcja do której należy ten skrót
the settings. Continue?=ustawienia. Kontynuować?
Expand All @@ -234,6 +242,7 @@ This section is empty=Ta sekcja jest pusta
Title font size=Wielkość czcionki tytułowej
Title=Tytuł
Top/Section Bar=Pasek sekcji/górny
Typed=
Umount external media device=Wysuń zewnętrzny nośnik danych
Umount=Wysuń
Uninstall IPK=Odinstaluj IPK
Expand All @@ -245,7 +254,9 @@ Unset link's selector box art path=Wyzeruj ścieżkę okładki selektora skrótu
Unset link's selector directory=Wyzeruj katalog selektora skrótu
Unset link's selector file filters=Wyzeruj filtry selektora pliku skrótu
Use file browser selector=Użyj selektora przeglądarki plików
Use TTS engine to read menu out loud=
Wallpaper=Tapeta
Welcome to GMenu=
Yes=Tak
Zip content=Zawartość zip'a
_about_=_about_pl
Expand All @@ -258,3 +269,4 @@ _keyboard_t2_l3_=ŻŹĆVBŃM<>?_+\n!@#
_keyboard_t3_l1_=
_keyboard_t3_l2_=
_keyboard_t3_l3_=
_TTS_voice_=pl
12 changes: 12 additions & 0 deletions assets/translations/Portuguese(Brazil)
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Alt=
Appearance & skin settings=Configurações de aparência e configurações de skins
apps=aplicativos
Are you sure?=Tem certeza?
at=
Audio volume=Volume do Áudio
Automatic load backdrops from skin pack=Carregar pacote de plano de fundo do pacote de skins
Autostart=Início automático
Expand Down Expand Up @@ -69,6 +70,7 @@ Displays last launched program's output=Mostra a saída do último programa exec
Done processing.=Processamento finalizado.
Edit=Editar
emus=emus
Entering Text Dialog editor, press B to exit=
Exit=Sair
Explorer=Explorador
favorites=favoritos
Expand All @@ -93,7 +95,9 @@ Hint: Hold 'X' to change Date & Time=Dica: segure 'X' para alterar a data e a ho
Hint: Hold 'Y' to restart GMenu2X=Dica: segure 'Y' para reiniciar o GMenu2X
Hint: Press 'Y' now quickly to disable AutoStart=
Hint: Press 'Y' now quickly to reset gmenu2x.cfg=Dica: pressione 'Y' agora rapidamente para redefinir gmenu2x.cfg
Hint: To read a selected value or Link's description press X=
Hint: You can AutoStart any game/app!? See settings=Dica: você pode iniciar automaticamente qualquer jogo/aplicativo!? Ver configurações
Hint: You can skip reading a message, by pressing START=
Hints=Dicas
Home path=Caminho inicial
How to scale wallpaper, backdrops and game art=Como dimensionar papéis de parede, planos de fundos e arte do jogo
Expand Down Expand Up @@ -153,6 +157,7 @@ Power=Ligar/Desligar
Poweroff or reboot the device?=Desligar ou reiniciar o dispositivo?
Poweroff=Desligar
Preview mode=Modo de pré-visualização
Processing output.=
Reboot=Reiniciar
Rebooting=Reiniciando
Remember selection=Lembrar seleção
Expand All @@ -166,6 +171,7 @@ Reset link's icon back to default=Redefinir o ícone do link de volta ao padrão
Reset settings=Redefinir configurações
Reset=Reiniciar
Restart=
RGBA values are =
Run last app on restart=Execute o último aplicativo ao reiniciar
Running.. Please wait..=Executando.. Por favor, aguarde..
Save changes?=Salvar alterações?
Expand Down Expand Up @@ -224,7 +230,9 @@ Space=Espaço
Suspend timeout=Suspender tempo limite
SW Clock=Relógio de Software
TEfix method=Método TEfix
Terminal output as follows=
Terminal=Terminal
Text To Speak=
Text viewer=Visualizador de texto
The section this link belongs to=Seção a qual pertence este link
the settings. Continue?=
Expand All @@ -234,6 +242,7 @@ This section is empty=Esta seção está vazia
Title font size=Tamanho da fonte do título
Title=Título
Top/Section Bar=Barra superior/seção
Typed=
Umount external media device=
Umount=
Uninstall IPK=Desinstalar IPK
Expand All @@ -245,7 +254,9 @@ Unset link's selector box art path=Desmarcar caminho da arte da caixa seletora d
Unset link's selector directory=Desativar diretório seletor de link
Unset link's selector file filters=Desativar filtros de arquivo seletor de link
Use file browser selector=Use o seletor do navegador de arquivos
Use TTS engine to read menu out loud=
Wallpaper=Papel de parede
Welcome to GMenu=
Yes=Sim
Zip content=Conteúdo Zip
_about_=
Expand All @@ -258,3 +269,4 @@ _keyboard_t2_l3_=
_keyboard_t3_l1_=
_keyboard_t3_l2_=
_keyboard_t3_l3_=
_TTS_voice_=pt-br
12 changes: 12 additions & 0 deletions assets/translations/Russian
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Alt=Р/Л
Appearance & skin settings=Настройка темы и внешнего вида
apps=приложения
Are you sure?=Уверены?
at=
Audio volume=Громкость звука
Automatic load backdrops from skin pack=Автозагрузка задников из набора темы
Autostart=Автозапуск
Expand Down Expand Up @@ -69,6 +70,7 @@ Displays last launched program's output=Сообщения последнего
Done processing.=Выполнение завершено.
Edit=Изменить
emus=эмуляторы
Entering Text Dialog editor, press B to exit=
Exit=Выход
Explorer=Обозреватель
favorites=избранное
Expand All @@ -93,7 +95,9 @@ Hint: Hold 'X' to change Date & Time=Совет: Для изменения да
Hint: Hold 'Y' to restart GMenu2X=Совет: Для перезапуска GMenu2X держите «Y»
Hint: Press 'Y' now quickly to disable AutoStart=Совет: Отключить автозапуск? Быстро нажмите «Y»
Hint: Press 'Y' now quickly to reset gmenu2x.cfg=Совет: Для сброса gmenu2x.cfg быстро нажмите «Y»
Hint: To read a selected value or Link's description press X=
Hint: You can AutoStart any game/app!? See settings=Совет: Автозапуск игр/приложений?! В настройках!
Hint: You can skip reading a message, by pressing START=
Hints=Советы
Home path=Домашний каталог
How to scale wallpaper, backdrops and game art=Как масштабировать обои, фоны и изображения
Expand Down Expand Up @@ -153,6 +157,7 @@ Power=Питание
Poweroff or reboot the device?=Выключить или перезагрузить устройство?
Poweroff=Выключить
Preview mode=Режим предпросмотра
Processing output.=
Reboot=Перезагрузить
Rebooting=Перезагрузка
Remember selection=Запоминать выбор
Expand All @@ -166,6 +171,7 @@ Reset link's icon back to default=Сбросить назначенные зна
Reset settings=Сброс настроек
Reset=Сброс
Restart=Перезапуск
RGBA values are =
Run last app on restart=Запуск последнего приложения при перезагрузке
Running.. Please wait..=Идёт выполнение.. Ждите..
Save changes?=Сохранить изменения?
Expand Down Expand Up @@ -224,7 +230,9 @@ Space=⎵
Suspend timeout=Тайм-аут сна
SW Clock=Программные часы
TEfix method=Коррекция разрыва кадра
Terminal output as follows=
Terminal=Терминал
Text To Speak=
Text viewer=Просмотрщик текстов
The section this link belongs to=Раздел, к которому относится этот ярлык
the settings. Continue?=настройки. Продолжить?
Expand All @@ -234,6 +242,7 @@ This section is empty=Этот раздел пуст
Title font size=Размер шрифта заголовка
Title=Заголовок
Top/Section Bar=Панель разделов/верхняя
Typed=
Umount external media device=Извлечь внешний носитель данных
Umount=Извлечь
Uninstall IPK=Удалить IPK
Expand All @@ -245,7 +254,9 @@ Unset link's selector box art path=Сбросить пути к миниатюр
Unset link's selector directory=Сбросить назначенные каталоги ярлыков
Unset link's selector file filters=Сбросить файловые фильтры ярлыков
Use file browser selector=Использовать обозреватель в роли селектора
Use TTS engine to read menu out loud=
Wallpaper=Обои
Welcome to GMenu=
Yes=Да
Zip content=Содержимое архива
_about_=_about_ru
Expand All @@ -258,3 +269,4 @@ _keyboard_t2_l3_=ЯЧСМИТЬБЮЁ:;\n/?!
_keyboard_t3_l1_=*·×÷+-/\&<=>|
_keyboard_t3_l2_=()[]{}@#$¤%^~
_keyboard_t3_l3_=_«»"'`.,:;!?§
_TTS_voice_=ru
12 changes: 12 additions & 0 deletions dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Displays last launched program's output=
Done processing.=
Done=
Edit=
Entering Text Dialog editor, press B to exit=
Error loading meta-data=
Executable=
Exit=
Expand Down Expand Up @@ -121,7 +122,9 @@ Hint: Hold 'X' to change Date & Time=
Hint: Hold 'Y' to restart GMenu2X=
Hint: Press 'Y' now quickly to disable AutoStart=
Hint: Press 'Y' now quickly to reset gmenu2x.cfg=
Hint: To read a selected value or Link's description press X=
Hint: You can AutoStart any game/app!? See settings=
Hint: You can skip reading a message, by pressing START=
Hints=
Home Path=
Home directory=
Expand Down Expand Up @@ -194,6 +197,8 @@ Poweroff or reboot the device?=
Poweroff the device?=
Poweroff=
Preview mode=
Processing output.=
RGBA values are =
Reboot=
Rebooting=
Remember selection=
Expand Down Expand Up @@ -287,7 +292,9 @@ THIS CAN'T BE UNDONE=
TV mode=
TV-out connected. Enable?=
Telnet on boot=
Terminal output as follows=
Terminal=
Text To Speak=
Text viewer=
The section this link belongs to=
This directory is empty=
Expand All @@ -296,6 +303,7 @@ Title font size=
Title=
Top/Section Bar=
Turn off=
Typed=
USB Enabled (Nand)=
USB Enabled (Root)=
USB Enabled (SD)=
Expand All @@ -322,12 +330,15 @@ Unsupported platform=
Update OPK links=
Uptime: =
Use Ginge=
Use TTS engine to read menu out loud=
Use file browser selector=
Wallpaper=
Welcome to GMenu=
Y: Show manual=
Yes=
You should disable Usb Networking to do this.=
Zip content=
_TTS_voice_=
_about_=
_keyboard_t1_l1_=
_keyboard_t1_l2_=
Expand All @@ -338,4 +349,5 @@ _keyboard_t2_l3_=
_keyboard_t3_l1_=
_keyboard_t3_l2_=
_keyboard_t3_l3_=
at=
the settings. Continue?=
5 changes: 4 additions & 1 deletion src/browsedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ uint32_t hideAlphaNum(uint32_t interval, void *param) {
SDL_RemoveTimer(alphanum_timer); alphanum_timer = NULL;
InputManager::wakeUp(0, (void*)false);
return 0;
};
}


BrowseDialog::BrowseDialog(GMenu2X *gmenu2x, const string &title, const string &description, const string &icon):
Dialog(gmenu2x, title, description, icon) {
Expand Down Expand Up @@ -111,6 +112,8 @@ bool BrowseDialog::exec() {
gmenu2x->s->write(gmenu2x->font, getFileName(i), gmenu2x->listRect.x + 21, iY + rowHeight/2, VAlignMiddle);
}

gmenu2x->allyTTS(getFileName(selected).c_str(), FAST_GAP_TTS, FAST_SPEED_TTS, 0);

if (gmenu2x->confStr["previewMode"] != "Backdrop") {
Surface anim = new Surface(gmenu2x->s);
if (preview.empty() || preview == "#") { // hide preview
Expand Down
Loading

0 comments on commit 9027ed0

Please sign in to comment.