mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-14 11:04:23 -04:00
style: group types into fewer, logical files
This commit is contained in:
parent
0187cc66ec
commit
e4a2ed9f32
42
audio.go
42
audio.go
@ -7,28 +7,30 @@ import (
|
||||
"math"
|
||||
)
|
||||
|
||||
// AudioBuffer is a buffer of stereo audio samples of variable length, each
|
||||
// sample represented by a slice of [2]float32. [0] is left channel, [1] is
|
||||
// right
|
||||
type AudioBuffer [][2]float32
|
||||
type (
|
||||
// AudioBuffer is a buffer of stereo audio samples of variable length, each
|
||||
// sample represented by a slice of [2]float32. [0] is left channel, [1] is
|
||||
// right
|
||||
AudioBuffer [][2]float32
|
||||
|
||||
// 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.
|
||||
type AudioOutput interface {
|
||||
WriteAudio(buffer AudioBuffer) error
|
||||
Close() error
|
||||
}
|
||||
// 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.
|
||||
AudioOutput interface {
|
||||
WriteAudio(buffer AudioBuffer) error
|
||||
Close() error
|
||||
}
|
||||
|
||||
// AudioContext represents the low-level audio drivers. There should be at most
|
||||
// one AudioContext at a time. The interface is implemented at least by
|
||||
// oto.OtoContext, but in future we could also mock it.
|
||||
//
|
||||
// AudioContext is used to create one or more AudioOutputs with Output(); each
|
||||
// can be used to output separate sound & closed when done.
|
||||
type AudioContext interface {
|
||||
Output() AudioOutput
|
||||
Close() error
|
||||
}
|
||||
// AudioContext represents the low-level audio drivers. There should be at most
|
||||
// one AudioContext at a time. The interface is implemented at least by
|
||||
// oto.OtoContext, but in future we could also mock it.
|
||||
//
|
||||
// AudioContext is used to create one or more AudioOutputs with Output(); each
|
||||
// can be used to output separate sound & closed when done.
|
||||
AudioContext interface {
|
||||
Output() AudioOutput
|
||||
Close() error
|
||||
}
|
||||
)
|
||||
|
||||
// Wav converts a stereo signal of 32-bit floats (L R L R..., length should be
|
||||
// divisible by 2) into a valid WAV-file, returned as a []byte array.
|
||||
|
Reference in New Issue
Block a user