audio: refactoring

This commit is contained in:
Hajime Hoshi 2022-08-08 12:04:30 +09:00
parent 445378ab31
commit aca290caa9
2 changed files with 1 additions and 5 deletions

View File

@ -25,7 +25,7 @@ import (
func newContext(sampleRate, channelCount, bitDepthInBytes int) (context, chan struct{}, error) { func newContext(sampleRate, channelCount, bitDepthInBytes int) (context, chan struct{}, error) {
ctx, ready, err := oto.NewContext(sampleRate, channelCount, bitDepthInBytes) ctx, ready, err := oto.NewContext(sampleRate, channelCount, bitDepthInBytes)
return otoContextToContext(ctx), ready, err return &contextProxy{ctx}, ready, err
} }
// otoContext is an interface for *oto.Context. // otoContext is an interface for *oto.Context.
@ -45,7 +45,3 @@ type contextProxy struct {
func (c *contextProxy) NewPlayer(r io.Reader) player { func (c *contextProxy) NewPlayer(r io.Reader) player {
return c.otoContext.NewPlayer(r).(player) return c.otoContext.NewPlayer(r).(player)
} }
func otoContextToContext(ctx otoContext) context {
return &contextProxy{ctx}
}