go-tta/codec.go

36 lines
585 B
Go
Raw Normal View History

2017-04-19 03:02:24 +00:00
package tta
2017-07-19 10:10:58 +00:00
import (
2022-02-26 13:45:39 +00:00
"git.gammaspectra.live/S.O.N.G/go-tta/filter"
2017-07-19 10:10:58 +00:00
)
2017-04-19 03:02:24 +00:00
type Info struct {
2020-09-03 21:30:29 +00:00
Format uint32 // audio format
Nch uint32 // number of channels
Bps uint32 // bits per sample
Sps uint32 // samplerate (sps)
Samples uint32 // data length in samples
2017-04-19 03:02:24 +00:00
}
type adapter struct {
k0 uint32
k1 uint32
sum0 uint32
sum1 uint32
}
func (a *adapter) init(k0, k1 uint32) {
a.k0 = k0
a.k1 = k1
a.sum0 = shift16[k0]
a.sum1 = shift16[k1]
}
type codec struct {
2017-07-21 20:06:00 +00:00
filter *filter.Filter
2017-04-19 03:02:24 +00:00
adapter adapter
prev int32
}
type Callback func(uint32, uint32, uint32)