beep
beep copied to clipboard
Cannot get playback to "wait" when using Volume
I'm trying to use the library to play MP3 files in an Elgato Stream Deck plugin, and running into a bit of an issue. Before adding the Volume logic, I had this, and it was working as I expected:
done := make(chan bool)
speaker.Play(beep.Seq(streamer, beep.Callback(func() {
done <- true
})))
<-done
// more stuff
But when I add the option for Volume, it's playing the file fine; but it's not waiting for it to finish before moving on to the rest of my logic. This is what I'm trying to use:
done := make(chan bool)
ctrl := &beep.Ctrl{Streamer: beep.Seq(streamer, beep.Callback(func() {
done <- true
})), Paused: false}
volume := &effects.Volume{
Streamer: ctrl,
Base: 10,
Volume: vol / 10,
Silent: false,
}
speaker.Play(volume)
<-done
// more stuff
Any ideas?
This is nearly identical to my usage in ditty except the pipeline is beep.Seq -> volume -> ctrl -> speaker.Play (swapped volume and ctrl).