Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/pulse/pulse.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@ import (
log "github.com/sirupsen/logrus"
)

var initialized = false
var currentVolume float64

var lock sync.Mutex
var watchers []chan struct{}

func init() {
log.Info("connecting to pulse")
r := C.initialize()
if r != 0 {
log.Error("could not connect to pulse")
func Init() {
if !initialized {
initialized = true
log.Info("connecting to pulse")
r := C.initialize()
if r != 0 {
log.Error("could not connect to pulse")
}
go C.run()
}
go C.run()
}

func Volume() float64 {
Expand Down
1 change: 1 addition & 0 deletions ui/module/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewVolume(p ui.ParentDrawable, mk *markup.Markup) *Volume {
}

func (m *Volume) Init() error {
pulse.Init()
_, err := m.mk.Parse(m, m, `
<Row ref="Root">
<Sizer PaddingRight="{h_padding}">
Expand Down