Added speech example
This commit is contained in:
@@ -34,6 +34,6 @@ dependencies {
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation 'com.aldebaran:qisdk:1.7.5'
|
||||
implementation 'com.aldebaran:qisdk-design:1.7.5'
|
||||
implementation 'com.aldebaran:qisdk:1.7.5'
|
||||
implementation 'com.aldebaran:qisdk-design:1.7.5'
|
||||
}
|
@@ -1,10 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.fitbot.fitbot">
|
||||
package="com.fitbot">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
|
@@ -2,9 +2,17 @@ package com.fitbot.speech;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import com.aldebaran.qi.sdk.builder.SayBuilder;
|
||||
import com.aldebaran.qi.sdk.object.conversation.Phrase;
|
||||
import com.aldebaran.qi.sdk.object.conversation.Say;
|
||||
import com.aldebaran.qi.sdk.object.locale.Language;
|
||||
import com.aldebaran.qi.sdk.object.locale.Locale;
|
||||
import com.aldebaran.qi.sdk.object.locale.Region;
|
||||
|
||||
|
||||
public class SpeechGenerator {
|
||||
|
||||
private QiContext qiContext; // The QiContext object
|
||||
private ISpeechCallback speechCallback = (content) -> {}; // Default empty callback
|
||||
private StringBuilder speechBuffer = new StringBuilder(); // Buffer to store the speech content
|
||||
private String languageIso639_1; // ISO 639-1 language code
|
||||
@@ -82,6 +90,10 @@ public class SpeechGenerator {
|
||||
*/
|
||||
public void speak()
|
||||
{
|
||||
Say say = new SayBuilder().with(qiContext)
|
||||
.withPhrase(speechBuffer.toString())
|
||||
.withLocale(new Locale(languageIso639_1))
|
||||
.build();
|
||||
speechCallback.onSpeechGenerated(speechBuffer.toString());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user