aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlawl <github@dumbinter.net>2020-08-03 15:00:43 +0200
committerlawl <github@dumbinter.net>2020-08-03 15:00:43 +0200
commit371b3e33b523f45ec51776e7e7a33f824084dca5 (patch)
tree9d7573b66f43dd687e8064f5976a22e62dff21c4
parent4243d5036d1e7d339ca8ee3ff8a0be88a9f0d92c (diff)
downloadnoisetorch-371b3e33b523f45ec51776e7e7a33f824084dca5.tar.gz
noisetorch-371b3e33b523f45ec51776e7e7a33f824084dca5.zip
Fix bugs with pa reconnection
-rw-r--r--main.go3
-rw-r--r--ui.go18
2 files changed, 16 insertions, 5 deletions
diff --git a/main.go b/main.go
index 6bd2ca0..515416e 100644
--- a/main.go
+++ b/main.go
@@ -101,6 +101,7 @@ func removeLib(file string) {
func paConnectionWatchdog(ui *uistate) {
for {
if ui.paClient.Connected() {
+ time.Sleep(500 * time.Millisecond)
continue
}
@@ -139,6 +140,8 @@ func paConnectionWatchdog(ui *uistate) {
ui.inputList = inputs
+ resetUI(ui)
+
time.Sleep(500 * time.Millisecond)
}
}
diff --git a/ui.go b/ui.go
index 0b5b7e3..e10c8fa 100644
--- a/ui.go
+++ b/ui.go
@@ -35,6 +35,11 @@ var orange = color.RGBA{255, 140, 0, 255}
func updatefn(w *nucular.Window, ui *uistate) {
+ if !ui.paClient.Connected() {
+ connectScreen(w, ui)
+ return
+ }
+
if ui.loadingScreen {
loadingScreen(w, ui)
return
@@ -50,11 +55,6 @@ func updatefn(w *nucular.Window, ui *uistate) {
return
}
- if !ui.paClient.Connected() {
- connectScreen(w, ui)
- return
- }
-
w.MenubarBegin()
w.Row(10).Dynamic(2)
@@ -270,3 +270,11 @@ func connectScreen(w *nucular.Window, ui *uistate) {
w.Row(50).Dynamic(1)
w.Label("Connecting to pulseaudio...", "CB")
}
+
+func resetUI(ui *uistate) {
+ ui.loadingScreen = false
+
+ if ui.masterWindow != nil {
+ (*ui.masterWindow).Changed()
+ }
+}