faiface / beep

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

[tweak] expose `beep.Buffer.data` data to caller #135

Open JackMordaunt opened 3 years ago

JackMordaunt commented 3 years ago

I'm using beep to play audio that I have already decoded into PCM s16le as a []byte.

AFAIK the beep API forces me to then wrap that slice in a streamer and append it to a beep.Buffer. However, I would prefer to just shove my byte slice onto the data field on the beep.Buffer - since it's already correctly formatted.

Opening up this fields by making it public or by introducing a second constructor would be strictly backwards compatible, and trivial to do.

Thoughts on this? Perhaps I'm misunderstanding the existing API.

In the meantime I have copied the type in it's entirety to achieve this, which does work but isn't ideal.

Thanks for the excellent package!