示例#1
0
func (s *Source) GetMeter() *Meter {
	id := fmt.Sprintf("source%d", s.core.Index)
	m, ok := meters[id]
	if !ok {
		core := pulse.NewSourceMeter(pulse.GetContext(), s.core.Index)
		core.ConnectChanged(func(v float64) {
			m.setPropVolume(v)
		})
		m = NewMeter(id, core)
		dbus.InstallOnSession(m)
		meters[id] = m
	}
	return m
}
示例#2
0
func Start() {
	if _audio != nil {
		return
	}

	logger.BeginTracing()

	ctx := pulse.GetContext()
	_audio = NewAudio(ctx)

	if err := dbus.InstallOnSession(_audio); err != nil {
		logger.Error("Failed InstallOnSession:", err)
		finalize()
		return
	}
}