refactor(sointu): change the name of AudioSink into AudioOutput

The interface is never used as anything else as Output so trying to generalize as something more vague like Sink made no sense.
This commit is contained in:
vsariola 2021-08-30 23:11:33 +03:00
parent eda48491e2
commit 1a5251dbf6
2 changed files with 6 additions and 6 deletions

View File

@ -1,8 +1,8 @@
package sointu package sointu
// AudioSink represents something where we can send audio e.g. audio output. // AudioOutput represents something where we can send audio e.g. audio output.
// WriteAudio should block if not ready to accept audio e.g. buffer full. // WriteAudio should block if not ready to accept audio e.g. buffer full.
type AudioSink interface { type AudioOutput interface {
WriteAudio(buffer []float32) error WriteAudio(buffer []float32) error
Close() error Close() error
} }
@ -11,9 +11,9 @@ type AudioSink interface {
// one AudioContext at a time. The interface is implemented at least by // one AudioContext at a time. The interface is implemented at least by
// oto.OtoContext, but in future we could also mock it. // oto.OtoContext, but in future we could also mock it.
// //
// AudioContext is used to create one or more AudioSinks with Output(); each can // AudioContext is used to create one or more AudioOutputs with Output(); each
// be used to output separate sound & closed when done. // can be used to output separate sound & closed when done.
type AudioContext interface { type AudioContext interface {
Output() AudioSink Output() AudioOutput
Close() error Close() error
} }

View File

@ -13,7 +13,7 @@ type OtoOutput struct {
tmpBuffer []byte tmpBuffer []byte
} }
func (c *OtoContext) Output() sointu.AudioSink { func (c *OtoContext) Output() sointu.AudioOutput {
return &OtoOutput{player: (*oto.Context)(c).NewPlayer(), tmpBuffer: make([]byte, 0)} return &OtoOutput{player: (*oto.Context)(c).NewPlayer(), tmpBuffer: make([]byte, 0)}
} }