项目
在 GitHub 查看
itchyny/volume-go
关于
Cross-platform audio volume control library for Go
设计与媒体实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- +1
- 1个月
- 0
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文volume-go
Cross-platform audio volume control library for Go language
This is a Go language package for controlling audio volume.
volume command
Homebrew
brew install itchyny/tap/volume
Build from source
go install github.com/itchyny/volume-go/cmd/volume@latest
Basic usage
$ # Get the current audio volume.
$ volume get
20
$ # Set the audio volume.
$ volume set 40
$ volume status
volume: 40
muted: false
$ # Increase/decrease the audio volume.
$ volume get
40
$ volume up
$ volume get
46
$ volume down
$ volume get
44
$ # Get current audio volume status.
$ volume status
volume: 20
muted: false
$ # Mute and unmute.
$ 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.
探索相关项目
加载中…