pulse

package
v0.0.0-...-17244d7 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectionSink int = iota + 1
	DirectionSource
)
View Source
const (
	VolumeMax   = C.PA_VOLUME_MAX * 1.0 / C.PA_VOLUME_NORM
	VolumeUIMax = 99957.0 / C.PA_VOLUME_NORM // C.pa_sw_volume_from_dB(11.0)
)
View Source
const (
	AvailableTypeUnknow int = iota
	AvailableTypeNo
	AvailableTypeYes
)
View Source
const (
	PA_PROP_MEDIA_NAME                     = "media.name"
	PA_PROP_MEDIA_TITLE                    = "media.title"
	PA_PROP_MEDIA_ARTIST                   = "media.artist"
	PA_PROP_MEDIA_COPYRIGHT                = "media.copyright"
	PA_PROP_MEDIA_SOFTWARE                 = "media.software"
	PA_PROP_MEDIA_LANGUAGE                 = "media.language"
	PA_PROP_MEDIA_FILENAME                 = "media.filename"
	PA_PROP_MEDIA_ICON_NAME                = "media.icon_name"
	PA_PROP_MEDIA_ROLE                     = "media.role"
	PA_PROP_FILTER_WANT                    = "filter.want"
	PA_PROP_FILTER_APPLY                   = "filter.apply"
	PA_PROP_FILTER_SUPPRESS                = "filter.suppress"
	PA_PROP_EVENT_ID                       = "event.id"
	PA_PROP_EVENT_DESCRIPTION              = "event.description"
	PA_PROP_EVENT_MOUSE_X                  = "event.mouse.x"
	PA_PROP_EVENT_MOUSE_Y                  = "event.mouse.y"
	PA_PROP_EVENT_MOUSE_HPOS               = "event.mouse.hpos"
	PA_PROP_EVENT_MOUSE_VPOS               = "event.mouse.vpos"
	PA_PROP_EVENT_MOUSE_BUTTON             = "event.mouse.button"
	PA_PROP_WINDOW_NAME                    = "window.name"
	PA_PROP_WINDOW_ID                      = "window.id"
	PA_PROP_WINDOW_ICON_NAME               = "window.icon_name"
	PA_PROP_WINDOW_X                       = "window.x"
	PA_PROP_WINDOW_Y                       = "window.y"
	PA_PROP_WINDOW_WIDTH                   = "window.width"
	PA_PROP_WINDOW_HEIGHT                  = "window.height"
	PA_PROP_WINDOW_HPOS                    = "window.hpos"
	PA_PROP_WINDOW_VPOS                    = "window.vpos"
	PA_PROP_WINDOW_DESKTOP                 = "window.desktop"
	PA_PROP_WINDOW_X11_DISPLAY             = "window.x11.display"
	PA_PROP_WINDOW_X11_SCREEN              = "window.x11.screen"
	PA_PROP_WINDOW_X11_MONITOR             = "window.x11.monitor"
	PA_PROP_WINDOW_X11_XID                 = "window.x11.xid"
	PA_PROP_APPLICATION_NAME               = "application.name"
	PA_PROP_APPLICATION_ID                 = "application.id"
	PA_PROP_APPLICATION_VERSION            = "application.version"
	PA_PROP_APPLICATION_ICON_NAME          = "application.icon_name"
	PA_PROP_APPLICATION_LANGUAGE           = "application.language"
	PA_PROP_APPLICATION_PROCESS_ID         = "application.process.id"
	PA_PROP_APPLICATION_PROCESS_BINARY     = "application.process.binary"
	PA_PROP_APPLICATION_PROCESS_USER       = "application.process.user"
	PA_PROP_APPLICATION_PROCESS_HOST       = "application.process.host"
	PA_PROP_APPLICATION_PROCESS_MACHINE_ID = "application.process.machine_id"
	PA_PROP_APPLICATION_PROCESS_SESSION_ID = "application.process.session_id"
	PA_PROP_DEVICE_STRING                  = "device.string"
	PA_PROP_DEVICE_API                     = "device.api"
	PA_PROP_DEVICE_DESCRIPTION             = "device.description"
	PA_PROP_DEVICE_BUS_PATH                = "device.bus_path"
	PA_PROP_DEVICE_SERIAL                  = "device.serial"
	PA_PROP_DEVICE_VENDOR_ID               = "device.vendor.id"
	PA_PROP_DEVICE_VENDOR_NAME             = "device.vendor.name"
	PA_PROP_DEVICE_PRODUCT_ID              = "device.product.id"
	PA_PROP_DEVICE_PRODUCT_NAME            = "device.product.name"
	PA_PROP_DEVICE_CLASS                   = "device.class"
	PA_PROP_DEVICE_FORM_FACTOR             = "device.form_factor"
	PA_PROP_DEVICE_BUS                     = "device.bus"
	PA_PROP_DEVICE_ICON_NAME               = "device.icon_name"
	PA_PROP_DEVICE_ACCESS_MODE             = "device.access_mode"
	PA_PROP_DEVICE_MASTER_DEVICE           = "device.master_device"
	PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE   = "device.buffering.buffer_size"
	PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE = "device.buffering.fragment_size"
	PA_PROP_DEVICE_PROFILE_NAME            = "device.profile.name"
	PA_PROP_DEVICE_INTENDED_ROLES          = "device.intended_roles"
	PA_PROP_DEVICE_PROFILE_DESCRIPTION     = "device.profile.description"
	PA_PROP_MODULE_AUTHOR                  = "module.author"
	PA_PROP_MODULE_DESCRIPTION             = "module.description"
	PA_PROP_MODULE_USAGE                   = "module.usage"
	PA_PROP_MODULE_VERSION                 = "module.version"
	PA_PROP_FORMAT_SAMPLE_FORMAT           = "format.sample_format"
	PA_PROP_FORMAT_RATE                    = "format.rate"
	PA_PROP_FORMAT_CHANNELS                = "format.channels"
	PA_PROP_FORMAT_CHANNEL_MAP             = "format.channel_map"
)
View Source
const (
	EventTypeNew    = C.PA_SUBSCRIPTION_EVENT_NEW
	EventTypeChange = C.PA_SUBSCRIPTION_EVENT_CHANGE
	EventTypeRemove = C.PA_SUBSCRIPTION_EVENT_REMOVE
)
View Source
const (
	FacilityServer       = C.PA_SUBSCRIPTION_EVENT_SERVER
	FacilitySink         = C.PA_SUBSCRIPTION_EVENT_SINK
	FacilitySource       = C.PA_SUBSCRIPTION_EVENT_SOURCE
	FacilitySinkInput    = C.PA_SUBSCRIPTION_EVENT_SINK_INPUT
	FacilitySourceOutput = C.PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT
	FacilityCard         = C.PA_SUBSCRIPTION_EVENT_CARD
	FacilityClient       = C.PA_SUBSCRIPTION_EVENT_CLIENT
	FacilityModule       = C.PA_SUBSCRIPTION_EVENT_MODULE
	FacilitySampleCache  = C.PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE
)
View Source
const (
	ContextStateUnconnected = C.PA_CONTEXT_UNCONNECTED
	ContextStateConnecting  = C.PA_CONTEXT_CONNECTING
	ContextStateAuthorizing = C.PA_CONTEXT_AUTHORIZING
	ContextStateSettingName = C.PA_CONTEXT_SETTING_NAME
	ContextStateReady       = C.PA_CONTEXT_READY
	ContextStateFailed      = C.PA_CONTEXT_FAILED
	ContextStateTerminated  = C.PA_CONTEXT_TERMINATED
)

