-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
65 lines (55 loc) · 1.53 KB
/
config.go
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
package assistant
import (
embedded "google.golang.org/genproto/googleapis/assistant/embedded/v1alpha2"
)
// GoogleSampleRate is sample rate for google home speaker
const GoogleSampleRate int32 = 16000
var (
// keep the state in memory to advance the conversation.
conversationState []byte
)
func GetDefaultConfig() embedded.AssistConfig {
return embedded.AssistConfig{
AudioOutConfig: getAudioOutConfig(),
DebugConfig: getDebugConfig(),
DeviceConfig: getDeviceConfig(),
DialogStateIn: getDialogStateIn(),
ScreenOutConfig: getScreenOutConfig(),
}
}
func getAudioInConfig() *embedded.AudioInConfig {
return &embedded.AudioInConfig{
Encoding: embedded.AudioInConfig_FLAC,
SampleRateHertz: GoogleSampleRate,
}
}
func getAudioOutConfig() *embedded.AudioOutConfig {
return &embedded.AudioOutConfig{
Encoding: embedded.AudioOutConfig_LINEAR16,
SampleRateHertz: GoogleSampleRate,
VolumePercentage: 60,
}
}
func getDebugConfig() *embedded.DebugConfig {
return &embedded.DebugConfig{
ReturnDebugInfo: true,
}
}
func getDeviceConfig() *embedded.DeviceConfig {
return &embedded.DeviceConfig{
DeviceId: "go-home-assistant",
DeviceModelId: "go-home-assistant-20200401_macos",
}
}
func getDialogStateIn() *embedded.DialogStateIn {
return &embedded.DialogStateIn{
ConversationState: conversationState,
LanguageCode: "en-US",
IsNewConversation: false,
}
}
func getScreenOutConfig() *embedded.ScreenOutConfig {
return &embedded.ScreenOutConfig{
ScreenMode: embedded.ScreenOutConfig_OFF,
}
}