2020-06-10, 19:40
For a screen-reader plugin you can choose the speech engine, the language, voice, etc. The settings.xml uses ACTION controls to get the addon
to present selection dialogs and do the actual setSetting(). This works okay, except that the addon does not see the changed setting values. Specifically, if the addon does an addon.setSetting, followed by an addon.getSetting for the same setting, the get will not return the value set. You have to exit the setting gui and reopen before the new values appear. It doesn't help to call xbmcaddon.Addon().getSetting(). I assume getSetting is reading the value from the settings.xml file, which is not written to until AFTER the settings gui closes.
Below is a snippet from the settings.xml for selecting the language. A similar method will be used to set the voice.
I could stash the value in the addon, but this is not very appealing. It seems this is a bug in the settings code.
to present selection dialogs and do the actual setSetting(). This works okay, except that the addon does not see the changed setting values. Specifically, if the addon does an addon.setSetting, followed by an addon.getSetting for the same setting, the get will not return the value set. You have to exit the setting gui and reopen before the new values appear. It doesn't help to call xbmcaddon.Addon().getSetting(). I assume getSetting is reading the value from the settings.xml file, which is not written to until AFTER the settings gui closes.
Below is a snippet from the settings.xml for selecting the language. A similar method will be used to set the voice.
To choose the voice, the addon needs to be able to query the language value that the addon just set above, but so far I'm out of luck. Here is the code used to query the value immediately after setting in:xml:<setting help="" id="language.ResponsiveVoice" label="32016" parent="backend" type="string">
<control type="button" format="action">
<data>NotifyAll(service.xbmc.tts,SETTINGS.SETTING_DIALOG,"[\"ResponsiveVoice\",\"language\"]"</data>
</control>
<control format="action" type="button"/>
</setting>
I could stash the value in the addon, but this is not very appealing. It seems this is a bug in the settings code.