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