diff --git a/audio/audio.go b/audio/audio.go index fa9f4cef0..33a0ef3ca 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -88,13 +88,9 @@ func NewContext(sampleRate int) (*Context, error) { ch := make(chan struct{}) - context, err := newContext(sampleRate, ch) - if err != nil { - return nil, err - } c := &Context{ sampleRate: sampleRate, - c: context, + c: newContext(sampleRate, ch), initCh: ch, } theContext = c diff --git a/audio/context.go b/audio/context.go index 3719bb0fe..d89cbe68e 100644 --- a/audio/context.go +++ b/audio/context.go @@ -91,12 +91,12 @@ func (p *otoPlayer) ensurePlayer() error { return nil } -func newContext(sampleRate int, initCh <-chan struct{}) (context, error) { +func newContext(sampleRate int, initCh <-chan struct{}) context { if contextForTesting != nil { - return contextForTesting, nil + return contextForTesting } return &otoContext{ sampleRate: sampleRate, initCh: initCh, - }, nil + } }