adpcm: updated decode and encode pcm commands

This commit is contained in:
Trek H 2019-05-22 15:04:21 +09:30
parent 5e4a2fb866
commit 537d5bab73
2 changed files with 2 additions and 4 deletions

View File

@ -52,8 +52,7 @@ func main() {
fmt.Println("Read", len(comp), "bytes from file", inPath)
// Decode adpcm.
numBlocks := len(comp) / adpcm.AdpcmBS
decoded := bytes.NewBuffer(make([]byte, 0, adpcm.PcmBS*numBlocks))
decoded := bytes.NewBuffer(make([]byte, 0, len(comp)*4))
dec := adpcm.NewDecoder(decoded)
_, err = dec.Write(comp)
if err != nil {

View File

@ -52,8 +52,7 @@ func main() {
fmt.Println("Read", len(pcm), "bytes from file", inPath)
// Encode adpcm.
numBlocks := len(pcm) / adpcm.PcmBS
comp := bytes.NewBuffer(make([]byte, 0, adpcm.AdpcmBS*numBlocks))
comp := bytes.NewBuffer(make([]byte, 0, adpcm.EncBytes(len(pcm))))
enc := adpcm.NewEncoder(comp)
_, err = enc.Write(pcm)
if err != nil {