Checkpoint
This commit is contained in:
125 files changed
+59376
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package audio
|
||||
|
||||
// Complex128 represents a slice of 64-bit floating-point linear PCM encoded
|
||||
// audio samples, in the range of -1 to +1.
|
||||
type Complex128 []complex128
|
||||
|
||||
// Len implements the Slice interface.
|
||||
func (p Complex128) Len() int {
|
||||
return len(p)
|
||||
}
|
||||
|
||||
// Cap implements the Slice interface.
|
||||
func (p Complex128) Cap() int {
|
||||
return cap(p)
|
||||
}
|
||||
|
||||
// At implements the Slice interface.
|
||||
func (p Complex128) At(i int) float64 {
|
||||
return real(p[i])
|
||||
}
|
||||
|
||||
// Set implements the Slice interface.
|
||||
func (p Complex128) Set(i int, s float64) {
|
||||
p[i] = complex(s, 0)
|
||||
}
|
||||
|
||||
// Slice implements the Slice interface.
|
||||
func (p Complex128) Slice(low, high int) Slice {
|
||||
return p[low:high]
|
||||
}
|
||||
|
||||
// Make implements the Slice interface.
|
||||
func (p Complex128) Make(length, capacity int) Slice {
|
||||
return make(Float64, length, capacity)
|
||||
}
|
||||
|
||||
// CopyTo implements the Slice interface.
|
||||
func (p Complex128) CopyTo(dst Slice) int {
|
||||
d, ok := dst.(Complex128)
|
||||
if ok {
|
||||
return copy(d, p)
|
||||
}
|
||||
return sliceCopy(dst, p)
|
||||
}
|
||||
Reference in new issue
Block a user