gopxl / beep

A little package that brings sound to any Go application. Suitable for playback and audio-processing.
MIT License
287 stars 13 forks source link

Make testing with the speaker more convenient #44

Open MarkKremer opened 1 year ago

MarkKremer commented 1 year ago

I was just testing a PR and wanted to play something through a speaker. The speaker doesn't wait for playback to finish. The tutorial states that you have to do the following:

done := make(chan bool)
speaker.Play(beep.Seq(streamer, beep.Callback(func() {
    done <- true
})))

<-done

It would be nice to have a helper method to do this:

speaker.PlayAndWait(streamer)
speaker.PlaySync(streamer) //or

This method must work with multiple streamers, just like speaker.Play accepts multiple streamers.

Notes for myself:

MarkKremer commented 1 year ago

I marked this as a good first issue because the scope is limited to a very small part of Beep and not a lot of knowledge of the package is required. However, it does deal with concurrency which makes it more difficult to implement.