-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtext_to_speech_engine.go
More file actions
80 lines (71 loc) · 1.99 KB
/
Copy pathtext_to_speech_engine.go
File metadata and controls
80 lines (71 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Code generated by javagen. DO NOT EDIT.
package speech
import (
"fmt"
"unsafe"
"github.com/AndroidGoLab/jni"
"github.com/AndroidGoLab/jni/app"
)
// Ensure imports are used.
var (
_ = fmt.Errorf
_ = unsafe.Pointer(nil)
_ *app.Context
)
// TextToSpeechEngine wraps android.speech.tts.TextToSpeech$Engine.
type TextToSpeechEngine struct {
VM *jni.VM
Obj *jni.GlobalRef
}
// NewTextToSpeechEngine creates a new android.speech.tts.TextToSpeech$Engine instance.
func NewTextToSpeechEngine(vm *jni.VM, arg0 *jni.Object) (*TextToSpeechEngine, error) {
var t TextToSpeechEngine
t.VM = vm
err := vm.Do(func(env *jni.Env) error {
if err := ensureInit(env); err != nil {
return err
}
if clsTextToSpeechEngine == nil {
return fmt.Errorf("android.speech.tts.TextToSpeech$Engine is not available on this device")
}
if midTextToSpeechEngineCtor == nil {
return fmt.Errorf("android.speech.tts.TextToSpeech$Engine constructor (Landroid/speech/tts/TextToSpeech;)V is not available on this device")
}
obj, err := env.NewObject((*jni.Class)(unsafe.Pointer(clsTextToSpeechEngine)), midTextToSpeechEngineCtor, jni.ObjectValue(arg0))
if err != nil {
return err
}
t.Obj = env.NewGlobalRef(obj)
return nil
})
if err != nil {
return nil, err
}
return &t, nil
}
// ToString calls android.speech.tts.TextToSpeech$Engine.toString.
func (m *TextToSpeechEngine) ToString() (string, error) {
var result string
var callErr error
callErr = m.VM.Do(func(env *jni.Env) error {
if err := ensureInit(env); err != nil {
callErr = err
return err
}
if midTextToSpeechEngineToString == nil {
callErr = fmt.Errorf("android.speech.tts.TextToSpeech$Engine.toString is not available on this device")
return callErr
}
var resultObj *jni.Object
resultObj, callErr = env.CallObjectMethod(
m.Obj,
midTextToSpeechEngineToString,
)
if callErr != nil {
return callErr
}
result = env.GoString((*jni.String)(unsafe.Pointer(resultObj)))
return callErr
})
return result, callErr
}