deej

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package deej provides a machine-side client that pairs with an Arduino chip to form a tactile, physical volume control system/

Index

Constants

View Source
const (

	// Windows Code for WM_APPCOMMAND
	WM_APPCOMMAND uint32 = 0x0319

	FAPPCOMMAND_KEY uint32 = 0x0

	//
	APPCOMMAND_MEDIA_PLAY_PAUSE uint16 = 14
)

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(buildType string) (*zap.SugaredLogger, error)

NewLogger provides a logger instance for the whole program

Types

type CanonicalConfig

type CanonicalConfig struct {
	SliderMapping *sliderMap

	ConnectionInfo struct {
		COMPort  string
		BaudRate int
	}

	InvertSliders bool

	NoiseReductionLevel string
	// contains filtered or unexported fields
}

CanonicalConfig provides application-wide access to configuration fields, as well as loading/file watching logic for deej's configuration file

func NewConfig

func NewConfig(logger *zap.SugaredLogger, notifier Notifier) (*CanonicalConfig, error)

NewConfig creates a config instance for the deej object and sets up viper instances for deej's config files

func (*CanonicalConfig) Load

func (cc *CanonicalConfig) Load() error

Load reads deej's config files from disk and tries to parse them

func (*CanonicalConfig) StopWatchingConfigFile

func (cc *CanonicalConfig) StopWatchingConfigFile()

StopWatchingConfigFile signals our filesystem watcher to stop

func (*CanonicalConfig) SubscribeToChanges

func (cc *CanonicalConfig) SubscribeToChanges() chan bool

SubscribeToChanges allows external components to receive updates when the config is reloaded

func (*CanonicalConfig) WatchConfigFileChanges

func (cc *CanonicalConfig) WatchConfigFileChanges()

WatchConfigFileChanges starts watching for configuration file changes and attempts reloading the config when they happen

type Deej

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

Deej is the main entity managing access to all sub-components

func NewDeej

func NewDeej(logger *zap.SugaredLogger, verbose bool) (*Deej, error)

NewDeej creates a Deej instance

func (*Deej) Initialize

func (d *Deej) Initialize() error

Initialize sets up components and starts to run in the background

func (*Deej) SetVersion

func (d *Deej) SetVersion(version string)

SetVersion causes deej to add a version string to its tray menu if called before Initialize

func (*Deej) Verbose

func (d *Deej) Verbose() bool

Verbose returns a boolean indicating whether deej is running in verbose mode

type Lighting

type Lighting int
const (
	Off Lighting = iota
	On
	Pulse
	Flash
)

type LightingChangeEvent

type LightingChangeEvent struct {
	SliderID int
	//PercentValue float32
	Lighting Lighting
}

type Notifier

type Notifier interface {
	Notify(title string, message string)
}

Notifier provides generic notification sending

type SerialIO

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

SerialIO provides a deej-aware abstraction layer to managing serial I/O

func NewSerialIO

func NewSerialIO(deej *Deej, logger *zap.SugaredLogger) (*SerialIO, error)

NewSerialIO creates a SerialIO instance that uses the provided deej instance's connection info to establish communications with the arduino chip

func (*SerialIO) SendLightChange

func (sio *SerialIO) SendLightChange(light LightingChangeEvent)

func (*SerialIO) Start

func (sio *SerialIO) Start() error

Start attempts to connect to our arduino chip

func (*SerialIO) Stop

func (sio *SerialIO) Stop()

Stop signals us to shut down our serial connection, if one is active

func (*SerialIO) SubscribeToSliderMoveEvents

func (sio *SerialIO) SubscribeToSliderMoveEvents() chan SliderMoveEvent

SubscribeToSliderMoveEvents returns an unbuffered channel that receives a sliderMoveEvent struct every time a slider moves

type Session

type Session interface {
	GetVolume() float32
	SetVolume(v float32) error

	GetMute() bool
	SetMute(m bool) error

	Key() string
	Release()
}

Session represents a single addressable audio session

type SessionFinder

type SessionFinder interface {
	GetAllSessions() ([]Session, error)

	Release() error
}

SessionFinder represents an entity that can find all current audio sessions

type SliderMoveEvent

type SliderMoveEvent struct {
	SliderID     int
	PercentValue float32
	ButtonDown   bool
}

SliderMoveEvent represents a single slider move captured by deej

type ToastNotifier

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

ToastNotifier provides toast notifications for Windows

func NewToastNotifier

func NewToastNotifier(logger *zap.SugaredLogger) (*ToastNotifier, error)

NewToastNotifier creates a new ToastNotifier

func (*ToastNotifier) Notify

func (tn *ToastNotifier) Notify(title string, message string)

Notify sends a toast notification (or falls back to other types of notification for older Windows versions)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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