]> Sergey Matveev's repositories - go-opus.git/commitdiff
README: clarify stereo vs mono in decoding api
authorHraban Luyat <hraban@0brg.net>
Sun, 23 Jul 2017 22:37:53 +0000 (23:37 +0100)
committerHraban Luyat <hraban@0brg.net>
Sun, 23 Jul 2017 22:38:36 +0000 (23:38 +0100)
README.md

index 40c396251c56cb89f7dfff6192431f430104803e..152737d8e06b3583ad958c95dfe9b6964a1d0d0b 100644 (file)
--- 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)]
 }
 ```