@@ -29,10 +29,10 @@ type CurrentPlaybackDevice struct {
2929 OutputWaveWidget * widget.ProgressBar
3030 Context * malgo.AllocatedContext
3131
32- device * malgo.Device
33- stopChannel chan bool
34- playTestAudio bool
35- testAudioChannels uint32
32+ device * malgo.Device
33+ stopChannel chan bool
34+ playTestAudio bool
35+ testAudioChannels uint32
3636 testAudioSampleRate uint32
3737}
3838
@@ -218,7 +218,6 @@ func (c *CurrentPlaybackDevice) Init() {
218218 }
219219 }
220220
221-
222221 //######################
223222 var err error
224223 c .Context , err = malgo .InitContext ([]malgo.Backend {malgo .BackendWinmm }, malgo.ContextConfig {}, func (message string ) {
@@ -233,7 +232,6 @@ func (c *CurrentPlaybackDevice) Init() {
233232 c .Context .Free ()
234233 }()
235234
236-
237235 // run as long as no stop signal is received
238236 c .stopChannel = make (chan bool )
239237 for {
@@ -324,6 +322,29 @@ func CreateProfileWindow(onClose func()) fyne.CanvasObject {
324322
325323 profileForm .Append ("" , layout .NewSpacer ())
326324
325+ energySliderState := widget .NewLabel ("0.0" )
326+ energySliderWidget := widget .NewSlider (0 , 1000 )
327+ energySliderWidget .OnChanged = func (value float64 ) {
328+ energySliderState .SetText (fmt .Sprintf ("%.0f" , value ))
329+ }
330+ profileForm .Append ("Speech detection Level" , container .NewBorder (nil , nil , nil , energySliderState , energySliderWidget ))
331+
332+ pauseSliderState := widget .NewLabel ("0.0" )
333+ pauseSliderWidget := widget .NewSlider (0 , 5 )
334+ pauseSliderWidget .Step = 0.1
335+ pauseSliderWidget .OnChanged = func (value float64 ) {
336+ pauseSliderState .SetText (fmt .Sprintf ("%.1f" , value ))
337+ }
338+ profileForm .Append ("Speech pause detection" , container .NewBorder (nil , nil , nil , pauseSliderState , pauseSliderWidget ))
339+
340+ phraseLimitSliderState := widget .NewLabel ("0.0" )
341+ phraseLimitSliderWidget := widget .NewSlider (0 , 50 )
342+ phraseLimitSliderWidget .Step = 0.1
343+ phraseLimitSliderWidget .OnChanged = func (value float64 ) {
344+ phraseLimitSliderState .SetText (fmt .Sprintf ("%.1f" , value ))
345+ }
346+ profileForm .Append ("Phrase time limit" , container .NewBorder (nil , nil , nil , phraseLimitSliderState , phraseLimitSliderWidget ))
347+
327348 profileForm .Append ("A.I. Device for Speech to Text" , CustomWidget .NewTextValueSelect ("ai_device" , []CustomWidget.TextValueOption {
328349 {Text : "CUDA" , Value : "cuda" },
329350 {Text : "CPU" , Value : "cpu" },
@@ -421,6 +442,10 @@ func CreateProfileWindow(onClose func()) fyne.CanvasObject {
421442 Current_language : "" ,
422443 Osc_ip : "127.0.0.1" ,
423444 Osc_port : 9000 ,
445+
446+ Phrase_time_limit : 0.0 ,
447+ Pause : 0.8 ,
448+ Energy : 300 ,
424449 }
425450 err = profileSettings .LoadYamlSettings (settingsFiles [id ])
426451 if err != nil {
@@ -461,14 +486,19 @@ func CreateProfileWindow(onClose func()) fyne.CanvasObject {
461486
462487 // audio progressbar
463488 // spacer
489+ profileForm .Items [8 ].Widget .(* fyne.Container ).Objects [0 ].(* widget.Slider ).SetValue (float64 (profileSettings .Energy ))
490+ profileForm .Items [9 ].Widget .(* fyne.Container ).Objects [0 ].(* widget.Slider ).SetValue (float64 (profileSettings .Pause ))
491+ profileForm .Items [10 ].Widget .(* fyne.Container ).Objects [0 ].(* widget.Slider ).SetValue (float64 (profileSettings .Phrase_time_limit ))
492+
493+
464494 if profileSettings .Ai_device != nil {
465- profileForm .Items [8 ].Widget .(* CustomWidget.TextValueSelect ).SetSelected (profileSettings .Ai_device .(string ))
495+ profileForm .Items [11 ].Widget .(* CustomWidget.TextValueSelect ).SetSelected (profileSettings .Ai_device .(string ))
466496 }
467- profileForm .Items [9 ].Widget .(* CustomWidget.TextValueSelect ).SetSelected (profileSettings .Model )
497+ profileForm .Items [12 ].Widget .(* CustomWidget.TextValueSelect ).SetSelected (profileSettings .Model )
468498 // spacer
469- profileForm .Items [11 ].Widget .(* CustomWidget.TextValueSelect ).SetSelected (profileSettings .Txt_translator_size )
470- profileForm .Items [12 ].Widget .(* widget.Check ).SetChecked (profileSettings .Tts_enabled )
471- profileForm .Items [13 ].Widget .(* CustomWidget.TextValueSelect ).SetSelected (profileSettings .Tts_ai_device )
499+ profileForm .Items [14 ].Widget .(* CustomWidget.TextValueSelect ).SetSelected (profileSettings .Txt_translator_size )
500+ profileForm .Items [15 ].Widget .(* widget.Check ).SetChecked (profileSettings .Tts_enabled )
501+ profileForm .Items [16 ].Widget .(* CustomWidget.TextValueSelect ).SetSelected (profileSettings .Tts_ai_device )
472502
473503 profileForm .OnSubmit = func () {
474504 profileSettings .Websocket_ip = profileForm .Items [0 ].Widget .(* widget.Entry ).Text
@@ -478,12 +508,16 @@ func CreateProfileWindow(onClose func()) fyne.CanvasObject {
478508
479509 profileSettings .Device_out_index , _ = strconv .Atoi (profileForm .Items [5 ].Widget .(* CustomWidget.TextValueSelect ).GetSelected ().Value )
480510
481- profileSettings .Ai_device = profileForm .Items [8 ].Widget .(* CustomWidget.TextValueSelect ).GetSelected ().Value
482- profileSettings .Model = profileForm .Items [9 ].Widget .(* CustomWidget.TextValueSelect ).GetSelected ().Value
511+ profileSettings .Energy = int (profileForm .Items [8 ].Widget .(* fyne.Container ).Objects [0 ].(* widget.Slider ).Value )
512+ profileSettings .Pause = profileForm .Items [9 ].Widget .(* fyne.Container ).Objects [0 ].(* widget.Slider ).Value
513+ profileSettings .Phrase_time_limit = profileForm .Items [10 ].Widget .(* fyne.Container ).Objects [0 ].(* widget.Slider ).Value
483514
484- profileSettings .Txt_translator_size = profileForm .Items [11 ].Widget .(* CustomWidget.TextValueSelect ).GetSelected ().Value
485- profileSettings .Tts_enabled = profileForm .Items [12 ].Widget .(* widget.Check ).Checked
486- profileSettings .Tts_ai_device = profileForm .Items [13 ].Widget .(* CustomWidget.TextValueSelect ).GetSelected ().Value
515+ profileSettings .Ai_device = profileForm .Items [11 ].Widget .(* CustomWidget.TextValueSelect ).GetSelected ().Value
516+ profileSettings .Model = profileForm .Items [12 ].Widget .(* CustomWidget.TextValueSelect ).GetSelected ().Value
517+
518+ profileSettings .Txt_translator_size = profileForm .Items [14 ].Widget .(* CustomWidget.TextValueSelect ).GetSelected ().Value
519+ profileSettings .Tts_enabled = profileForm .Items [15 ].Widget .(* widget.Check ).Checked
520+ profileSettings .Tts_ai_device = profileForm .Items [16 ].Widget .(* CustomWidget.TextValueSelect ).GetSelected ().Value
487521
488522 // update existing settings or create new one if it does not exist yet
489523 if Utilities .FileExists (settingsFiles [id ]) {
@@ -498,10 +532,14 @@ func CreateProfileWindow(onClose func()) fyne.CanvasObject {
498532 Txt_translator_size : profileSettings .Txt_translator_size ,
499533 Websocket_ip : profileSettings .Websocket_ip ,
500534 Websocket_port : profileSettings .Websocket_port ,
501- Osc_ip : profileSettings .Osc_ip ,
502- Osc_port : profileSettings .Osc_port ,
535+ Osc_ip : profileSettings .Osc_ip ,
536+ Osc_port : profileSettings .Osc_port ,
503537 Tts_enabled : profileSettings .Tts_enabled ,
504538 Tts_ai_device : profileSettings .Tts_ai_device ,
539+
540+ Phrase_time_limit : profileSettings .Phrase_time_limit ,
541+ Pause : profileSettings .Pause ,
542+ Energy : profileSettings .Energy ,
505543 }
506544 newProfileEntry .Save (settingsFiles [id ])
507545 }
@@ -547,7 +585,6 @@ func CreateProfileWindow(onClose func()) fyne.CanvasObject {
547585 profileList .Refresh ()
548586 }), newProfileEntry )
549587
550-
551588 mainContent := container .NewHSplit (
552589 container .NewMax (profileHelpTextContent , profileListContent ),
553590 container .NewBorder (newProfileRow , nil , nil , nil , profileList ),
0 commit comments