-
Notifications
You must be signed in to change notification settings - Fork 4
/
source.go
26 lines (24 loc) · 1.04 KB
/
source.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2018 The ZikiChombo Authors. All rights reserved. Use of this source
// code is governed by a license that can be found in the License file.
package sound
// Source is an interface for a source of samples.
type Source interface {
Form
Closer
// Receive places samples in d.
//
// Receive returns the number of frames placed in d together with
// any error. Receive may use all of d as scatch space.
//
// Receive returns a non-nil error if and only if it returns 0 frames
// received. Receive may return 0 < n < len(d)/Channels() frames only
// if the subsequent call will return (0, io.EOF). As a result, the
// caller need not be concerned with whether or not the data is "ready".
//
// Receive returns multi-channel data in de-interleaved format.
// If len(d) is not a multiple of Channels(), then Receive returns
// ErrChannelAlignment. If Receive returns fewer than len(d)/Channels()
// frames, then the deinterleaved data of n frames is arranged in
// the prefix d[:n*Channels()].
Receive(d []float64) (int, error)
}