diff --git a/commands.go b/commands.go index 7bf1be1..82eea7b 100644 --- a/commands.go +++ b/commands.go @@ -270,13 +270,13 @@ func help(user *gumble.User) { // is applied and is immediately in effect. func volume(user *gumble.User, username, value string) { if value == "" { - dj.client.Self().Channel().Send(fmt.Sprintf(CUR_VOLUME_HTML, dj.audioStream.Volume()), false) + dj.client.Self().Channel().Send(fmt.Sprintf(CUR_VOLUME_HTML, dj.audioStream.Volume), false) } else { if parsedVolume, err := strconv.ParseFloat(value, 32); err == nil { newVolume := float32(parsedVolume) if newVolume >= dj.conf.Volume.LowestVolume && newVolume <= dj.conf.Volume.HighestVolume { - dj.audioStream.SetVolume(newVolume) - dj.client.Self().Channel().Send(fmt.Sprintf(VOLUME_SUCCESS_HTML, username, dj.audioStream.Volume()), false) + dj.audioStream.Volume = newVolume + dj.client.Self().Channel().Send(fmt.Sprintf(VOLUME_SUCCESS_HTML, username, dj.audioStream.Volume), false) } else { dj.SendPrivateMessage(user, fmt.Sprintf(NOT_IN_VOLUME_RANGE_MSG, dj.conf.Volume.LowestVolume, dj.conf.Volume.HighestVolume)) } diff --git a/main.go b/main.go index 90df9ee..21da302 100644 --- a/main.go +++ b/main.go @@ -51,8 +51,7 @@ func (dj *mumbledj) OnConnect(e *gumble.ConnectEvent) { if audioStream, err := gumble_ffmpeg.New(dj.client); err == nil { dj.audioStream = audioStream - dj.audioStream.Done = dj.queue.OnItemFinished - dj.audioStream.SetVolume(dj.conf.Volume.DefaultVolume) + dj.audioStream.Volume = dj.conf.Volume.DefaultVolume } else { panic(err) } diff --git a/song.go b/song.go index 93d68d2..f31b579 100644 --- a/song.go +++ b/song.go @@ -83,7 +83,7 @@ func (s *Song) Download() error { // Plays the song. Once the song is playing, a notification is displayed in a text message that features the video thumbnail, URL, title, // duration, and submitter. func (s *Song) Play() { - if err := dj.audioStream.Play(fmt.Sprintf("%s/.mumbledj/songs/%s.m4a", dj.homeDir, s.youtubeId)); err != nil { + if err := dj.audioStream.Play(fmt.Sprintf("%s/.mumbledj/songs/%s.m4a", dj.homeDir, s.youtubeId), dj.queue.OnItemFinished); err != nil { panic(err) } else { dj.client.Self().Channel().Send(fmt.Sprintf(NOW_PLAYING_HTML, s.thumbnailUrl, s.youtubeId, s.title, s.duration, s.submitter), false)