util

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDirExists

func EnsureDirExists(path string) error

EnsureDirExists creates the given directory path if it doesn't already exist

func FileExists

func FileExists(filename string) bool

FileExists checks if a file exists and is not a directory before we try using it to prevent further errors.

func GetCurrentWindowProcessNames

func GetCurrentWindowProcessNames() ([]string, error)

GetCurrentWindowProcessNames returns the process names (including extension, if applicable) of the current foreground window. This includes child processes belonging to the window. This is currently only implemented for Windows

func Linux

func Linux() bool

Linux returns true if we're running on Linux

func NormalizeScalar

func NormalizeScalar(v float32) float32

NormalizeScalar "trims" the given float32 to 2 points of precision (e.g. 0.15442 -> 0.15) This is used both for windows core audio volume levels and for cleaning up slider level values from serial

func OpenExternal

func OpenExternal(logger *zap.SugaredLogger, cmd string, arg string) error

OpenExternal spawns a detached window with the provided command and argument

func SetupCloseHandler

func SetupCloseHandler() chan os.Signal

SetupCloseHandler creates a 'listener' on a new goroutine which will notify the program if it receives an interrupt from the OS

func SignificantlyDifferent

func SignificantlyDifferent(old float32, new float32, noiseReductionLevel string) bool

SignificantlyDifferent returns true if there's a significant enough volume difference between two given values

Types

This section is empty.

Jump to

Keyboard shortcuts

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