audio

package
v0.0.0-...-11c0a12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2019 License: GPL-3.0 Imports: 24 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CardBuildin   = 0
	CardBluethooh = 1
	CardUnknow    = 2

	PropDeviceFromFactor = "device.form_factor"
	PropDeviceBus        = "device.bus"
)
View Source
const (
	PropAppIconName      = "application.icon_name"
	PropAppName          = "application.name"
	PropAppProcessID     = "application.process.id"
	PropAppProcessBinary = "application.process.binary"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Audio

type Audio struct {
	PropsMu sync.RWMutex
	// dbusutil-gen: equal=objectPathSliceEqual
	SinkInputs    []dbus.ObjectPath
	DefaultSink   dbus.ObjectPath
	DefaultSource dbus.ObjectPath
	Cards         string

	// dbusutil-gen: ignore
	// 最大音量
	MaxUIVolume float64 // readonly
	// contains filtered or unexported fields
}

func (*Audio) GetInterfaceName

func (*Audio) GetInterfaceName() string

func (*Audio) Reset

func (a *Audio) Reset() *dbus.Error

func (*Audio) SetPort

func (a *Audio) SetPort(cardId uint32, portName string, direction int32) *dbus.Error

SetPort activate the port for the special card. The available sinks and sources will also change with the profile changing.

type Card

type Card struct {
	Id            uint32
	Name          string
	ActiveProfile *Profile
	Profiles      ProfileList
	Ports         pulse.CardPortInfos
	// contains filtered or unexported fields
}

type CardExport

type CardExport struct {
	Id    uint32
	Name  string
	Ports []CardPortExport
}

type CardList

type CardList []*Card

type CardPortExport

type CardPortExport struct {
	Name        string
	Description string
	Direction   int
}

type Meter

type Meter struct {
	PropsMu sync.RWMutex
	Volume  float64
	// contains filtered or unexported fields
}

func (*Meter) GetInterfaceName

func (*Meter) GetInterfaceName() string

func (*Meter) Tick

func (m *Meter) Tick() *dbus.Error

type Module

type Module struct {
	*loader.ModuleBase
	// contains filtered or unexported fields
}

func NewModule

func NewModule(logger *log.Logger) *Module

func (*Module) GetDependencies

func (*Module) GetDependencies() []string

func (*Module) Start

func (m *Module) Start() error

func (*Module) Stop

func (m *Module) Stop() error

type Port

type Port struct {
	Name        string
	Description string
	Available   byte // Unknow:0, No:1, Yes:2
}

func (*Port) String

func (p *Port) String() string

type Profile

type Profile struct {
	Name        string
	Description string

	// The higher this value is, the more useful this profile is as a default.
	Priority uint32

	// 如果值是 0, 表示这个配置不可用,无法被激活
	// 如果值不为 0, 也不能保证此配置是可用的,它仅仅意味着不能肯定它是不可用的
	Available int
}

type ProfileList

type ProfileList []*Profile

type Sink

type Sink struct {
	PropsMu sync.RWMutex

	Name        string
	Description string

	// 默认音量值
	BaseVolume float64

	// 是否静音
	Mute bool

	// 当前音量
	Volume float64

	// 左右声道平衡值
	Balance float64
	// 是否支持左右声道调整
	SupportBalance bool
	// 前后声道平衡值
	Fade float64
	// 是否支持前后声道调整
	SupportFade bool

	// dbusutil-gen: equal=portsEqual
	// 支持的输出端口
	Ports []Port
	// 当前使用的输出端口
	ActivePort Port
	// 声卡的索引
	Card uint32
	// contains filtered or unexported fields
}

func (*Sink) GetInterfaceName

func (*Sink) GetInterfaceName() string

func (*Sink) GetMeter

func (s *Sink) GetMeter() (dbus.ObjectPath, *dbus.Error)

func (*Sink) SetBalance

func (s *Sink) SetBalance(v float64, isPlay bool) *dbus.Error

设置左右声道平衡值

v: 声道平衡值

isPlay: 是否播放声音反馈

func (*Sink) SetFade

func (s *Sink) SetFade(v float64) *dbus.Error

设置前后声道平衡值

v: 声道平衡值

isPlay: 是否播放声音反馈

func (*Sink) SetMute

func (s *Sink) SetMute(v bool) *dbus.Error

是否静音

func (*Sink) SetPort

func (s *Sink) SetPort(name string) *dbus.Error

设置此设备的当前使用端口

func (*Sink) SetVolume

func (s *Sink) SetVolume(v float64, isPlay bool) *dbus.Error

设置音量大小

v: 音量大小

isPlay: 是否播放声音反馈

type SinkInput

type SinkInput struct {
	PropsMu sync.RWMutex

	// Name process name
	Name           string
	Icon           string
	Mute           bool
	Volume         float64
	Balance        float64
	SupportBalance bool
	Fade           float64
	SupportFade    bool
	SinkIndex      uint32
	// contains filtered or unexported fields
}

func (*SinkInput) GetInterfaceName

func (*SinkInput) GetInterfaceName() string

func (*SinkInput) SetBalance

func (s *SinkInput) SetBalance(v float64, isPlay bool) *dbus.Error

func (*SinkInput) SetFade

func (s *SinkInput) SetFade(v float64) *dbus.Error

func (*SinkInput) SetMute

func (s *SinkInput) SetMute(v bool) *dbus.Error

func (*SinkInput) SetVolume

func (s *SinkInput) SetVolume(v float64, isPlay bool) *dbus.Error

type Source

type Source struct {
	PropsMu sync.RWMutex

	Name        string
	Description string
	// 默认的输入音量
	BaseVolume     float64
	Mute           bool
	Volume         float64
	Balance        float64
	SupportBalance bool
	Fade           float64
	SupportFade    bool
	// dbusutil-gen: equal=portsEqual
	Ports      []Port
	ActivePort Port
	// 声卡的索引
	Card uint32
	// contains filtered or unexported fields
}

func (*Source) GetInterfaceName

func (*Source) GetInterfaceName() string

func (*Source) GetMeter

func (s *Source) GetMeter() (dbus.ObjectPath, *dbus.Error)

func (*Source) SetBalance

func (s *Source) SetBalance(v float64, isPlay bool) *dbus.Error

func (*Source) SetFade

func (s *Source) SetFade(v float64) *dbus.Error

func (*Source) SetMute

func (s *Source) SetMute(v bool) *dbus.Error

func (*Source) SetPort

func (s *Source) SetPort(name string) *dbus.Error

func (*Source) SetVolume

func (s *Source) SetVolume(v float64, isPlay bool) *dbus.Error

如何反馈输入音量?

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL