|
|
@ -116,7 +116,7 @@ func main() {
|
|
|
|
onRecvFrames := func(output_samples []byte, input_samples []byte, framecount uint32) {
|
|
|
|
onRecvFrames := func(output_samples []byte, input_samples []byte, framecount uint32) {
|
|
|
|
pcm := make([]int16, len(input_samples)/2)
|
|
|
|
pcm := make([]int16, len(input_samples)/2)
|
|
|
|
for i := 0; i < len(input_samples)/2; i++ {
|
|
|
|
for i := 0; i < len(input_samples)/2; i++ {
|
|
|
|
pcm[i] = int16(binary.BigEndian.Uint16(input_samples[2*i:]))
|
|
|
|
pcm[i] = int16(binary.LittleEndian.Uint16(input_samples[2*i:]))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
data := make([]byte, len(input_samples))
|
|
|
|
data := make([]byte, len(input_samples))
|
|
|
@ -193,7 +193,7 @@ func main() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data := make([]byte, written*2)
|
|
|
|
data := make([]byte, written*2)
|
|
|
|
for i := 0; i < written; i++ {
|
|
|
|
for i := 0; i < written; i++ {
|
|
|
|
binary.BigEndian.PutUint16(data[i*2:], uint16(pcm[i]))
|
|
|
|
binary.LittleEndian.PutUint16(data[i*2:], uint16(pcm[i]))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
speaker <- data
|
|
|
|
speaker <- data
|
|
|
|
}
|
|
|
|
}
|
|
|
|