audio: changed comment wording

This commit is contained in:
Trek H 2019-11-11 22:40:13 +10:30
parent c4134fd30e
commit 151ec56fc9
2 changed files with 11 additions and 11 deletions

View File

@ -61,20 +61,20 @@ const (
stopped
)
// ALSA holds everything we need to know about the audio input stream and implements io.Reader and device.AVDevice.
// An ALSA device holds everything we need to know about the audio input stream and implements io.Reader and device.AVDevice.
type ALSA struct {
l Logger // Logger for device's routines to log to.
mode uint8 // Operating mode, either running, paused, or stopped.
mu sync.Mutex // Provides synchronisation when changing modes concurrently.
title string // Name of audio title, or empty for the default title.
dev *alsa.Device // ALSA's Audio input device.
ab alsa.Buffer // ALSA's buffer.
dev *alsa.Device // ALSA device's Audio input device.
ab alsa.Buffer // ALSA device's buffer.
rb *ring.Buffer // Our buffer.
chunkSize int // This is the number of bytes that will be stored in rb at a time.
Config // Configuration parameters for this device.
}
// Config provides parameters used by ALSA.
// Config provides parameters used by the ALSA device.
type Config struct {
SampleRate int
Channels int
@ -93,13 +93,13 @@ type Logger interface {
// OpenError is used to determine whether an error has originated from attempting to open a device.
type OpenError error
// NewALSA initializes and returns an ALSA which has its logger set as the given logger.
// NewALSA initializes and returns an ALSA device which has its logger set as the given logger.
func NewALSA(l Logger) *ALSA { return &ALSA{l: l} }
// Set will take a Config struct, check the validity of the relevant fields
// and then performs any configuration necessary. If fields are not valid,
// an error is added to the multiError and a default value is used.
// It then initialises the ALSA which can then be started, read from, and stopped.
// It then initialises the ALSA device which can then be started, read from, and stopped.
func (d *ALSA) Set(c config.Config) error {
var errs device.MultiError
if c.SampleRate <= 0 {
@ -162,7 +162,7 @@ func (d *ALSA) Set(c config.Config) error {
}
// Start will start recording audio and writing to the ringbuffer.
// Once a ALSA has been stopped it cannot be started again. This is likely to change in future.
// Once an ALSA device has been stopped it cannot be started again. This is likely to change in future.
func (d *ALSA) Start() error {
d.mu.Lock()
mode := d.mode
@ -184,7 +184,7 @@ func (d *ALSA) Start() error {
}
// Stop will stop recording audio and close the device.
// Once a ALSA has been stopped it cannot be started again. This is likely to change in future.
// Once an ALSA device has been stopped it cannot be started again. This is likely to change in future.
func (d *ALSA) Stop() {
d.mu.Lock()
d.mode = stopped
@ -345,12 +345,12 @@ func (d *ALSA) open() error {
return OpenError(err)
}
d.l.Log(logger.Debug, pkg+"successfully negotiated ALSA params")
d.l.Log(logger.Debug, pkg+"successfully negotiated device params")
return nil
}
// input continously records audio and writes it to the ringbuffer.
// Re-opens the device and tries again if ASLA returns an error.
// Re-opens the device and tries again if the ASLA device returns an error.
func (d *ALSA) input() {
for {
// Check mode.

View File

@ -47,7 +47,7 @@ func TestDevice(t *testing.T) {
}
n := 2 // Number of periods to wait while recording.
// Create a new ADPCMDevice, start, read/lex, and then stop it.
// Create a new ALSA device, start, read/lex, and then stop it.
l := logger.New(logger.Debug, os.Stderr, true)
ai := NewALSA(l)
err := ai.Set(c)