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)
|
||||
|
||||
// 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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue