mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-28 05:20:12 -07:00
21 lines
343 B
Go
21 lines
343 B
Go
package lingvatranslate
|
|
|
|
type Decoder struct {
|
|
sampleRate int
|
|
length int64
|
|
pos int64
|
|
buf []byte
|
|
bytesPerFrame int64
|
|
}
|
|
|
|
func NewDecoder(buf []byte)*Decoder {
|
|
return &Decoder{
|
|
}
|
|
}
|
|
func (d *Decoder) Read(buf []byte) (int, error) {
|
|
n := copy(buf, d.buf)
|
|
d.buf = d.buf[n:]
|
|
d.pos += int64(n)
|
|
return n, nil
|
|
}
|