-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaudio.go
More file actions
36 lines (30 loc) · 1.07 KB
/
Copy pathaudio.go
File metadata and controls
36 lines (30 loc) · 1.07 KB
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
27
28
29
30
31
32
33
34
35
36
package cardputer
import "errors"
var errAudioStreamUnavailable = errors.New("audio streaming is not implemented for this target")
// ES8311Resolution describes the sample width programmed into the Adv audio codec.
type ES8311Resolution uint8
const (
// Supported ES8311 PCM sample widths.
ES8311Resolution16 ES8311Resolution = 16
ES8311Resolution18 ES8311Resolution = 18
ES8311Resolution20 ES8311Resolution = 20
ES8311Resolution24 ES8311Resolution = 24
ES8311Resolution32 ES8311Resolution = 32
)
// AudioTransportConfig describes the PCM link settings expected by the
// board-specific audio transport layer.
type AudioTransportConfig struct {
// SampleRate is the PCM sample rate in hertz.
SampleRate uint32
// BitsPerSample is the PCM word size.
BitsPerSample ES8311Resolution
// Channels is the channel count expected by the transport.
Channels uint8
// UseMCLK reports whether the transport is expected to drive a master clock.
UseMCLK bool
}
type audioTransport interface {
Configure(AudioTransportConfig) error
Write([]int16) (int, error)
Read([]int16) (int, error)
}