mirror of https://bitbucket.org/ausocean/av.git
adpcm: updated decode and encode pcm commands
This commit is contained in:
parent
5e4a2fb866
commit
537d5bab73
|
@ -52,8 +52,7 @@ func main() {
|
||||||
fmt.Println("Read", len(comp), "bytes from file", inPath)
|
fmt.Println("Read", len(comp), "bytes from file", inPath)
|
||||||
|
|
||||||
// Decode adpcm.
|
// Decode adpcm.
|
||||||
numBlocks := len(comp) / adpcm.AdpcmBS
|
decoded := bytes.NewBuffer(make([]byte, 0, len(comp)*4))
|
||||||
decoded := bytes.NewBuffer(make([]byte, 0, adpcm.PcmBS*numBlocks))
|
|
||||||
dec := adpcm.NewDecoder(decoded)
|
dec := adpcm.NewDecoder(decoded)
|
||||||
_, err = dec.Write(comp)
|
_, err = dec.Write(comp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -52,8 +52,7 @@ func main() {
|
||||||
fmt.Println("Read", len(pcm), "bytes from file", inPath)
|
fmt.Println("Read", len(pcm), "bytes from file", inPath)
|
||||||
|
|
||||||
// Encode adpcm.
|
// Encode adpcm.
|
||||||
numBlocks := len(pcm) / adpcm.PcmBS
|
comp := bytes.NewBuffer(make([]byte, 0, adpcm.EncBytes(len(pcm))))
|
||||||
comp := bytes.NewBuffer(make([]byte, 0, adpcm.AdpcmBS*numBlocks))
|
|
||||||
enc := adpcm.NewEncoder(comp)
|
enc := adpcm.NewEncoder(comp)
|
||||||
_, err = enc.Write(pcm)
|
_, err = enc.Write(pcm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue