mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-30 13:48:50 +08:00
increase volume limit to 100
This commit is contained in:
parent
dbb9fc6940
commit
6385abf459
@ -43,7 +43,6 @@ func newPlayer() *Player {
|
||||
func (p *Player) run(currSong *AudioFile) error {
|
||||
|
||||
p.isSkipped = make(chan bool, 1)
|
||||
|
||||
f, err := os.Open(currSong.path)
|
||||
|
||||
if err != nil {
|
||||
@ -109,9 +108,7 @@ func (p *Player) run(currSong *AudioFile) error {
|
||||
|
||||
// sets the volume of previous player
|
||||
volume.Volume += p.volume
|
||||
|
||||
p._volume = volume
|
||||
|
||||
speaker.Play(p._volume)
|
||||
|
||||
position := func() time.Duration {
|
||||
@ -212,7 +209,7 @@ func (p *Player) setVolume(v float64) float64 {
|
||||
|
||||
defer func() {
|
||||
// saves the volume
|
||||
volume := int(p.volume*10) + 50
|
||||
volume := int(p.volume*10) + 100
|
||||
viper.Set("volume", volume)
|
||||
}()
|
||||
|
||||
|
6
popup.go
6
popup.go
@ -166,13 +166,13 @@ func timedPopup(
|
||||
|
||||
// Shows popup for the current volume
|
||||
func volumePopup(volume float64) {
|
||||
vol := int(volume*10) + 50
|
||||
vol := int(volume*10) + 100
|
||||
|
||||
progress := fmt.Sprintf("\n%d |%s%s| %s",
|
||||
vol,
|
||||
strings.Repeat("█", vol),
|
||||
strings.Repeat("-", 50-vol),
|
||||
"50",
|
||||
strings.Repeat("-", 100-vol),
|
||||
"100",
|
||||
)
|
||||
|
||||
timedPopup(" Volume ", progress, getPopupTimeout(), 0, 0)
|
||||
|
6
start.go
6
start.go
@ -176,14 +176,14 @@ func start(application *tview.Application, args Args) {
|
||||
gomu.player.togglePause()
|
||||
|
||||
case '+':
|
||||
v := int(gomu.player.volume*10) + 50
|
||||
if v < 50 {
|
||||
v := int(gomu.player.volume*10) + 100
|
||||
if v < 100 {
|
||||
vol := gomu.player.setVolume(0.5)
|
||||
volumePopup(vol)
|
||||
}
|
||||
|
||||
case '-':
|
||||
v := int(gomu.player.volume*10) + 50
|
||||
v := int(gomu.player.volume*10) + 100
|
||||
if v > 0 {
|
||||
vol := gomu.player.setVolume(-0.5)
|
||||
volumePopup(vol)
|
||||
|
Loading…
x
Reference in New Issue
Block a user