volume

package module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2017 License: MIT Imports: 7 Imported by: 0

README

volume-go Travis Build Status Go Report Card MIT License GoDoc

Volume control in Go

This is a Go language package for controlling audio volume.

CLI tool usage

 $ go get -u github.com/itchyny/volume-go/cmd/volume
 $ volume get
25
 $ volume set 20
 $ volume get
20
 $ volume down
 $ volume status
volume: 14
muted: false
 $ volume up
 $ volume status
volume: 20
muted: false
 $ volume mute
 $ volume status
volume: 20
muted: true
 $ volume unmute
 $ volume status
volume: 20
muted: false

Package usage

package main

import (
	"fmt"
	"log"

	"github.com/itchyny/volume-go"
)

func main() {
	vol, err := volume.GetVolume()
	if err != nil {
		log.Fatalf("get volume failed: %+v", err)
	}
	fmt.Printf("current volume: %d\n", vol)

	err = volume.SetVolume(10)
	if err != nil {
		log.Fatalf("set volume failed: %+v", err)
	}
	fmt.Printf("set volume success\n")

	err = volume.Mute()
	if err != nil {
		log.Fatalf("mute failed: %+v", err)
	}

	err = volume.Unmute()
	if err != nil {
		log.Fatalf("unmute failed: %+v", err)
	}
}

Bug Tracker

Report bug at Issues・itchyny/volume-go - GitHub.

Author

itchyny (https://github.com/itchyny)

License

This software is released under the MIT License, see LICENSE.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMuted

func GetMuted() (bool, error)

GetMuted returns the current muted status.

func GetVolume

func GetVolume() (int, error)

GetVolume returns the current volume (0 to 100).

func IncreaseVolume

func IncreaseVolume(diff int) error

IncreaseVolume increases (or decreases) the audio volume by the specified value.

func Mute

func Mute() error

Mute mutes the audio.

func SetVolume

func SetVolume(volume int) error

SetVolume sets the sound volume to the specified value.

func Unmute

func Unmute() error

Unmute unmutes the audio.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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