[Marble-devel] Review Request 124703: Adding TTS support to Marble Maps

Dennis Nienhüser dennis at nienhueser.de
Fri Aug 14 21:33:49 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/124703/#review83813
-----------------------------------------------------------



src/apps/marble-maps/TextToSpeechClient.cpp (line 13)
<https://git.reviewboard.kde.org/r/124703/#comment58045>

    Needs an `#ifdef Q_OS_ANDROID` guard



src/apps/marble-maps/TextToSpeechClient.cpp (line 28)
<https://git.reviewboard.kde.org/r/124703/#comment58046>

    Needs an `#ifdef Q_OS_ANDROID` guard as well, with a
    ```
    #else
        Q_UNUSED(text)
    #endif
    ```
    fallback. Similar below in setLocale.



src/apps/marble-maps/main.cpp (line 40)
<https://git.reviewboard.kde.org/r/124703/#comment58049>

    Can you add a comment above like
    ```
    // @todo Ship translations and only fall back to english if no translations for the system locale are installed
    ```



src/apps/marble-maps/package/src/org/kde/marble/maps/TextToSpeechClient.java (line 36)
<https://git.reviewboard.kde.org/r/124703/#comment58048>

    what about calling setAudioProperties on it also with a value of USAGE_ASSISTANCE_NAVIGATION_GUIDANCE, see https://developer.android.com/reference/android/speech/tts/TextToSpeech.html and https://developer.android.com/reference/android/media/AudioAttributes.html



src/apps/marble-maps/package/src/org/kde/marble/maps/TextToSpeechClient.java (line 39)
<https://git.reviewboard.kde.org/r/124703/#comment58050>

    TextToSpeech has an init phase and the language cannot be set before it completed. Setting the (installed) english voice fails here with this log output and it keeps speaking with a German voice:
    I/TextToSpeech(22150): Sucessfully bound to com.google.android.tts
    I/GoogleTTSService(20025): Creating Google TTS service, version 3.5.6.2080558.arm.neon
    W/TextToSpeech(22150): isLanguageAvailable failed: not bound to TTS engine
    I/org.kde.marble.maps.TextToSpeechClient(22150): Text to speech language en_US is not available
    I/TextToSpeech(22150): Connected to ComponentInfo{com.google.android.tts/com.google.android.tts.service.GoogleTTSService}
    
    Adding private members to the class
    ```
        private static final String TAG = "org.kde.marble.maps.TextToSpeechClient";
        private static String m_language = "en";
    ```
    
    and saving `language` as `m_language` in `initSpeaker` and changing onInit() like so
    ```
        public void initSpeaker(String language)
        {
            if (m_tts != null) {
                m_tts.shutdown();
            }
    
            m_tts = new TextToSpeech(this, this);
            m_language = language;
        }
    
        public void onInit(int status)
        {
            if (status == TextToSpeech.SUCCESS) {
                Locale locale = new Locale(m_language);
                if(m_tts.isLanguageAvailable(locale) >= TextToSpeech.LANG_AVAILABLE) {
                    m_tts.setLanguage(locale);
                } else {
                    Log.i(TAG, "Text to speech language " + m_language + " is not available");
                }
            }
        }
    ```
    
    fixes that.


- Dennis Nienhüser


On Aug. 13, 2015, 8:48 p.m., Gábor Péterffy wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/124703/
> -----------------------------------------------------------
> 
> (Updated Aug. 13, 2015, 8:48 p.m.)
> 
> 
> Review request for Marble.
> 
> 
> Repository: marble
> 
> 
> Description
> -------
> 
> Text to speech can be used from qml like this:
> textToSpeechClient.readText("Have a pleasant journey!");
> 
> 
> Diffs
> -----
> 
>   src/apps/marble-maps/CMakeLists.txt 15d01a5 
>   src/apps/marble-maps/TextToSpeechClient.h PRE-CREATION 
>   src/apps/marble-maps/TextToSpeechClient.cpp PRE-CREATION 
>   src/apps/marble-maps/main.cpp e1a74d6 
>   src/apps/marble-maps/package/AndroidManifest.xml dfb3061 
>   src/apps/marble-maps/package/src/org/kde/marble/maps/TextToSpeechClient.java PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/124703/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Gábor Péterffy
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20150814/6c7b5138/attachment.html>


More information about the Marble-devel mailing list