Documentation
¶
Overview ¶
Package klang provides audio playing and encoding support
Index ¶
- Variables
- type Audio
- type CanLoop
- type Encoding
- type Filter
- type Format
- type FullAudio
- type Multi
- func (m *Multi) Copy() (Audio, error)
- func (m *Multi) Filter(fs ...Filter) (Audio, error)
- func (m *Multi) MustCopy() Audio
- func (m *Multi) MustFilter(fs ...Filter) Audio
- func (m *Multi) Play() <-chan error
- func (m *Multi) PlayLength() time.Duration
- func (m *Multi) SetVolume(vol int32) error
- func (m *Multi) Stop() error
- type Stream
Constants ¶
This section is empty.
Variables ¶
var SkipDevicesContaining = "HDMI"
SkipDevicesContaining is a environment variable controlled value which will cause audio devices containing the given string to be skipped when finding an audio device to play audio through. Currently only supported on linux. Todo: find a more elegant fix for bad audio devices being chosen
Functions ¶
This section is empty.
Types ¶
type Audio ¶
type Audio interface { // Play returns a channel that will signal when it finishes playing. // Looping audio will never send on this channel! // The value sent will always be true. Play() <-chan error // Filter will return an audio with some desired filters applied Filter(...Filter) (Audio, error) MustFilter(...Filter) Audio // Stop will stop an ongoing audio Stop() error // Implementing struct-- encoding Copy() (Audio, error) MustCopy() Audio PlayLength() time.Duration // SetVolume sets the volume of an audio at an OS level, // post filters. It multiplies with any volume filters. // It takes a value from 0 to -10000, and can only reduce // volume from the raw input. SetVolume(int32) error }
Audio represents playable, filterable audio data.
func EncodeBytes ¶
type Encoding ¶
type Encoding struct { // Consider: non []byte data? // Consider: should Data be a type just like Format and CanLoop? Data []byte Format CanLoop }
Encoding contains all information required to convert raw data (currently assumed PCM data but that may/will change) into playable Audio
func (*Encoding) Copy ¶
Copy returns an audio encoded from this encoding. Consider: Copy might be tied to HasEncoding
func (*Encoding) PlayLength ¶
PlayLength returns how long this encoding will play its data for
type Filter ¶
A Filter takes an input audio and returns some new Audio from them. This usage implies that Audios can be copied, and that Audios have available information to be generically modified by a Filter. The functions for these capabilities are yet fleshed out. It's worth considering whether a Filter modifies in place. The answer is probably yes: a.Filter(fs) would modify a in place a.Copy().Filter(fs) would return a new audio Specific audio implementations could not follow this, however.
type Format ¶
Format stores the variables which are presumably constant for any given type of audio (wav / mp3 / flac ...)
func (*Format) GetBitDepth ¶
GetBitDepth satisfied supports.BitDepth
func (*Format) GetChannels ¶
GetChannels satisfies supports.Channels
func (*Format) GetSampleRate ¶
GetSampleRate satisfies supports.SampleRate
type Multi ¶
type Multi struct {
Audios []Audio
}
A Multi lets lists of audios be used simultaneously
func (*Multi) MustFilter ¶
MustFilter acts like filter but ignores errors.
func (*Multi) PlayLength ¶
PlayLength returns how long this audio will play for
type Stream ¶
type Stream interface { // Play returns a channel that will signal when it finishes playing. // Looping audio will never send on this channel! // The value sent will always be true. Play() <-chan error // Filter will return an audio with some desired filters applied Filter(...Filter) (Audio, error) MustFilter(...Filter) Audio // Stop will stop an ongoing audio Stop() error }
Stream represents an audio stream. unlike Audio, the length of the stream is unknown. Copy is also not supported.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package filter provides various audio filters to be applied to audios through the Filter function.
|
Package filter provides various audio filters to be applied to audios through the Filter function. |
supports
Package supports holds interface types for filter supports.
|
Package supports holds interface types for filter supports. |
internal
|
|