Variables

View Source
var PulseInitTimeout = 20

Functions

func NewPaInfo

func NewPaInfo(data unsafe.Pointer, Type int) *paInfo

Types

type CVolume

type CVolume struct {
	// contains filtered or unexported fields
}

func (CVolume) Avg

func (cv CVolume) Avg() float64

func (CVolume) Balance

func (cv CVolume) Balance(cmap ChannelMap) float64

func (CVolume) Fade

func (cv CVolume) Fade(cmap ChannelMap) float64

func (CVolume) SetAvg

func (cv CVolume) SetAvg(v float64) CVolume

func (CVolume) SetBalance

func (cv CVolume) SetBalance(cm ChannelMap, balance float64) CVolume

func (CVolume) SetFade

func (cv CVolume) SetFade(cm ChannelMap, fade float64) CVolume

type Callback

type Callback func(eventType int, idx uint32)

type Card

type Card struct {
	Index       uint32
	Name        string
	OwnerModule uint32
	Driver      string

	PropList      map[string]string
	Profiles      ProfileInfos2
	ActiveProfile ProfileInfo2
	Ports         CardPortInfos
}
typedef struct pa_card_info {
	uint32_t index;                      /**< Index of this card */
	const char *name;                    /**< Name of this card */
	uint32_t owner_module;               /**< Index of the owning module, or PA_INVALID_INDEX. */
	const char *driver;                  /**< Driver name */
	uint32_t n_profiles;                 /**< Number of entries in profile array */
	pa_card_profile_info* profiles;      /**< \deprecated Superseded by profiles2 */
	pa_card_profile_info* active_profile; /**< \deprecated Superseded by active_profile2 */
	pa_proplist *proplist;               /**< Property list */
	uint32_t n_ports;                    /**< Number of entries in port array */
	pa_card_port_info **ports;           /**< Array of pointers to ports, or NULL. Array is terminated by an entry set to NULL. */
	pa_card_profile_info2** profiles2;    /**< Array of pointers to available profiles, or NULL. Array is terminated by an entry set to NULL. \since 5.0 */
	pa_card_profile_info2* active_profile2; /**< Pointer to active profile in the array, or NULL. \since 5.0 */
} pa_card_info;

