Skip to content

Commit

Permalink
audio/mp3, audio/vorbis, audio/wav: add comments about cache
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed May 4, 2024
1 parent c3b9afe commit 322ad99
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions audio/mp3/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ func DecodeWithoutResampling(src io.Reader) (*Stream, error) {
//
// A Stream doesn't close src even if src implements io.Closer.
// Closing the source is src owner's responsibility.
//
// Resampling can be a very heavy task. Stream has a cache for resampling, but the size is limited.
// Do not expect that Stream has a resampling cache even after whole data is played.
func DecodeWithSampleRate(sampleRate int, src io.Reader) (*Stream, error) {
d, err := mp3.NewDecoder(src)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions audio/vorbis/vorbis.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ func DecodeWithoutResampling(src io.Reader) (*Stream, error) {
//
// A Stream doesn't close src even if src implements io.Closer.
// Closing the source is src owner's responsibility.
//
// Resampling can be a very heavy task. Stream has a cache for resampling, but the size is limited.
// Do not expect that Stream has a resampling cache even after whole data is played.
func DecodeWithSampleRate(sampleRate int, src io.Reader) (*Stream, error) {
decoded, channelCount, origSampleRate, err := decode(src)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions audio/wav/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ func DecodeWithoutResampling(src io.Reader) (*Stream, error) {
//
// A Stream doesn't close src even if src implements io.Closer.
// Closing the source is src owner's responsibility.
//
// Resampling can be a very heavy task. Stream has a cache for resampling, but the size is limited.
// Do not expect that Stream has a resampling cache even after whole data is played.
func DecodeWithSampleRate(sampleRate int, src io.Reader) (*Stream, error) {
s, origSampleRate, err := decode(src)
if err != nil {
Expand Down

0 comments on commit 322ad99

Please sign in to comment.