device

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UninitializedDeviceError   = errors.New("IMMDevice is nil or uninitialized")
	MissingAudioEndpointVolume = errors.New("device has no volume endpoint")
	AudioSessionNotFound       = errors.New("audio session not found")
)

Functions

This section is empty.

Types

type Device

type Device struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(mmd *wca.IMMDevice) (*Device, error)

New takes in a *wca.IMMDevice and wraps it as a *Device with some nice helper methods to do common tasks like SetVolumeLevel, GetVolumeLevel, etc.

func (*Device) Cleanup

func (d *Device) Cleanup() error

Cleanup will release and remove any pointers or leftover devices from the creation process.

func (*Device) DeviceName

func (d *Device) DeviceName() (string, error)

DeviceName returns the name of the audio device if it exists.

func (*Device) GetVolumeLevel

func (d *Device) GetVolumeLevel() (float32, error)

GetVolumeLevel will get the volume of the device, if it exists, as a float on the scale of 0-1.

func (*Device) RefreshAudioSessions

func (d *Device) RefreshAudioSessions() error

RefreshAudioSessions will attempt to repopulate all of the stored audio session information for use with the SetAudioSessionVolume, GetAudioSessionVolume, etc.

func (*Device) SetAudioSessionVolumeLevel

func (d *Device) SetAudioSessionVolumeLevel(sessionName string, v float32) error

SetAudioSessionVolumeLevel takes the sessionName which is the string to match on the ProcessExecutable of the sessions and a float between 0-1 to set the volume of any matching sessions.

func (*Device) SetVolumeLevel

func (d *Device) SetVolumeLevel(v float32) error

SetVolumeLevel takes a float between 0-1 and it will set the volume of the device to that value.

Jump to

Keyboard shortcuts

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