func (*Card) SetProfile

func (card *Card) SetProfile(name string)

type CardPortInfo

type CardPortInfo struct {
	PortInfo
	Direction int
	Profiles  ProfileInfos2
}

type CardPortInfos

type CardPortInfos []CardPortInfo

func (CardPortInfos) Get

func (infos CardPortInfos) Get(name string, direction int) (CardPortInfo, error)

func (CardPortInfos) TrySelectProfile

func (infos CardPortInfos) TrySelectProfile(portName string) (string, error)

type ChannelMap

type ChannelMap struct {
	// contains filtered or unexported fields
}

func (ChannelMap) CanBalance

func (cm ChannelMap) CanBalance() bool

func (ChannelMap) CanFade

func (cm ChannelMap) CanFade() bool

type ChannelPosition

type ChannelPosition int32

type Context

type Context struct {
	// contains filtered or unexported fields
}

func GetContext

func GetContext() *Context

func GetContextForced

func GetContextForced() *Context

func (*Context) AddEventChan

func (c *Context) AddEventChan(ch chan<- *Event)

func (*Context) AddStateChan

func (c *Context) AddStateChan(ch chan<- int)

func (*Context) GetCard

func (c *Context) GetCard(index uint32) (*Card, error)

func (*Context) GetCardList

func (c *Context) GetCardList() (r []*Card)

func (*Context) GetDefaultSink

func (c *Context) GetDefaultSink() string

func (*Context) GetDefaultSource

func (c *Context) GetDefaultSource() string

func (*Context) GetServer

func (c *Context) GetServer() (*Server, error)

func (*Context) GetSink

func (c *Context) GetSink(index uint32) (*Sink, error)

func (*Context) GetSinkInput

func (c *Context) GetSinkInput(index uint32) (*SinkInput, error)

func (*Context) GetSinkInputList

func (c *Context) GetSinkInputList() (r []*SinkInput)

func (*Context) GetSinkList

func (c *Context) GetSinkList() (r []*Sink)

func (*Context) GetSource

func (c *Context) GetSource(index uint32) (*Source, error)

func (*Context) GetSourceList

func (c *Context) GetSourceList() (r []*Source)

func (*Context) GetSourceOutput

func (c *Context) GetSourceOutput(index uint32) (*SourceOutput, error)

func (*Context) GetSourceOutputList

func (c *Context) GetSourceOutputList() (r []*SourceOutput)

func (*Context) MoveSinkInputsByIndex

func (c *Context) MoveSinkInputsByIndex(sinkInputs []uint32, sinkIdx uint32)

MoveSinkInputsByIndex move sink-inputs to the special sink index

func (*Context) MoveSinkInputsByName

func (c *Context) MoveSinkInputsByName(sinkInputs []uint32, sinkName string)

MoveSinkInputsByName move sink-inputs to the special sink name

func (*Context) MoveSourceOutputsByIndex

func (c *Context) MoveSourceOutputsByIndex(sourceOutputs []uint32, sourceIdx uint32)

MoveSourceOutputsByIndex move source-outputs to the special source index

func (*Context) MoveSourceOutputsByName

func (c *Context) MoveSourceOutputsByName(sourceOutputs []uint32, sourceName string)

MoveSourceOutputsByName move source-outputs to the special source name

func (*Context) RemoveEventChan

func (c *Context) RemoveEventChan(ch chan<- *Event)

func (*Context) RemoveStateChan

func (c *Context) RemoveStateChan(ch chan<- int)

func (*Context) SetDefaultSink

func (c *Context) SetDefaultSink(name string)

func (*Context) SetDefaultSource

func (c *Context) SetDefaultSource(name string)

func (*Context) SetSinkInputMute

func (c *Context) SetSinkInputMute(sinkInputIndex uint32, mute bool)

func (*Context) SetSinkInputVolume

func (c *Context) SetSinkInputVolume(sinkInputIndex uint32, v CVolume)

