From: Hraban Luyat Date: Sun, 23 Jul 2017 22:37:53 +0000 (+0100) Subject: README: clarify stereo vs mono in decoding api X-Git-Tag: v2.0.0~27 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=629543142db90c1b3a22ac9deaee0e84a0d04aa5;p=go-opus.git README: clarify stereo vs mono in decoding api --- diff --git a/README.md b/README.md index 40c3962..152737d 100644 --- a/README.md +++ b/README.md @@ -100,11 +100,11 @@ if err != nil { // To get all samples (interleaved if multiple channels): pcm = pcm[:n*channels] // only necessary if you didn't know the right frame size -// or access directly: +// or access sample per sample, directly: for i := 0; i < n; i++ { ch1 := pcm[i*channels+0] - // if stereo: - ch2 := pcm[i*channels+1] + // For stereo output: copy ch1 into ch2 in mono mode, or deinterleave stereo + ch2 := pcm[(i*channels)+(channels-1)] } ```