func (*Context) SetSinkMuteByIndex

func (c *Context) SetSinkMuteByIndex(sinkIndex uint32, mute bool)

func (*Context) SetSinkPortByIndex

func (c *Context) SetSinkPortByIndex(sinkIndex uint32, portName string)

func (*Context) SetSinkVolumeByIndex

func (c *Context) SetSinkVolumeByIndex(sinkIndex uint32, v CVolume)

func (*Context) SetSourceMuteByIndex

func (c *Context) SetSourceMuteByIndex(sourceIndex uint32, mute bool)

func (*Context) SetSourcePortByIndex

func (c *Context) SetSourcePortByIndex(sourceIndex uint32, portName string)

func (*Context) SetSourceVolumeByIndex

func (c *Context) SetSourceVolumeByIndex(sourceIndex uint32, v CVolume)

func (*Context) SuspendSinkById

func (c *Context) SuspendSinkById(idx uint32, suspend int)

func (*Context) SuspendSourceById

func (c *Context) SuspendSourceById(idx uint32, suspend int)

type Event

type Event struct {
	Facility int
	Type     int
	Index    uint32
}

type PortInfo

type PortInfo struct {
	Name        string
	Description string
	Priority    uint32
	Available   int // 0: Unknow, 1: No, 2: Yes
}

type PortInfos

type PortInfos []PortInfo

func (PortInfos) Get

func (infos PortInfos) Get(name string) *PortInfo

type ProfileInfo2

type ProfileInfo2 struct {
	Name        string
	Description string
	Priority    uint32
	NSinks      uint32
	NSources    uint32
	Available   int
}

type ProfileInfos2

type ProfileInfos2 []ProfileInfo2

func (ProfileInfos2) Exists

func (infos ProfileInfos2) Exists(name string) bool

func (ProfileInfos2) Len

func (infos ProfileInfos2) Len() int

func (ProfileInfos2) Less

func (infos ProfileInfos2) Less(i, j int) bool

func (ProfileInfos2) SelectProfile

func (infos ProfileInfos2) SelectProfile() string

func (ProfileInfos2) Swap

func (infos ProfileInfos2) Swap(i, j int)

type PropList

type PropList map[string]string

type SampleFormat

type SampleFormat int32

type SampleSpec

type SampleSpec struct {
	Format   SampleFormat
	Rate     uint32
	Channels uint8
}

type Server

type Server struct {
	UserName      string
	HostName      string
	ServerVersion string
	ServerName    string
	//sample_spec
	DefaultSinkName   string
	DefaultSourceName string
	Cookie            uint32
	ChannelMap        ChannelMap
}

type Sink

type Sink struct {
	Index uint32

	Name        string
	Description string

	ChannelMap ChannelMap

	OwnerModule       uint32
	Volume            CVolume
	Mute              bool
	MonitorSource     uint32
	MonitorSourceName string

	Driver string
	Flags  int

	PropList map[string]string

	BaseVolume Volume

	NVolumeSteps uint32

	Card uint32

	Ports      []PortInfo
	ActivePort PortInfo
}

type SinkInput

type SinkInput struct {
	Index       uint32
	Name        string
	OwnerModule uint32
	Client      uint32
	Sink        uint32

	ChannelMap ChannelMap
	Volume     CVolume

	ResampleMethod string
	Driver         string

	Mute     bool
	PropList map[string]string
	Corked   int

	HasVolume      bool
	VolumeWritable bool
}

type Source

type Source struct {
	Index uint32

	Name        string
	Description string

	ChannelMap        ChannelMap
	OwnerModule       uint32
	Volume            CVolume
	Mute              bool
	MonitorOfSink     uint32
	MonitorOfSinkName string

	Driver string

	Flags int

	Proplist map[string]string

	BaseVolume Volume

	NVolumeSteps uint32
	Card         uint32
	Ports        []PortInfo
	ActivePort   PortInfo
}

type SourceMeter

type SourceMeter struct {
	// contains filtered or unexported fields
}

func NewSourceMeter

func NewSourceMeter(c *Context, idx uint32) *SourceMeter

func (*SourceMeter) ConnectChanged

func (s *SourceMeter) ConnectChanged(cb func(v float64))

func (*SourceMeter) Destroy

func (s *SourceMeter) Destroy()

type SourceOutput

type SourceOutput struct{}

type Volume

type Volume struct {
	// contains filtered or unexported fields
}

func (Volume) ToLiner

func (v Volume) ToLiner() float64

func (Volume) ToPercent

func (v Volume) ToPercent() float64

func (Volume) TodB

func (v Volume) TodB() float64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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